Compare commits

...
Author SHA1 Message Date
Polymeta c49a60a23a 26.3 rough draft
Signed-off-by: Polymeta <4726322-Polymeta@users.noreply.gitlab.com>
2026-10-28 14:15:57 +00:00
343 changed files with 1335 additions and 1338 deletions
@@ -16,6 +16,7 @@ import dev.lambdaurora.lambdynlights.api.entity.luminance.EntityLuminance;
import dev.lambdaurora.lambdynlights.api.item.ItemLightSourceManager;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityTypes;
public class LambDynamicLightsInitializer implements DynamicLightsInitializer {
public static final EntityLuminance.Type POKEMON_LUMINANCE = EntityLuminance.Type.registerSimple(
@@ -32,7 +33,7 @@ public class LambDynamicLightsInitializer implements DynamicLightsInitializer {
Cobblemon.LOGGER.info("Lamb Dynamic Lights compatibility enabled");
context.entityLightSourceManager().onRegisterEvent().register(ctx -> {
ctx.register(EntityType.PLAYER, PlayerLuminance.INSTANCE);
ctx.register(EntityTypes.PLAYER, PlayerLuminance.INSTANCE);
ctx.register(CobblemonEntities.POKEMON, PokemonLuminance.INSTANCE);
});
}
@@ -13,6 +13,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.animal.bee.Bee;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BonemealSource;
import net.minecraft.world.level.block.BonemealableBlock;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Final;
@@ -39,11 +40,11 @@ public abstract class BeeEntityMixin {
}
ServerLevel level = (ServerLevel) this.bee.level();
if (!bonemealable.isValidBonemealTarget(level, pos, blockState)) {
if (!bonemealable.isValidBonemealTarget(level, pos, blockState, BonemealSource.MOB)) {
return null;
}
bonemealable.performBonemeal(level, this.bee.getRandom(), pos, blockState);
bonemealable.performBonemeal(level, this.bee.getRandom(), pos, blockState, BonemealSource.MOB);
return level.getBlockState(pos);
}
}
@@ -20,6 +20,7 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@@ -42,7 +43,7 @@ public abstract class BeehiveBlockEntityMixin {
if (player != null) {
final BeehiveBlockEntity blockEntity = (BeehiveBlockEntity) (Object) this;
// if the block is sedated or the player is too far away, no aggro should be applied
if (blockEntity.isSedated() || player.position().distanceToSqr(blockEntity.getBlockPos().getCenter()) > 16.0)
if (blockEntity.isSedated() || player.position().distanceToSqr(Vec3.atCenterOf(blockEntity.getBlockPos())) > 16.0)
return;
// from this point need to access private members of the block entity
final BeehiveBlockEntityAccessor blockEntityAccessor = (BeehiveBlockEntityAccessor) this;
@@ -9,23 +9,20 @@
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.api.tags.CobblemonBlockTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.PointedDripstoneBlock;
import net.minecraft.world.level.block.SpeleothemBlock;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.Slice;
@Mixin(PointedDripstoneBlock.class)
@Mixin(SpeleothemBlock.class)
public abstract class PointedDripstoneBlockMixin {
@Redirect(
method = "canGrow(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;)Z",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;is(Lnet/minecraft/world/level/block/Block;)Z", ordinal = 0),
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/world/level/block/Blocks;DRIPSTONE_BLOCK:Lnet/minecraft/world/level/block/Block;"))
method = "canGrow",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;is(Ljava/lang/Object;)Z", ordinal = 0)
)
private static boolean cobblemon$validateMoonStoneDripstone(BlockState instance, Block block) {
private static boolean cobblemon$validateMoonStoneDripstone(BlockState instance, Object o) {
return instance.is(CobblemonBlockTags.DRIPSTONE_GROWABLE);
}
@@ -35,7 +35,7 @@ public abstract class RecipeManagerMixin {
@Final
private static Map<ResourceKey<RecipePropertySet>, RecipeManager.IngredientExtractor> RECIPE_PROPERTY_SETS;
@WrapOperation(method = "<clinit>", at = @At(value = "INVOKE", target = "Ljava/util/Map;of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;"))
@WrapOperation(method = "<clinit>", at = @At(value = "INVOKE", target = "Ljava/util/Map;of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;"))
private static Map poggers(Object k1, Object v1,
Object k2, Object v2,
Object k3, Object v3,
@@ -43,8 +43,10 @@ public abstract class RecipeManagerMixin {
Object k5, Object v5,
Object k6, Object v6,
Object k7, Object v7,
Object k8, Object v8,
Object k9, Object v9,
Operation<Map> original) {
return new HashMap(original.call(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7));
return new HashMap(original.call(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7, k8, v8, k9, v9));
}
@Inject(method = "<clinit>", at = @At("TAIL"))
@@ -50,7 +50,7 @@ public abstract class ServerLevelMixin extends Level {
final ServerLevel serverLevel = (ServerLevel) (Object) this;
if (ci.getReturnValue().isEmpty()) {
// Search for Pokemon with the ability Lightning Rod and redirect to them
AABB aABB = AABB.encapsulatingFullBlocks(blockPos, new BlockPos(blockPos.atY(serverLevel.getMaxY() + 1))).inflate(64.0);
AABB aABB = AABB.encapsulatingFullBlocks(blockPos, blockPos.atY(serverLevel.getMaxY() + 1)).inflate(64.0);
List<LivingEntity> list = serverLevel.getEntitiesOfClass(LivingEntity.class, aABB, (livingEntity) -> livingEntity != null
&& livingEntity.isAlive()
&& livingEntity instanceof PokemonEntity
@@ -11,13 +11,13 @@ package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.block.HeartyGrainsBlock;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.DoublePlantBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.SimpleBlockFeature;
import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -28,7 +28,7 @@ public class SimpleBlockFeatureMixin {
//this mixin inserts the logic needed to ensure that when hearty grains are of a certain age, they place with the upper block too
//similarly to what the doubleblock logic is here
@Inject(method = "place", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;canSurvive(Lnet/minecraft/world/level/LevelReader;Lnet/minecraft/core/BlockPos;)Z", shift = At.Shift.AFTER), cancellable = true)
public void place(FeaturePlaceContext<SimpleBlockConfiguration> context, CallbackInfoReturnable<Boolean> cir,
public void place(WorldGenLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos origin, CallbackInfoReturnable<Boolean> cir,
@Local BlockState blockState, @Local BlockPos blockPos, @Local WorldGenLevel worldGenLevel) {
if (!(blockState.getBlock() instanceof HeartyGrainsBlock)) {
return;
@@ -14,7 +14,7 @@ import com.cobblemon.mod.common.duck.SoundEngineDuck;
import com.cobblemon.mod.common.duck.SoundManagerDuck;
import net.minecraft.client.resources.sounds.BiomeAmbientSoundsHandler;
import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.client.resources.sounds.UnderwaterAmbientSoundInstances;
import net.minecraft.client.resources.sounds.UnderLiquidSubSound;
import net.minecraft.client.sounds.SoundEngine;
import net.minecraft.client.sounds.SoundManager;
import net.minecraft.resources.Identifier;
@@ -39,7 +39,7 @@ public abstract class SoundManagerMixin implements SoundManagerDuck {
// Never-ending ambient loops are a special exception (they are only initiated once) and should always be paused if filtered.
private boolean isAmbientLoop(SoundInstance sound) {
return sound instanceof BiomeAmbientSoundsHandler.LoopSoundInstance || sound instanceof UnderwaterAmbientSoundInstances.UnderwaterAmbientSoundInstance;
return sound instanceof BiomeAmbientSoundsHandler.LoopSoundInstance || sound instanceof UnderLiquidSubSound;
}
private boolean filterCondition(SoundInstance sound) {
@@ -19,6 +19,7 @@ import net.minecraft.world.level.LevelHeightAccessor;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeSource;
import net.minecraft.world.level.biome.Climate;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.RandomState;
import net.minecraft.world.level.levelgen.structure.PoolElementStructurePiece;
@@ -56,13 +57,11 @@ public abstract class StructureMixin {
cancellable = true
)
private void cobblemon$rejectStartsOutsideHeightRange(
Holder<Structure> selected,
ResourceKey<Level> dimension,
RegistryAccess registryAccess, ChunkGenerator chunkGenerator, BiomeSource biomeSource,
Holder<Structure> selected, ResourceKey<Level> dimension, RegistryAccess registryAccess,
ChunkGenerator chunkGenerator, BiomeSource biomeSource, Climate.Sampler climateSampler,
RandomState randomState, StructureTemplateManager structureTemplateManager, long seed,
ChunkPos sourceChunkPos, int references, LevelHeightAccessor heightAccessor,
Predicate<Holder<Biome>> validBiome,
CallbackInfoReturnable<StructureStart> cir,
Predicate<Holder<Biome>> validBiome, CallbackInfoReturnable<StructureStart> cir,
@Local StructureStart structureStart
) {
for (StructurePiece piece : structureStart.getPieces()) {
@@ -15,11 +15,10 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.Containers;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.ItemStackTemplate;
import net.minecraft.world.item.alchemy.PotionBrewing;
import net.minecraft.world.item.crafting.RecipeHolder;
@@ -38,8 +37,8 @@ import java.util.Optional;
@Mixin(BrewingStandBlockEntity.class)
public class BrewingStandBlockEntityMixin {
@WrapOperation(method = "serverTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/BrewingStandBlockEntity;doBrew(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/NonNullList;)V"))
private static void cobblemon$doBrew(Level level, BlockPos pos, NonNullList<ItemStack> slots, Operation<Void> original) {
@WrapOperation(method = "serverTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/BrewingStandBlockEntity;doBrew(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BrewingStandBlockEntity;)V"))
private static void cobblemon$doBrew(ServerLevel level, BlockPos pos, BrewingStandBlockEntity entity, Operation<Void> original) {
var recipe = cobblemon$fetchBrewingRecipe(slots, level);
if(recipe == null) {
original.call(level, pos, slots);
@@ -67,9 +66,8 @@ public class BrewingStandBlockEntityMixin {
level.levelEvent(LevelEvent.SOUND_BREWING_STAND_BREW, pos, 0);
}
@WrapOperation(method = "serverTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/BrewingStandBlockEntity;isBrewable(Lnet/minecraft/world/item/alchemy/PotionBrewing;Lnet/minecraft/core/NonNullList;)Z"))
private static boolean cobblemon$isBrewable(PotionBrewing potionBrewing, NonNullList<ItemStack> items, Operation<Boolean> original,
@Local(argsOnly = true) Level level) {
@WrapOperation(method = "serverTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/BrewingStandBlockEntity;isBrewable(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/block/entity/BrewingStandBlockEntity;)Z"))
private static boolean cobblemon$isBrewable(ServerLevel serverLevel, BrewingStandBlockEntity entity, Operation<Boolean> original) {
return cobblemon$fetchBrewingRecipe(items, level) != null || original.call(potionBrewing, items);
}
@@ -42,7 +42,7 @@ public abstract class AvatarRendererMixin {
@ModifyExpressionValue(
method = "getRenderOffset(Lnet/minecraft/client/renderer/entity/state/AvatarRenderState;)Lnet/minecraft/world/phys/Vec3;",
at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/state/HumanoidRenderState;isCrouching:Z", opcode = Opcodes.GETFIELD)
at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/state/AvatarRenderState;isCrouching:Z", opcode = Opcodes.GETFIELD)
)
private boolean cobblemon$disableMountedCrouchOffset(boolean isCrouching, AvatarRenderState state) {
AvatarRenderStateDuck duck = (AvatarRenderStateDuck) state;
@@ -11,7 +11,6 @@ package com.cobblemon.mod.common.mixin.client;
import com.cobblemon.mod.common.api.scheduling.ClientTaskTracker;
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.world.entity.Entity;
@@ -33,7 +32,7 @@ public class GameRendererMixin {
method = "render",
at = @At(value = "TAIL")
)
public void render(DeltaTracker counter, boolean tick, CallbackInfo ci) {
public void render(CallbackInfo ci) {
Minecraft client = Minecraft.getInstance();
long newTime = System.currentTimeMillis();
// Don't play scheduled animations when the game is paused
@@ -1,62 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin.client;
import com.cobblemon.mod.common.item.PokeBallItem;
import com.cobblemon.mod.common.item.PokedexItem;
import net.minecraft.client.renderer.entity.ItemEntityRenderer;
import net.minecraft.client.renderer.entity.state.ItemEntityRenderState;
import net.minecraft.client.renderer.item.ItemModelResolver;
import net.minecraft.core.component.DataComponents;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ItemEntityRenderer.class)
public class ItemEntityRendererMixin {
@Shadow @Final private ItemModelResolver itemModelResolver;
@Inject(method = "extractRenderState", at = @At("TAIL"))
private void cobblemon$overrideDroppedItemModel(ItemEntity entity, ItemEntityRenderState state, float partialTick, CallbackInfo ci) {
Identifier modelId = cobblemon$getGroundModel(entity.getItem());
if (modelId == null) {
return;
}
ItemStack renderStack = entity.getItem().copy();
renderStack.set(DataComponents.ITEM_MODEL, modelId);
this.itemModelResolver.updateForNonLiving(state.item, renderStack, ItemDisplayContext.GROUND, entity);
}
@Unique
private static Identifier cobblemon$getGroundModel(ItemStack stack) {
if (stack.getItem() instanceof PokeBallItem pokeBallItem) {
return cobblemon$asStandaloneModel(pokeBallItem.getPokeBall().getModel3d());
}
if (stack.getItem() instanceof PokedexItem pokedexItem) {
return cobblemon$asStandaloneModel(pokedexItem.getType().getItemModelPath("off"));
}
return null;
}
@Unique
private static Identifier cobblemon$asStandaloneModel(Identifier modelId) {
return modelId.withPath(path -> path.startsWith("item/") ? path.substring("item/".length()) : path);
}
}
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.client.persisted.ClientPersistedData;
import kotlin.Unit;
import net.minecraft.SharedConstants;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.screens.Screen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
@@ -26,7 +27,7 @@ import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Mixin(Minecraft.class)
@Mixin(Gui.class)
public final class SnapshotWarningMixin {
@Unique
@@ -23,7 +23,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class TameableEntityMixin {
@Inject(method = "die", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/TamableAnimal;getOwner()Lnet/minecraft/world/entity/LivingEntity;"), cancellable = true)
public void cobblemon$checkIfPokemonBeforeSendingMessage(DamageSource damageSource, CallbackInfo ci, @Local(name = "var4") LivingEntity owner) {
public void cobblemon$checkIfPokemonBeforeSendingMessage(DamageSource damageSource, CallbackInfo ci) {
if(((TamableAnimal)(Object)this).level().isClientSide() || (this.getClass().isAssignableFrom(PokemonEntity.class))) {
ci.cancel();
}
@@ -29,6 +29,7 @@ import com.cobblemon.mod.common.block.sign.CobblemonWallHangingSignBlock
import com.cobblemon.mod.common.block.sign.CobblemonWallSignBlock
import com.cobblemon.mod.common.block.tmmachine.TMMachineBlock
import com.cobblemon.mod.common.block.general.MintLitterBlock
import com.cobblemon.mod.common.block.grower.ApricornTreeGrower
import com.cobblemon.mod.common.mixin.invoker.BlocksInvoker
import com.cobblemon.mod.common.mixin.invoker.DoorBlockInvoker
import com.cobblemon.mod.common.mixin.invoker.FireBlockInvoker
@@ -46,6 +47,7 @@ import net.minecraft.resources.Identifier
import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.effect.MobEffects
import net.minecraft.world.entity.EntityType
import net.minecraft.world.entity.EntityTypes
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.block.*
import net.minecraft.world.level.block.state.BlockBehaviour
@@ -58,6 +60,7 @@ import net.minecraft.world.level.block.state.properties.NoteBlockInstrument
import net.minecraft.world.level.block.state.properties.WoodType
import net.minecraft.world.level.material.MapColor
import net.minecraft.world.level.material.PushReaction
import net.minecraft.world.phys.AABB
@Suppress("SameParameterValue", "HasPlatformType", "MemberVisibilityCanBePrivate", "unused")
object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<Block>>, Block>() {
@@ -169,21 +172,21 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
@JvmField
val APRICORN_TRAPDOOR = this.create("apricorn_trapdoor", TrapdoorBlockInvoker.`cobblemon$create`(APRICORN_BLOCK_SET_TYPE, BlockBehaviour.Properties.of().setId("apricorn_trapdoor").mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(3.0F).sound(SoundType.WOOD).noOcclusion().isValidSpawn { _, _, _, _ -> false }))
private val PLANT_PROPERTIES = BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollision().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.DESTROY)
private val PLANT_PROPERTIES = Properties.of().mapColor(MapColor.PLANT).noCollision().randomTicks().instabreak().sound(SoundType.GRASS).pushReaction(PushReaction.POPPED)
@JvmField
val BLACK_APRICORN_SAPLING = this.create("black_apricorn_sapling", ApricornSaplingBlock(PLANT_PROPERTIES.setId("black_apricorn_sapling"), Apricorn.BLACK))
val BLACK_APRICORN_SAPLING = this.create("black_apricorn_sapling", SaplingBlock(ApricornTreeGrower(Apricorn.BLACK), PLANT_PROPERTIES.setId("black_apricorn_sapling")))
@JvmField
val BLUE_APRICORN_SAPLING = this.create("blue_apricorn_sapling", ApricornSaplingBlock(PLANT_PROPERTIES.setId("blue_apricorn_sapling"), Apricorn.BLUE))
val BLUE_APRICORN_SAPLING = this.create("blue_apricorn_sapling", SaplingBlock(ApricornTreeGrower(Apricorn.BLUE), PLANT_PROPERTIES.setId("blue_apricorn_sapling")))
@JvmField
val GREEN_APRICORN_SAPLING = this.create("green_apricorn_sapling", ApricornSaplingBlock(PLANT_PROPERTIES.setId("green_apricorn_sapling"), Apricorn.GREEN))
val GREEN_APRICORN_SAPLING = this.create("green_apricorn_sapling", SaplingBlock(ApricornTreeGrower(Apricorn.GREEN), PLANT_PROPERTIES.setId("green_apricorn_sapling")))
@JvmField
val PINK_APRICORN_SAPLING = this.create("pink_apricorn_sapling", ApricornSaplingBlock(PLANT_PROPERTIES.setId("pink_apricorn_sapling"), Apricorn.PINK))
val PINK_APRICORN_SAPLING = this.create("pink_apricorn_sapling", SaplingBlock(ApricornTreeGrower(Apricorn.PINK), PLANT_PROPERTIES.setId("pink_apricorn_sapling")))
@JvmField
val RED_APRICORN_SAPLING = this.create("red_apricorn_sapling", ApricornSaplingBlock(PLANT_PROPERTIES.setId("red_apricorn_sapling"), Apricorn.RED))
val RED_APRICORN_SAPLING = this.create("red_apricorn_sapling", SaplingBlock(ApricornTreeGrower(Apricorn.RED), PLANT_PROPERTIES.setId("red_apricorn_sapling")))
@JvmField
val WHITE_APRICORN_SAPLING = this.create("white_apricorn_sapling", ApricornSaplingBlock(PLANT_PROPERTIES.setId("white_apricorn_sapling"), Apricorn.WHITE))
val WHITE_APRICORN_SAPLING = this.create("white_apricorn_sapling", SaplingBlock(ApricornTreeGrower(Apricorn.WHITE), PLANT_PROPERTIES.setId("white_apricorn_sapling")))
@JvmField
val YELLOW_APRICORN_SAPLING = this.create("yellow_apricorn_sapling", ApricornSaplingBlock(PLANT_PROPERTIES.setId("yellow_apricorn_sapling"), Apricorn.YELLOW))
val YELLOW_APRICORN_SAPLING = this.create("yellow_apricorn_sapling", SaplingBlock(ApricornTreeGrower(Apricorn.YELLOW), PLANT_PROPERTIES.setId("yellow_apricorn_sapling")))
// Saccharines
@JvmField
@@ -205,12 +208,12 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
MapColor.PLANT
).strength(0.2F).randomTicks().sound(SoundType.GRASS).noOcclusion()
.isValidSpawn { _: BlockState?, _: BlockGetter?, _: BlockPos?, entity: EntityType<*>? ->
entity === EntityType.OCELOT || entity === EntityType.PARROT
entity === EntityTypes.OCELOT || entity === EntityTypes.PARROT
}.isSuffocating { _: BlockState?, _: BlockGetter?, _: BlockPos? ->
false
}.isViewBlocking { _: BlockState?, _: BlockGetter?, _: BlockPos? ->
}.isViewBlocking { _: BlockState, _: BlockGetter, _: BlockPos, _: AABB ->
false
}.ignitedByLava().pushReaction(PushReaction.DESTROY)
}.ignitedByLava().pushReaction(PushReaction.POPPED)
.isRedstoneConductor { _: BlockState?, _: BlockGetter?, _: BlockPos? ->
false
}))
@@ -242,22 +245,22 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
val SACCHARINE_SAPLING = this.create("saccharine_sapling", SaplingBlock(SaccharineTreeGrower(), PLANT_PROPERTIES.setId("saccharine_sapling")))
@JvmField
val MEDICINAL_LEEK = this.create("medicinal_leek", MedicinalLeekBlock(BlockBehaviour.Properties.of().setId("medicinal_leek").pushReaction(PushReaction.DESTROY).ignitedByLava().mapColor(MapColor.CRIMSON_NYLIUM).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MEDICINAL_LEEK_SOUNDS)))
val MEDICINAL_LEEK = this.create("medicinal_leek", MedicinalLeekBlock(BlockBehaviour.Properties.of().setId("medicinal_leek").pushReaction(PushReaction.POPPED).ignitedByLava().mapColor(MapColor.CRIMSON_NYLIUM).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MEDICINAL_LEEK_SOUNDS)))
// TODO after 1.7
// @JvmField
// val BUGWORT = this.create("bugwort", BugwortBlock(BlockBehaviour.Properties.of().pushReaction(PushReaction.DESTROY).ignitedByLava().mapColor(MapColor.COLOR_PURPLE).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MEDICINAL_LEEK_SOUNDS)))
// val BUGWORT = this.create("bugwort", BugwortBlock(BlockBehaviour.Properties.of().pushReaction(PushReaction.POPPED).ignitedByLava().mapColor(MapColor.COLOR_PURPLE).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MEDICINAL_LEEK_SOUNDS)))
@JvmField
val ENERGY_ROOT = this.create("energy_root", EnergyRootBlock(BlockBehaviour.Properties.of().setId("energy_root").pushReaction(PushReaction.DESTROY).ignitedByLava().mapColor(MapColor.DIRT).noCollision().randomTicks().instabreak().sound(CobblemonSounds.ENERGY_ROOT_SOUNDS)))
val ENERGY_ROOT = this.create("energy_root", EnergyRootBlock(BlockBehaviour.Properties.of().setId("energy_root").pushReaction(PushReaction.POPPED).ignitedByLava().mapColor(MapColor.DIRT).noCollision().randomTicks().instabreak().sound(CobblemonSounds.ENERGY_ROOT_SOUNDS)))
@JvmField
val BIG_ROOT = this.create("big_root", BigRootBlock(BlockBehaviour.Properties.of().setId("big_root").pushReaction(PushReaction.DESTROY).ignitedByLava().mapColor(MapColor.PLANT).noCollision().randomTicks().instabreak().sound(CobblemonSounds.BIG_ROOT_SOUNDS)))
val BIG_ROOT = this.create("big_root", BigRootBlock(BlockBehaviour.Properties.of().setId("big_root").pushReaction(PushReaction.POPPED).ignitedByLava().mapColor(MapColor.PLANT).noCollision().randomTicks().instabreak().sound(CobblemonSounds.BIG_ROOT_SOUNDS)))
@JvmField
val REVIVAL_HERB = this.create("revival_herb", RevivalHerbBlock(BlockBehaviour.Properties.of().setId("revival_herb").pushReaction(PushReaction.DESTROY).mapColor(MapColor.PLANT).ignitedByLava().noCollision().instabreak().sound(CobblemonSounds.REVIVAL_HERB_SOUNDS)))
val REVIVAL_HERB = this.create("revival_herb", RevivalHerbBlock(BlockBehaviour.Properties.of().setId("revival_herb").pushReaction(PushReaction.POPPED).mapColor(MapColor.PLANT).ignitedByLava().noCollision().instabreak().sound(CobblemonSounds.REVIVAL_HERB_SOUNDS)))
@JvmField
val POKE_CAKE = this.create("poke_cake", PokeSnackBlock(BlockBehaviour.Properties.of().setId("poke_cake").forceSolidOn().strength(0.5F).sound(SoundType.WOOL).pushReaction(PushReaction.DESTROY).lightLevel { if (it.getValue(BlockStateProperties.LIT)) 3 else 0 }, false))
val POKE_CAKE = this.create("poke_cake", PokeSnackBlock(BlockBehaviour.Properties.of().setId("poke_cake").forceSolidOn().strength(0.5F).sound(SoundType.WOOL).pushReaction(PushReaction.POPPED).lightLevel { if (it.getValue(BlockStateProperties.LIT)) 3 else 0 }, false))
@JvmField
val POKE_SNACK = this.create("poke_snack", PokeSnackBlock(BlockBehaviour.Properties.of().setId("poke_snack").forceSolidOn().strength(0.5F).sound(SoundType.WOOL).pushReaction(PushReaction.DESTROY).lightLevel { if (it.getValue(BlockStateProperties.LIT)) 3 else 0 }, true))
val POKE_SNACK = this.create("poke_snack", PokeSnackBlock(BlockBehaviour.Properties.of().setId("poke_snack").forceSolidOn().strength(0.5F).sound(SoundType.WOOL).pushReaction(PushReaction.POPPED).lightLevel { if (it.getValue(BlockStateProperties.LIT)) 3 else 0 }, true))
@JvmField
val TUMBLESTONE_CLUSTER = tumblestoneBlock("tumblestone_cluster", TumblestoneBlock.STAGE_3, 7, 3, null, MapColor.TERRACOTTA_ORANGE)
@@ -495,42 +498,42 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
val BLACK_CAMPFIRE_POT = create("campfire_pot_black",
CampfirePotBlock(
BlockBehaviour.Properties.of().setId("campfire_pot_black").mapColor(MapColor.COLOR_BLACK).sound(CobblemonSounds.CAMPFIRE_POT_SOUNDS)
.strength(0.5F).pushReaction(PushReaction.BLOCK).noOcclusion()
.strength(0.5F).pushReaction(PushReaction.IMMOVEABLE).noOcclusion()
)
)
@JvmField
val BLUE_CAMPFIRE_POT = create("campfire_pot_blue",
CampfirePotBlock(
BlockBehaviour.Properties.of().setId("campfire_pot_blue").mapColor(MapColor.COLOR_BLUE).sound(CobblemonSounds.CAMPFIRE_POT_SOUNDS)
.strength(0.5F).pushReaction(PushReaction.BLOCK).noOcclusion()
.strength(0.5F).pushReaction(PushReaction.IMMOVEABLE).noOcclusion()
)
)
@JvmField
val GREEN_CAMPFIRE_POT = create("campfire_pot_green",
CampfirePotBlock(
BlockBehaviour.Properties.of().setId("campfire_pot_green").mapColor(MapColor.COLOR_GREEN).sound(CobblemonSounds.CAMPFIRE_POT_SOUNDS)
.strength(0.5F).pushReaction(PushReaction.BLOCK).noOcclusion()
.strength(0.5F).pushReaction(PushReaction.IMMOVEABLE).noOcclusion()
)
)
@JvmField
val PINK_CAMPFIRE_POT = create("campfire_pot_pink",
CampfirePotBlock(
BlockBehaviour.Properties.of().setId("campfire_pot_pink").mapColor(MapColor.COLOR_PINK).sound(CobblemonSounds.CAMPFIRE_POT_SOUNDS)
.strength(0.5F).pushReaction(PushReaction.BLOCK).noOcclusion()
.strength(0.5F).pushReaction(PushReaction.IMMOVEABLE).noOcclusion()
)
)
@JvmField
val RED_CAMPFIRE_POT = create("campfire_pot_red",
CampfirePotBlock(
BlockBehaviour.Properties.of().setId("campfire_pot_red").mapColor(MapColor.COLOR_RED).sound(CobblemonSounds.CAMPFIRE_POT_SOUNDS)
.strength(0.5F).pushReaction(PushReaction.BLOCK).noOcclusion()
.strength(0.5F).pushReaction(PushReaction.IMMOVEABLE).noOcclusion()
)
)
@JvmField
val WHITE_CAMPFIRE_POT = create("campfire_pot_white",
CampfirePotBlock(
BlockBehaviour.Properties.of().setId("campfire_pot_white").mapColor(MapColor.COLOR_LIGHT_GRAY)
.sound(CobblemonSounds.CAMPFIRE_POT_SOUNDS).strength(0.5F).pushReaction(PushReaction.BLOCK)
.sound(CobblemonSounds.CAMPFIRE_POT_SOUNDS).strength(0.5F).pushReaction(PushReaction.IMMOVEABLE)
.noOcclusion()
)
)
@@ -538,7 +541,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
val YELLOW_CAMPFIRE_POT = create("campfire_pot_yellow",
CampfirePotBlock(
BlockBehaviour.Properties.of().setId("campfire_pot_yellow").mapColor(MapColor.COLOR_YELLOW).sound(CobblemonSounds.CAMPFIRE_POT_SOUNDS)
.strength(0.5F).pushReaction(PushReaction.BLOCK).noOcclusion()
.strength(0.5F).pushReaction(PushReaction.IMMOVEABLE).noOcclusion()
)
)
@@ -550,21 +553,21 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
.setId("habitat_block")
.mapColor(MapColor.STONE)
.strength(1.5F, Blocks.OBSIDIAN.explosionResistance)
.pushReaction(PushReaction.BLOCK)
.pushReaction(PushReaction.IMMOVEABLE)
)
)
@JvmField
val CAMPFIRE = create("campfire", CampfireBlock(BlockBehaviour.Properties.of().setId("campfire").sound(SoundType.WOOD).noOcclusion().pushReaction(PushReaction.BLOCK).mapColor(MapColor.PODZOL).strength(2.0F).lightLevel{14}, false))
val CAMPFIRE = create("campfire", CampfireBlock(BlockBehaviour.Properties.of().setId("campfire").sound(SoundType.WOOD).noOcclusion().pushReaction(PushReaction.IMMOVEABLE).mapColor(MapColor.PODZOL).strength(2.0F).lightLevel{14}, false))
@JvmField
val SOUL_CAMPFIRE = create("soul_campfire", CampfireBlock(BlockBehaviour.Properties.of().setId("soul_campfire").sound(SoundType.WOOD).noOcclusion().pushReaction(PushReaction.BLOCK).mapColor(MapColor.PODZOL).strength(2.0F).lightLevel{9}, true))
val SOUL_CAMPFIRE = create("soul_campfire", CampfireBlock(BlockBehaviour.Properties.of().setId("soul_campfire").sound(SoundType.WOOD).noOcclusion().pushReaction(PushReaction.IMMOVEABLE).mapColor(MapColor.PODZOL).strength(2.0F).lightLevel{9}, true))
@JvmField
val RELIC_COIN_POUCH = create("relic_coin_pouch", CoinPouchBlock(BlockBehaviour.Properties.of().setId("relic_coin_pouch").sound(CobblemonSounds.RELIC_COIN_POUCH_SOUNDS).pushReaction(PushReaction.DESTROY).noOcclusion(), true))
val RELIC_COIN_POUCH = create("relic_coin_pouch", CoinPouchBlock(BlockBehaviour.Properties.of().setId("relic_coin_pouch").sound(CobblemonSounds.RELIC_COIN_POUCH_SOUNDS).pushReaction(PushReaction.POPPED).noOcclusion(), true))
@JvmField
val RELIC_COIN_SACK = create("relic_coin_sack", CoinPouchBlock(BlockBehaviour.Properties.of().setId("relic_coin_sack").sound(CobblemonSounds.RELIC_COIN_SACK_SOUNDS).pushReaction(PushReaction.DESTROY).strength(0.4F).mapColor(MapColor.GOLD), false))
val RELIC_COIN_SACK = create("relic_coin_sack", CoinPouchBlock(BlockBehaviour.Properties.of().setId("relic_coin_sack").sound(CobblemonSounds.RELIC_COIN_SACK_SOUNDS).pushReaction(PushReaction.POPPED).strength(0.4F).mapColor(MapColor.GOLD), false))
@JvmField
val GILDED_CHEST = create("gilded_chest", GildedChestBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.CHEST).setId("gilded_chest").noOcclusion().sound(CobblemonSounds.GILDED_CHEST_SOUNDS), GildedChestBlock.Type.RED))
@@ -584,42 +587,42 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
val GIMMIGHOUL_CHEST = create("gimmighoul_chest", GildedChestBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.CHEST).setId("gimmighoul_chest").noOcclusion().sound(CobblemonSounds.GILDED_CHEST_SOUNDS), GildedChestBlock.Type.FAKE))
@JvmField
val WHITE_PLAQUE = create("white_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("white_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val WHITE_PLAQUE = create("white_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("white_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val LIGHT_GRAY_PLAQUE = create("light_gray_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("light_gray_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val LIGHT_GRAY_PLAQUE = create("light_gray_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("light_gray_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val GRAY_PLAQUE = create("gray_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("gray_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val GRAY_PLAQUE = create("gray_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("gray_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val BLACK_PLAQUE = create("black_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("black_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val BLACK_PLAQUE = create("black_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("black_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val BROWN_PLAQUE = create("brown_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("brown_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val BROWN_PLAQUE = create("brown_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("brown_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val RED_PLAQUE = create("red_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("red_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val RED_PLAQUE = create("red_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("red_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val ORANGE_PLAQUE = create("orange_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("orange_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val ORANGE_PLAQUE = create("orange_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("orange_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val YELLOW_PLAQUE = create("yellow_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("yellow_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val YELLOW_PLAQUE = create("yellow_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("yellow_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val LIME_PLAQUE = create("lime_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("lime_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val LIME_PLAQUE = create("lime_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("lime_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val GREEN_PLAQUE = create("green_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("green_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val GREEN_PLAQUE = create("green_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("green_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val CYAN_PLAQUE = create("cyan_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("cyan_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val CYAN_PLAQUE = create("cyan_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("cyan_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val LIGHT_BLUE_PLAQUE = create("light_blue_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("light_blue_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val LIGHT_BLUE_PLAQUE = create("light_blue_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("light_blue_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val BLUE_PLAQUE = create("blue_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("blue_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val BLUE_PLAQUE = create("blue_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("blue_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val PURPLE_PLAQUE = create("purple_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("purple_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val PURPLE_PLAQUE = create("purple_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("purple_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val MAGENTA_PLAQUE = create("magenta_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("magenta_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val MAGENTA_PLAQUE = create("magenta_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("magenta_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val PINK_PLAQUE = create("pink_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("pink_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
val PINK_PLAQUE = create("pink_plaque", PlaqueBlock(BlockBehaviour.Properties.of().setId("pink_plaque").sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.POPPED).strength(5.0F)))
@JvmField
val CLEANSE_TAG = create("cleanse_tag", WallAttachedStackableItemBlock(BlockBehaviour.Properties.of().setId("cleanse_tag").sound(CobblemonSounds.ITEM_BLOCK_PAPER_SMALL_SOUNDS).mapColor(MapColor.NONE).pushReaction(PushReaction.DESTROY).noOcclusion().noCollision(), WallAttachedStackableItemBlock.WallStackableItemBlockType.TAG))
val CLEANSE_TAG = create("cleanse_tag", WallAttachedStackableItemBlock(BlockBehaviour.Properties.of().setId("cleanse_tag").sound(CobblemonSounds.ITEM_BLOCK_PAPER_SMALL_SOUNDS).mapColor(MapColor.NONE).pushReaction(PushReaction.POPPED).noOcclusion().noCollision(), WallAttachedStackableItemBlock.WallStackableItemBlockType.TAG))
@JvmField
val SPELL_TAG = create("spell_tag", WallAttachedStackableItemBlock(BlockBehaviour.Properties.of().setId("spell_tag").sound(CobblemonSounds.ITEM_BLOCK_PAPER_SMALL_SOUNDS).mapColor(MapColor.NONE).pushReaction(PushReaction.DESTROY).noOcclusion().noCollision(), WallAttachedStackableItemBlock.WallStackableItemBlockType.TAG))
val SPELL_TAG = create("spell_tag", WallAttachedStackableItemBlock(BlockBehaviour.Properties.of().setId("spell_tag").sound(CobblemonSounds.ITEM_BLOCK_PAPER_SMALL_SOUNDS).mapColor(MapColor.NONE).pushReaction(PushReaction.POPPED).noOcclusion().noCollision(), WallAttachedStackableItemBlock.WallStackableItemBlockType.TAG))
@JvmField
val BLUNDER_POLICY = create("blunder_policy", WallAttachedDirectionalShapeBlock(BlockBehaviour.Properties.of().setId("blunder_policy").sound(CobblemonSounds.ITEM_BLOCK_PAPER_LARGE_SOUNDS).mapColor(MapColor.NONE).noOcclusion().noCollision(), 14, 12, 1))
@@ -693,9 +696,9 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
val LUMINOUS_MOSS = create("luminous_moss", DecorativeItemBlock(BlockBehaviour.Properties.of().setId("luminous_moss").sound(SoundType.MOSS).mapColor(MapColor.NONE).noOcclusion().lightLevel{5}, DecorativeItemBlock.DecorativeItemBlockType.CENTERED_8x))
@JvmField
val METRONOME = create("metronome", ActivatableDecorationBlock(BlockBehaviour.Properties.of().setId("metronome").sound(SoundType.METAL).mapColor(MapColor.NONE).pushReaction(PushReaction.DESTROY).noOcclusion(), ActivatableDecorationBlock.ActivatableDecorationBlockType.METRONOME))
val METRONOME = create("metronome", ActivatableDecorationBlock(BlockBehaviour.Properties.of().setId("metronome").sound(SoundType.METAL).mapColor(MapColor.NONE).pushReaction(PushReaction.POPPED).noOcclusion(), ActivatableDecorationBlock.ActivatableDecorationBlockType.METRONOME))
@JvmField
val EJECT_BUTTON = create("eject_button", EjectButtonBlock(BlockBehaviour.Properties.of().setId("eject_button").sound(SoundType.METAL).mapColor(MapColor.NONE).pushReaction(PushReaction.DESTROY).noOcclusion().strength(0.125f), 40))
val EJECT_BUTTON = create("eject_button", EjectButtonBlock(BlockBehaviour.Properties.of().setId("eject_button").sound(SoundType.METAL).mapColor(MapColor.NONE).pushReaction(PushReaction.POPPED).noOcclusion().strength(0.125f), 40))
@JvmField
val LOADED_DICE = create("loaded_dice", StackableItemBlock(BlockBehaviour.Properties.of().setId("loaded_dice").sound(CobblemonSounds.ITEM_BLOCK_DICE_SOUNDS).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.DICE))
@@ -785,19 +788,19 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
val PP_MAX = create("pp_max", StackableItemBlock(BlockBehaviour.Properties.of().setId("pp_max").sound(CobblemonSounds.ITEM_BLOCK_BOTTLE_PILLS_SOUNDS).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.VITAMIN))
@JvmField
val MONITOR = create("monitor", MonitorBlock(BlockBehaviour.Properties.of().setId("monitor").mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().strength(5.0F, 6.0F).lightLevel { if (it.getValue(MonitorBlock.SCREEN) != MonitorBlock.MonitorScreen.OFF) 13 else 0 }))
val MONITOR = create("monitor", MonitorBlock(BlockBehaviour.Properties.of().setId("monitor").mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.IMMOVEABLE).requiresCorrectToolForDrops().strength(5.0F, 6.0F).lightLevel { if (it.getValue(MonitorBlock.SCREEN) != MonitorBlock.MonitorScreen.OFF) 13 else 0 }))
@JvmField
val DAMAGED_MONITOR = create("damaged_monitor", DamagedMonitorBlock(BlockBehaviour.Properties.of().setId("damaged_monitor").mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().strength(5.0F, 6.0F).lightLevel { when (it.getValue(DamagedMonitorBlock.SCREEN)) { DamagedMonitorBlock.BrokenMonitorScreen.GLITCHING -> 10; else -> 0 } }))
val DAMAGED_MONITOR = create("damaged_monitor", DamagedMonitorBlock(BlockBehaviour.Properties.of().setId("damaged_monitor").mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.IMMOVEABLE).requiresCorrectToolForDrops().strength(5.0F, 6.0F).lightLevel { when (it.getValue(DamagedMonitorBlock.SCREEN)) { DamagedMonitorBlock.BrokenMonitorScreen.GLITCHING -> 10; else -> 0 } }))
@JvmField
val FOSSIL_ANALYZER = create("fossil_analyzer", FossilAnalyzerBlock(BlockBehaviour.Properties.of().setId("fossil_analyzer").mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().strength(5.0F, 6.0F).noOcclusion()))
val FOSSIL_ANALYZER = create("fossil_analyzer", FossilAnalyzerBlock(BlockBehaviour.Properties.of().setId("fossil_analyzer").mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.IMMOVEABLE).requiresCorrectToolForDrops().strength(5.0F, 6.0F).noOcclusion()))
@JvmField
val RESTORATION_TANK = create("restoration_tank", RestorationTankBlock(BlockBehaviour.Properties.of().setId("restoration_tank").mapColor(MapColor.METAL).sound(SoundType.GLASS).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().strength(5.0F, 6.0F).noOcclusion()))
val RESTORATION_TANK = create("restoration_tank", RestorationTankBlock(BlockBehaviour.Properties.of().setId("restoration_tank").mapColor(MapColor.METAL).sound(SoundType.GLASS).pushReaction(PushReaction.IMMOVEABLE).requiresCorrectToolForDrops().strength(5.0F, 6.0F).noOcclusion()))
@JvmField
val HEALING_MACHINE = create("healing_machine", HealingMachineBlock(BlockBehaviour.Properties.of().setId("healing_machine").mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).strength(2F).noOcclusion().lightLevel { if (it.getValue(HealingMachineBlock.CHARGE_LEVEL) >= HealingMachineBlock.MAX_CHARGE_LEVEL) 12 else 5 }))
val HEALING_MACHINE = create("healing_machine", HealingMachineBlock(BlockBehaviour.Properties.of().setId("healing_machine").mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.IMMOVEABLE).strength(2F).noOcclusion().lightLevel { if (it.getValue(HealingMachineBlock.CHARGE_LEVEL) >= HealingMachineBlock.MAX_CHARGE_LEVEL) 12 else 5 }))
@JvmField
val PC = create("pc", PCBlock(BlockBehaviour.Properties.of().setId("pc").mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).strength(2F).noOcclusion().lightLevel { if ((it.getValue(PCBlock.ON)) && (it.getValue(PCBlock.PART) == PCBlock.PCPart.TOP)) 13 else 0 }))
val PC = create("pc", PCBlock(BlockBehaviour.Properties.of().setId("pc").mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.IMMOVEABLE).strength(2F).noOcclusion().lightLevel { if ((it.getValue(PCBlock.ON)) && (it.getValue(PCBlock.PART) == PCBlock.PCPart.TOP)) 13 else 0 }))
@JvmField
val TM_MACHINE = create(
@@ -807,7 +810,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
.setId("tm_machine")
.mapColor(MapColor.COLOR_GREEN)
.sound(SoundType.METAL)
.pushReaction(PushReaction.BLOCK)
.pushReaction(PushReaction.IMMOVEABLE)
.strength(2F)
.noOcclusion()
)
@@ -821,35 +824,35 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
val DISC_SHELF = create("disc_shelf", DiscShelfBlock(BlockBehaviour.Properties.of().setId("disc_shelf").mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).sound(SoundType.METAL).strength(2.5F)))
@JvmField
val DISPLAY_CASE = create("display_case", DisplayCaseBlock(BlockBehaviour.Properties.of().setId("display_case").sound(CobblemonSounds.DISPLAY_CASE_SOUNDS).noOcclusion().pushReaction(PushReaction.BLOCK).mapColor(MapColor.STONE).strength(0.3F).requiresCorrectToolForDrops()))
val DISPLAY_CASE = create("display_case", DisplayCaseBlock(BlockBehaviour.Properties.of().setId("display_case").sound(CobblemonSounds.DISPLAY_CASE_SOUNDS).noOcclusion().pushReaction(PushReaction.IMMOVEABLE).mapColor(MapColor.STONE).strength(0.3F).requiresCorrectToolForDrops()))
// TODO after 1.7
// @JvmField
// val INCENSE_SWEET = create("incense_sweet", SweetIncenseBlock(BlockBehaviour.Properties.of().setId("incense_sweet").sound(CobblemonSounds.DISPLAY_CASE_SOUNDS).noOcclusion().pushReaction(PushReaction.BLOCK).mapColor(MapColor.STONE).strength(0.3F)))
// val INCENSE_SWEET = create("incense_sweet", SweetIncenseBlock(BlockBehaviour.Properties.of().setId("incense_sweet").sound(CobblemonSounds.DISPLAY_CASE_SOUNDS).noOcclusion().pushReaction(PushReaction.IMMOVEABLE).mapColor(MapColor.STONE).strength(0.3F)))
@JvmField
val PASTURE = create("pasture", PastureBlock(BlockBehaviour.Properties.of().setId("pasture").mapColor(MapColor.COLOR_BROWN).sound(SoundType.WOOD).strength(2F).noOcclusion().pushReaction(PushReaction.BLOCK).lightLevel { if (it.getValue(PastureBlock.ON) && (it.getValue(PastureBlock.PART) == PastureBlock.PasturePart.TOP)) 13 else 0 }))
val PASTURE = create("pasture", PastureBlock(BlockBehaviour.Properties.of().setId("pasture").mapColor(MapColor.COLOR_BROWN).sound(SoundType.WOOD).strength(2F).noOcclusion().pushReaction(PushReaction.IMMOVEABLE).lightLevel { if (it.getValue(PastureBlock.ON) && (it.getValue(PastureBlock.PART) == PastureBlock.PasturePart.TOP)) 13 else 0 }))
@JvmField
val RED_MINT = create("red_mint", MintBlock(MintType.RED, BlockBehaviour.Properties.of().setId("red_mint").mapColor(MapColor.COLOR_RED).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.DESTROY)))
val RED_MINT = create("red_mint", MintBlock(MintType.RED, BlockBehaviour.Properties.of().setId("red_mint").mapColor(MapColor.COLOR_RED).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.POPPED)))
@JvmField
val BLUE_MINT = create("blue_mint", MintBlock(MintType.BLUE, BlockBehaviour.Properties.of().setId("blue_mint").mapColor(MapColor.COLOR_BLUE).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.DESTROY)))
val BLUE_MINT = create("blue_mint", MintBlock(MintType.BLUE, BlockBehaviour.Properties.of().setId("blue_mint").mapColor(MapColor.COLOR_BLUE).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.POPPED)))
@JvmField
val CYAN_MINT = create("cyan_mint", MintBlock(MintType.CYAN, BlockBehaviour.Properties.of().setId("cyan_mint").mapColor(MapColor.COLOR_CYAN).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.DESTROY)))
val CYAN_MINT = create("cyan_mint", MintBlock(MintType.CYAN, BlockBehaviour.Properties.of().setId("cyan_mint").mapColor(MapColor.COLOR_CYAN).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.POPPED)))
@JvmField
val PINK_MINT = create("pink_mint", MintBlock(MintType.PINK, BlockBehaviour.Properties.of().setId("pink_mint").mapColor(MapColor.COLOR_PINK).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.DESTROY)))
val PINK_MINT = create("pink_mint", MintBlock(MintType.PINK, BlockBehaviour.Properties.of().setId("pink_mint").mapColor(MapColor.COLOR_PINK).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.POPPED)))
@JvmField
val GREEN_MINT = create("green_mint", MintBlock(MintType.GREEN, BlockBehaviour.Properties.of().setId("green_mint").mapColor(MapColor.COLOR_GREEN).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.DESTROY)))
val GREEN_MINT = create("green_mint", MintBlock(MintType.GREEN, BlockBehaviour.Properties.of().setId("green_mint").mapColor(MapColor.COLOR_GREEN).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.POPPED)))
@JvmField
val WHITE_MINT = create("white_mint", MintBlock(MintType.WHITE, BlockBehaviour.Properties.of().setId("white_mint").mapColor(MapColor.SNOW).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.DESTROY)))
val WHITE_MINT = create("white_mint", MintBlock(MintType.WHITE, BlockBehaviour.Properties.of().setId("white_mint").mapColor(MapColor.SNOW).noCollision().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.POPPED)))
@JvmField
val VIVICHOKE_SEEDS = this.create("vivichoke_seeds", VivichokeBlock(BlockBehaviour.Properties.of().setId("vivichoke_seeds").pushReaction(PushReaction.DESTROY).ignitedByLava().mapColor(MapColor.PLANT).noCollision().randomTicks().instabreak().sound(CobblemonSounds.VIVICHOKE_SOUNDS)))
val VIVICHOKE_SEEDS = this.create("vivichoke_seeds", VivichokeBlock(BlockBehaviour.Properties.of().setId("vivichoke_seeds").pushReaction(PushReaction.POPPED).ignitedByLava().mapColor(MapColor.PLANT).noCollision().randomTicks().instabreak().sound(CobblemonSounds.VIVICHOKE_SOUNDS)))
@JvmField
val PEP_UP_FLOWER = this.create("pep_up_flower", FlowerBlock(MobEffects.LEVITATION, 10F, BlockBehaviour.Properties.of().setId("pep_up_flower").mapColor(MapColor.PLANT).noCollision().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XZ).pushReaction(PushReaction.DESTROY)))
val PEP_UP_FLOWER = this.create("pep_up_flower", FlowerBlock(MobEffects.LEVITATION, 10F, BlockBehaviour.Properties.of().setId("pep_up_flower").mapColor(MapColor.PLANT).noCollision().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XZ).pushReaction(PushReaction.POPPED)))
@JvmField
val HEARTY_GRAINS = this.create("hearty_grains", HeartyGrainsBlock(BlockBehaviour.Properties.of().setId("hearty_grains").pushReaction(PushReaction.DESTROY).ignitedByLava().mapColor(MapColor.PLANT).noCollision().randomTicks().instabreak()))
val HEARTY_GRAINS = this.create("hearty_grains", HeartyGrainsBlock(BlockBehaviour.Properties.of().setId("hearty_grains").pushReaction(PushReaction.POPPED).ignitedByLava().mapColor(MapColor.PLANT).noCollision().randomTicks().instabreak()))
@JvmField
val GALARICA_NUT_BUSH = this.create("galarica_nut_bush", NutBushBlock(BlockBehaviour.Properties.of().setId("galarica_nut_bush").mapColor(MapColor.PLANT).randomTicks().noCollision().sound(SoundType.SWEET_BERRY_BUSH).pushReaction(PushReaction.DESTROY)))
val GALARICA_NUT_BUSH = this.create("galarica_nut_bush", NutBushBlock(BlockBehaviour.Properties.of().setId("galarica_nut_bush").mapColor(MapColor.PLANT).randomTicks().noCollision().sound(SoundType.SWEET_BERRY_BUSH).pushReaction(PushReaction.POPPED)))
@JvmField
@@ -878,15 +881,15 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
val POTTED_WHITE_MINT = this.flowerPot("potted_white_mint", WHITE_MINT_LEAF_LITTER)
@JvmField
val LOBAILA = this.create("lobaila", LobailaFlowerBlock(BlockBehaviour.Properties.of().setId("lobaila").mapColor(MapColor.PLANT).noCollision().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XZ).ignitedByLava().pushReaction(PushReaction.DESTROY)))
val LOBAILA = this.create("lobaila", LobailaFlowerBlock(BlockBehaviour.Properties.of().setId("lobaila").mapColor(MapColor.PLANT).noCollision().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XZ).ignitedByLava().pushReaction(PushReaction.POPPED)))
@JvmField
val POMOHANA = this.create("pomohana", PomohanaFlowerBlock(BlockBehaviour.Properties.of().setId("pomohana").mapColor(MapColor.PLANT).noCollision().instabreak().sound(SoundType.GRASS).ignitedByLava().pushReaction(PushReaction.DESTROY)))
val POMOHANA = this.create("pomohana", PomohanaFlowerBlock(BlockBehaviour.Properties.of().setId("pomohana").mapColor(MapColor.PLANT).noCollision().instabreak().sound(SoundType.GRASS).ignitedByLava().pushReaction(PushReaction.POPPED)))
@JvmField
val PAUVILLEA = this.create("pauvillea",PauvilleaFlowerBlock(BlockBehaviour.Properties.of().setId("pauvillea").mapColor(MapColor.PLANT).noCollision().sound(SoundType.GRASS).instabreak().ignitedByLava().pushReaction(PushReaction.DESTROY)))
val PAUVILLEA = this.create("pauvillea",PauvilleaFlowerBlock(BlockBehaviour.Properties.of().setId("pauvillea").mapColor(MapColor.PLANT).noCollision().sound(SoundType.GRASS).instabreak().ignitedByLava().pushReaction(PushReaction.POPPED)))
@JvmField
val WISTENSU = this.create("wistensu", WistensuFlowerHeadBlock(BlockBehaviour.Properties.of().setId("wistensu").mapColor(MapColor.PLANT).noCollision().sound(SoundType.GRASS).instabreak().ignitedByLava().pushReaction(PushReaction.DESTROY).lightLevel{11}))
val WISTENSU = this.create("wistensu", WistensuFlowerHeadBlock(BlockBehaviour.Properties.of().setId("wistensu").mapColor(MapColor.PLANT).noCollision().sound(SoundType.GRASS).instabreak().ignitedByLava().pushReaction(PushReaction.POPPED).lightLevel{11}))
@JvmField
val WISTENSU_VINE = this.create("wistensu_vine", WistensuFlowerVineBlock(BlockBehaviour.Properties.of().setId("wistensu_vine").mapColor(MapColor.PLANT).noCollision().sound(SoundType.GRASS).instabreak().ignitedByLava().pushReaction(PushReaction.DESTROY)))
val WISTENSU_VINE = this.create("wistensu_vine", WistensuFlowerVineBlock(BlockBehaviour.Properties.of().setId("wistensu_vine").mapColor(MapColor.PLANT).noCollision().sound(SoundType.GRASS).instabreak().ignitedByLava().pushReaction(PushReaction.POPPED)))
@JvmField
val ELECTRIC_SEED = this.terrainSeed("electric_seed", TerrainSeedBlock.TerrainSeedType.ELECTRIC)
@@ -913,7 +916,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
.sound(SoundType.GRASS)
.offsetType(OffsetType.XZ)
.ignitedByLava()
.pushReaction(PushReaction.DESTROY)
.pushReaction(PushReaction.POPPED)
.lightLevel({
if ((it.getValue(MistleafFlowerBlock.GLOWING) >= 1)) it.getValue(MistleafFlowerBlock.GLOWING) + 2 else 0
})
@@ -945,7 +948,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
private fun tumblestoneBlock(name: String, stage: Int, height: Int, xzOffset: Int, nextStage: Block?, mapColor: MapColor) : Block {
return this.create(name, TumblestoneBlock(BlockBehaviour.Properties.of().setId(name)
.mapColor(mapColor)
.pushReaction(PushReaction.DESTROY)
.pushReaction(PushReaction.POPPED)
.noOcclusion()
.strength(1.5F)
.sound(CobblemonSounds.TUMBLESTONE_SOUNDS),
@@ -1362,7 +1365,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
fun typeGemBlocks() = typeGemBlocks.toMap()
private fun typeGemCluster(name: String, gemBlock: Block, dropItemId: Identifier, mapColor: MapColor): Block {
val gemClusterBlock = this.create(name, TypeGemClusterBlock(BlockBehaviour.Properties.of().setId(name).mapColor(mapColor).strength(2.0F, 3.0F).sound(CobblemonSounds.TYPE_GEM_CLUSTER_SOUNDS).pushReaction(PushReaction.DESTROY), gemBlock, dropItemId))
val gemClusterBlock = this.create(name, TypeGemClusterBlock(BlockBehaviour.Properties.of().setId(name).mapColor(mapColor).strength(2.0F, 3.0F).sound(CobblemonSounds.TYPE_GEM_CLUSTER_SOUNDS).pushReaction(PushReaction.POPPED), gemBlock, dropItemId))
TypeGemClusterBlock.gemToClusterMap[gemBlock] = gemClusterBlock
@@ -1381,7 +1384,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
BlockBehaviour.Properties.of().setId(name)
.instabreak()
.noOcclusion()
.pushReaction(PushReaction.DESTROY)
.pushReaction(PushReaction.POPPED)
)
)
@@ -1393,7 +1396,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
.mapColor(color)
.noOcclusion()
.noCollision()
.pushReaction(PushReaction.DESTROY)
.pushReaction(PushReaction.POPPED)
)
)
@@ -1402,7 +1405,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
TerrainSeedBlock(
type,
BlockBehaviour.Properties.of().setId(name)
.pushReaction(PushReaction.DESTROY)
.pushReaction(PushReaction.POPPED)
.ignitedByLava()
.mapColor(MapColor.PLANT)
.offsetType(BlockBehaviour.OffsetType.XZ)
@@ -1422,7 +1425,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
.sound(SoundType.GRASS)
.offsetType(BlockBehaviour.OffsetType.XZ)
.ignitedByLava()
.pushReaction(PushReaction.DESTROY)
.pushReaction(PushReaction.POPPED)
.lightLevel(lightLevel)
)
)
@@ -28,6 +28,7 @@ import net.minecraft.resources.Identifier
import net.minecraft.server.level.ServerPlayer
import net.minecraft.server.packs.PackType
import net.minecraft.server.packs.resources.ResourceManager
import net.minecraft.world.item.Items
/**
* Holds all the callbacks that are loaded from the server's data packs. A callback is foldered under the event identifier,
@@ -57,8 +58,9 @@ object CobblemonCallbacks : DataRegistry {
val unsortedCallbacks = mutableMapOf<Identifier, MutableList<Pair<String, ExpressionLike>>>()
val folderBeforeNameRegex = ".*\\/([^\\/]+)\\/[^\\/]+\$".toRegex()
val predicate: Predicate<Identifier> = Predicate { path -> path.endsWith(CobblemonScripts.MOLANG_EXTENSION) }
val predicate: ResourceManager.Selector = ResourceManager.Selector { path -> path.endsWith(CobblemonScripts.MOLANG_EXTENSION) }
Items.BAMBOO_SIGN
manager.listResources("callbacks", predicate)
.plus(manager.listResources("flows", predicate)) // old name
.forEach { (identifier, resource) ->
@@ -171,14 +171,6 @@ interface CobblemonImplementation {
* @return
*/
fun server(): MinecraftServer?
/**
* Registers an item to the [ComposterBlock].
*
* @param item The [ItemLike] being registered.
* @param chance The chance % of increasing the composter level, 0 to 1 expected.
*/
fun registerCompostable(item: ItemLike, chance: Float)
}
enum class ResourcePackActivationBehaviour {
@@ -19,7 +19,6 @@ import com.cobblemon.mod.common.api.pokemon.status.Statuses
import com.cobblemon.mod.common.api.text.blue
import com.cobblemon.mod.common.api.text.gray
import com.cobblemon.mod.common.block.ApricornBlock
import com.cobblemon.mod.common.block.ApricornSaplingBlock
import com.cobblemon.mod.common.block.BerryBlock
import com.cobblemon.mod.common.block.MintBlock
import com.cobblemon.mod.common.block.MintBlock.MintType
@@ -46,6 +45,7 @@ import com.cobblemon.mod.common.pokemon.IVs
import com.cobblemon.mod.common.pokemon.Nature
import com.cobblemon.mod.common.pokemon.helditem.CobblemonHeldItemManager
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.core.Direction
import net.minecraft.core.Registry
import net.minecraft.core.component.DataComponents
import net.minecraft.core.registries.BuiltInRegistries
@@ -67,14 +67,15 @@ import net.minecraft.world.item.Item.Properties
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import net.minecraft.world.item.Rarity
import net.minecraft.world.item.SignItem
import net.minecraft.world.item.SmithingTemplateItem
import net.minecraft.world.item.StandingAndWallBlockItem
import net.minecraft.world.item.TooltipFlag
import net.minecraft.world.item.component.Consumables
import net.minecraft.world.item.component.TooltipDisplay
import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.SaplingBlock
import java.util.function.Consumer
@Suppress("unused", "SameParameterValue")
@@ -296,9 +297,9 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val APRICORN_STAIRS = blockItem("apricorn_stairs", CobblemonBlocks.APRICORN_STAIRS)
@JvmField
val APRICORN_SIGN = this.create("apricorn_sign", SignItem(CobblemonBlocks.APRICORN_SIGN, CobblemonBlocks.APRICORN_WALL_SIGN, emptyProperties("apricorn_sign").stacksTo(16)))
val APRICORN_SIGN = this.create("apricorn_sign", StandingAndWallBlockItem(CobblemonBlocks.APRICORN_SIGN, CobblemonBlocks.APRICORN_WALL_SIGN, Direction.DOWN, emptyProperties("apricorn_sign").stacksTo(16).signText()))
@JvmField
val APRICORN_HANGING_SIGN = this.create("apricorn_hanging_sign", HangingSignItem(CobblemonBlocks.APRICORN_HANGING_SIGN, CobblemonBlocks.APRICORN_WALL_HANGING_SIGN, emptyProperties("apricorn_hanging_sign").stacksTo(16)))
val APRICORN_HANGING_SIGN = this.create("apricorn_hanging_sign", HangingSignItem(CobblemonBlocks.APRICORN_HANGING_SIGN, CobblemonBlocks.APRICORN_WALL_HANGING_SIGN, emptyProperties("apricorn_hanging_sign").signText().stacksTo(16)))
@JvmField
val GILDED_CHEST = this.create("gilded_chest", BlockItem(CobblemonBlocks.GILDED_CHEST, emptyProperties("gilded_chest")))
@JvmField
@@ -353,9 +354,9 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val SACCHARINE_STAIRS = blockItem("saccharine_stairs", CobblemonBlocks.SACCHARINE_STAIRS)
@JvmField
val SACCHARINE_SIGN = this.create("saccharine_sign", SignItem( CobblemonBlocks.SACCHARINE_SIGN, CobblemonBlocks.SACCHARINE_WALL_SIGN, emptyProperties("saccharine_sign").stacksTo(16)))
val SACCHARINE_SIGN = this.create("saccharine_sign", StandingAndWallBlockItem( CobblemonBlocks.SACCHARINE_SIGN, CobblemonBlocks.SACCHARINE_WALL_SIGN, Direction.DOWN, emptyProperties("saccharine_sign").stacksTo(16).signText()))
@JvmField
val SACCHARINE_HANGING_SIGN = this.create("saccharine_hanging_sign", HangingSignItem(CobblemonBlocks.SACCHARINE_HANGING_SIGN, CobblemonBlocks.SACCHARINE_WALL_HANGING_SIGN, emptyProperties("saccharine_hanging_sign").stacksTo(16)))
val SACCHARINE_HANGING_SIGN = this.create("saccharine_hanging_sign", HangingSignItem(CobblemonBlocks.SACCHARINE_HANGING_SIGN, CobblemonBlocks.SACCHARINE_WALL_HANGING_SIGN, emptyProperties("saccharine_hanging_sign").stacksTo(16).signText()))
@JvmField
val SACCHARINE_SAPLING = compostableBlockItem("saccharine_sapling", CobblemonBlocks.SACCHARINE_SAPLING, 0.30f)
@@ -1759,8 +1760,9 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
return item
}
private fun apricornSeedItem(name: String, saplingBlock: ApricornSaplingBlock, apricornBlock: ApricornBlock): ApricornSeedItem {
private fun apricornSeedItem(name: String, saplingBlock: SaplingBlock, apricornBlock: ApricornBlock): ApricornSeedItem {
val finalName = "${name}_apricorn_seed"
Items.BIRCH_SAPLING
val item = this.create(finalName, ApricornSeedItem(saplingBlock, apricornBlock, emptyProperties(finalName).useItemDescriptionPrefix()))
compostable(item, .30f)
return item
@@ -33,7 +33,7 @@ import com.cobblemon.mod.common.util.adapters.ExpressionLikeAdapter
import com.cobblemon.mod.common.util.adapters.FloatNumberRangeAdapter
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.GsonBuilder
import net.minecraft.advancements.criterion.MinMaxBounds
import net.minecraft.advancements.predicates.MinMaxBounds
import net.minecraft.resources.Identifier
import net.minecraft.server.level.ServerPlayer
import net.minecraft.server.packs.PackType
@@ -10,7 +10,7 @@ package com.cobblemon.mod.common.advancement
import com.cobblemon.mod.common.advancement.criterion.*
import com.cobblemon.mod.common.platform.PlatformRegistry
import net.minecraft.advancements.CriterionTrigger
import net.minecraft.advancements.triggers.CriterionTrigger
import net.minecraft.core.Registry
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.core.registries.Registries
@@ -11,13 +11,14 @@ package com.cobblemon.mod.common.advancement.criterion
import com.cobblemon.mod.common.util.cobblemonResource
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.resources.Identifier
import net.minecraft.server.level.ServerPlayer
import java.util.Optional
class AspectCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val species: Identifier,
val aspects: List<String>
): SimpleCriterionCondition<MutableMap<Identifier, MutableSet<String>>>(playerCtx) {
@@ -25,7 +26,7 @@ class AspectCriterion(
companion object {
val CODEC: Codec<AspectCriterion> = RecordCodecBuilder.create { it.group(
//All three of these codecs used to use Codecs.createStrictOptionalFieldCodec, that no longer exists
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(AspectCriterion::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(AspectCriterion::playerCtx),
Identifier.CODEC.optionalFieldOf("species", cobblemonResource("pikachu")).forGetter(AspectCriterion::species),
Codec.STRING.listOf().optionalFieldOf("aspects", listOf()).forGetter(AspectCriterion::aspects)
) .apply(it, ::AspectCriterion) }
@@ -12,21 +12,22 @@ import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import java.util.Optional
open class BattleCountableContext(var battle : PokemonBattle, times : Int) : CountableContext(times)
class BattleCountableCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val battleTypes: List<String>,
count: Int
): CountableCriterion<BattleCountableContext>(playerCtx, count) {
companion object {
val CODEC: Codec<BattleCountableCriterion> = RecordCodecBuilder.create { it.group(
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(BattleCountableCriterion::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(BattleCountableCriterion::playerCtx),
Codec.STRING.listOf().optionalFieldOf("battle_types", listOf("any")).forGetter(BattleCountableCriterion::battleTypes),
Codec.INT.optionalFieldOf("count", 0).forGetter(BattleCountableCriterion::count)
).apply(it, ::BattleCountableCriterion) }
@@ -12,21 +12,21 @@ import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import java.util.Optional
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import net.minecraft.resources.Identifier
class CastPokeRodContext(val baitId: Identifier)
class CastPokeRodCriterionCondition(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val baitId: String
): SimpleCriterionCondition<CastPokeRodContext>(playerCtx) {
companion object {
val CODEC: Codec<CastPokeRodCriterionCondition> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CastPokeRodCriterionCondition::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(CastPokeRodCriterionCondition::playerCtx),
Codec.STRING.optionalFieldOf("baitId", "empty_bait").forGetter(CastPokeRodCriterionCondition::baitId)
).apply(it, { playerCtx, baitId -> CastPokeRodCriterionCondition(playerCtx, baitId.ifEmpty { "empty_bait" }) }) }
}
@@ -10,8 +10,8 @@ package com.cobblemon.mod.common.advancement.criterion
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import java.util.Optional
@@ -24,7 +24,7 @@ import java.util.Optional
open class CountablePokemonTypeContext(times: Int, var type: String/*, var species: String*/) : CountableContext(times)
class CaughtPokemonCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val type : String,
//val species: String,
count: Int
@@ -32,7 +32,7 @@ class CaughtPokemonCriterion(
companion object {
val CODEC: Codec<CaughtPokemonCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CaughtPokemonCriterion::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(CaughtPokemonCriterion::playerCtx),
Codec.STRING.optionalFieldOf("type", "any").forGetter(CaughtPokemonCriterion::type),
//Codec.STRING.optionalFieldOf("species", "any").forGetter(CaughtPokemonCriterion::species),
Codec.INT.optionalFieldOf("count", 0).forGetter(CaughtPokemonCriterion::count)
@@ -10,21 +10,21 @@ package com.cobblemon.mod.common.advancement.criterion
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import java.util.Optional
open class CountableContext(var times: Int)
open class CountableCriterion<T : CountableContext>(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val count: Int
): SimpleCriterionCondition<T>(playerCtx) {
companion object {
val CODEC: Codec<CountableCriterion<CountableContext>> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CountableCriterion<CountableContext>::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(CountableCriterion<CountableContext>::playerCtx),
Codec.INT.optionalFieldOf("count", 0).forGetter(CountableCriterion<CountableContext>::count)
).apply(it, ::CountableCriterion) }
}
@@ -11,7 +11,8 @@ package com.cobblemon.mod.common.advancement.criterion
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import net.minecraft.resources.Identifier
import java.util.Optional
@@ -19,7 +20,7 @@ import java.util.Optional
class EvolvePokemonContext(val species : Identifier, val evolution : Identifier, times: Int) : CountableContext(times)
class EvolvePokemonCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val species: String,
val evolution: String,
count: Int
@@ -27,7 +28,7 @@ class EvolvePokemonCriterion(
companion object {
val CODEC: Codec<EvolvePokemonCriterion> = RecordCodecBuilder.create { it.group(
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(EvolvePokemonCriterion::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(EvolvePokemonCriterion::playerCtx),
Codec.STRING.optionalFieldOf("species", "any").forGetter(EvolvePokemonCriterion::species),
Codec.STRING.optionalFieldOf("evolution", "any").forGetter(EvolvePokemonCriterion::evolution),
Codec.INT.optionalFieldOf("count", 0).forGetter(EvolvePokemonCriterion::count)
@@ -11,8 +11,8 @@ package com.cobblemon.mod.common.advancement.criterion
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.resources.Identifier
import net.minecraft.server.level.ServerPlayer
import java.util.Optional
@@ -20,12 +20,12 @@ import java.util.Optional
class LearnTMContext(val tm: Identifier)
class LearnTMCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val tm: String
) : SimpleCriterionCondition<LearnTMContext>(playerCtx) {
companion object {
val CODEC: Codec<LearnTMCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(LearnTMCriterion::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(LearnTMCriterion::playerCtx),
Codec.STRING.optionalFieldOf("tm", "any").forGetter(LearnTMCriterion::tm)
).apply(it, ::LearnTMCriterion) }
}
@@ -38,11 +38,11 @@ class LearnTMCriterion(
class LearnAllTMContext
class LearnAllTMCriterion(
playerCtx: Optional<ContextAwarePredicate>
playerCtx: Optional<Holder<LootItemCondition>>
) : SimpleCriterionCondition<LearnAllTMContext>(playerCtx) {
companion object {
val CODEC: Codec<LearnAllTMCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(LearnAllTMCriterion::playerCtx)
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(LearnAllTMCriterion::playerCtx)
).apply(it, ::LearnAllTMCriterion) }
}
@@ -11,22 +11,22 @@ package com.cobblemon.mod.common.advancement.criterion
import com.cobblemon.mod.common.pokemon.Pokemon
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import java.util.Optional
class LevelUpContext(val level: Int, val pokemon: Pokemon)
class LevelUpCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val level: Int,
val evolved: Boolean
): SimpleCriterionCondition<LevelUpContext>(playerCtx) {
companion object {
val CODEC: Codec<LevelUpCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(LevelUpCriterion::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(LevelUpCriterion::playerCtx),
Codec.INT.optionalFieldOf("level", 0).forGetter(LevelUpCriterion::level),
Codec.BOOL.optionalFieldOf("has_evolved", true).forGetter(LevelUpCriterion::evolved)
).apply(it, ::LevelUpCriterion) }
@@ -12,20 +12,20 @@ import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import net.minecraft.resources.Identifier
import java.util.Optional
class PartyCheckCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val party: List<Identifier>,
): SimpleCriterionCondition<PlayerPartyStore>(playerCtx) {
companion object {
val CODEC: Codec<PartyCheckCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PartyCheckCriterion::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(PartyCheckCriterion::playerCtx),
Identifier.CODEC.listOf().optionalFieldOf("party", listOf()).forGetter(PartyCheckCriterion::party)
).apply(it, ::PartyCheckCriterion) }
}
@@ -11,7 +11,8 @@ package com.cobblemon.mod.common.advancement.criterion
import com.cobblemon.mod.common.block.TumblestoneBlock
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.core.BlockPos
import net.minecraft.server.level.ServerPlayer
import java.util.*
@@ -19,12 +20,12 @@ import java.util.*
class PlantTumblestoneContext(val pos: BlockPos, val block: TumblestoneBlock)
class PlantTumblestoneCriterion(
playerCtx: Optional<ContextAwarePredicate>
playerCtx: Optional<Holder<LootItemCondition>>
): SimpleCriterionCondition<PlantTumblestoneContext>(playerCtx) {
companion object {
val CODEC: Codec<PlantTumblestoneCriterion> = RecordCodecBuilder.create { it.group(
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(PlantTumblestoneCriterion::playerCtx)
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(PlantTumblestoneCriterion::playerCtx)
).apply(it, ::PlantTumblestoneCriterion) }
}
@@ -12,7 +12,8 @@ import com.cobblemon.mod.common.block.TypeGemClusterBlock
import com.cobblemon.mod.common.block.TypeGemCoreBlock
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.core.BlockPos
import net.minecraft.server.level.ServerPlayer
import java.util.*
@@ -20,12 +21,12 @@ import java.util.*
class PlantTypeGemContext(val pos: BlockPos, val block: TypeGemClusterBlock)
class PlantTypeGemCriterion(
playerCtx: Optional<ContextAwarePredicate>
playerCtx: Optional<Holder<LootItemCondition>>
): SimpleCriterionCondition<PlantTypeGemContext>(playerCtx) {
companion object {
val CODEC: Codec<PlantTypeGemCriterion> = RecordCodecBuilder.create { it.group(
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(PlantTypeGemCriterion::playerCtx)
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(PlantTypeGemCriterion::playerCtx)
).apply(it, ::PlantTypeGemCriterion) }
}
@@ -12,20 +12,20 @@ import com.cobblemon.mod.common.api.pokemon.PokemonProperties
import com.cobblemon.mod.common.pokemon.Pokemon
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import java.util.Optional
class PokemonCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val species: String,
val properties: PokemonProperties
): SimpleCriterionCondition<Pokemon>(playerCtx) {
companion object {
val CODEC: Codec<PokemonCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PokemonCriterion::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(PokemonCriterion::playerCtx),
Codec.STRING.optionalFieldOf("species", "any").forGetter(PokemonCriterion::species),
PokemonProperties.CODEC.optionalFieldOf("properties", PokemonProperties()).forGetter(PokemonCriterion::properties)
).apply(it, ::PokemonCriterion) }
@@ -11,8 +11,8 @@ package com.cobblemon.mod.common.advancement.criterion
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import net.minecraft.resources.Identifier
import java.util.Optional
@@ -20,13 +20,13 @@ import java.util.Optional
class PokemonInteractContext(val species: Identifier, val item: Identifier)
class PokemonInteractCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val species: String,
val item: String
): SimpleCriterionCondition<PokemonInteractContext>(playerCtx) {
companion object {
val CODEC: Codec<PokemonInteractCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PokemonInteractCriterion::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(PokemonInteractCriterion::playerCtx),
Codec.STRING.optionalFieldOf("species", "any").forGetter(PokemonInteractCriterion::species),
Codec.STRING.optionalFieldOf("item", "any").forGetter(PokemonInteractCriterion::item)
).apply(it, ::PokemonInteractCriterion) }
@@ -12,22 +12,22 @@ import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import java.util.Optional
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import net.minecraft.resources.Identifier
class ReelInPokemonContext(val species : Identifier, val baitId: Identifier)
class ReelInPokemonCriterionCondition(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val species: String,
val baitId: String // also allows "cobblemon:empty_bait" to indicate that no bait is allowed for this criterion to match
) : SimpleCriterionCondition<ReelInPokemonContext>(playerCtx) {
companion object {
val CODEC: Codec<ReelInPokemonCriterionCondition> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter { it.playerCtx },
LootItemCondition.CODEC.optionalFieldOf("player").forGetter { it.playerCtx },
Codec.STRING.optionalFieldOf("species", "any").forGetter { it.species },
Codec.STRING.optionalFieldOf("baitId", "any").forGetter { it.baitId }
).apply(it, { playerCtx, pokemonId, baitId -> ReelInPokemonCriterionCondition(playerCtx, pokemonId, baitId) }) }
@@ -13,15 +13,15 @@ import com.cobblemon.mod.common.api.riding.stats.RidingStat
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import java.util.Optional
class RidingStatBoostContext(val pokemon: PokemonEntity)
class RidingStatBoostCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val requiresOwner: Boolean = true,
val rideStat: String,
val statValue : Double,
@@ -30,7 +30,7 @@ class RidingStatBoostCriterion(
companion object {
val CODEC: Codec<RidingStatBoostCriterion> by lazy {RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter { it.playerCtx },
LootItemCondition.CODEC.optionalFieldOf("player").forGetter { it.playerCtx },
Codec.BOOL.optionalFieldOf("requires_owner", true).forGetter { it.requiresOwner },
Codec.STRING.optionalFieldOf("ride_stat", "any").forGetter { it.rideStat },
Codec.DOUBLE.optionalFieldOf("stat_value", 0.0).forGetter { it.statValue },
@@ -9,9 +9,10 @@
package com.cobblemon.mod.common.advancement.criterion
import com.mojang.serialization.Codec
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.SimpleCriterionTrigger
import net.minecraft.core.Holder
import net.minecraft.advancements.triggers.SimpleCriterionTrigger
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import java.util.*
class SimpleCriterionTrigger<T, C : SimpleCriterionCondition<T>>(
@@ -27,7 +28,7 @@ class SimpleCriterionTrigger<T, C : SimpleCriterionCondition<T>>(
}
abstract class SimpleCriterionCondition<T>(
val playerCtx: Optional<ContextAwarePredicate>
val playerCtx: Optional<Holder<LootItemCondition>>
) : SimpleCriterionTrigger.SimpleInstance {
override fun player() = playerCtx
@@ -12,15 +12,15 @@ import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.ContextAwarePredicate
import net.minecraft.advancements.criterion.EntityPredicate
import net.minecraft.core.Holder
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.minecraft.server.level.ServerPlayer
import java.util.Optional
class TradePokemonContext(val traded: Pokemon, val received: Pokemon)
class TradePokemonCriterion(
playerCtx: Optional<ContextAwarePredicate>,
playerCtx: Optional<Holder<LootItemCondition>>,
val traded: String,
val received: String,
val tradedHeldItem: String,
@@ -29,7 +29,7 @@ class TradePokemonCriterion(
companion object {
val CODEC: Codec<TradePokemonCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(TradePokemonCriterion::playerCtx),
LootItemCondition.CODEC.optionalFieldOf("player").forGetter(TradePokemonCriterion::playerCtx),
Codec.STRING.optionalFieldOf("traded", "any").forGetter(TradePokemonCriterion::traded),
Codec.STRING.optionalFieldOf("received", "any").forGetter(TradePokemonCriterion::received),
Codec.STRING.optionalFieldOf("traded_held_item", "minecraft:air").forGetter(TradePokemonCriterion::tradedHeldItem),
@@ -10,7 +10,7 @@ package com.cobblemon.mod.common.advancement.predicate
import com.cobblemon.mod.common.platform.PlatformRegistry
import com.mojang.serialization.MapCodec
import net.minecraft.advancements.criterion.EntitySubPredicate
import net.minecraft.advancements.predicates.entity.EntitySubPredicate
import net.minecraft.core.Registry
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.core.registries.Registries
@@ -12,14 +12,13 @@ import com.cobblemon.mod.common.entity.fishing.PokeRodFishingBobberEntity
import com.mojang.serialization.Codec
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.criterion.EntitySubPredicate
import net.minecraft.advancements.predicates.entity.EntitySubPredicate
import net.minecraft.server.level.ServerLevel
import net.minecraft.world.entity.Entity
import net.minecraft.world.phys.Vec3
@Suppress("unused", "MemberVisibilityCanBePrivate")
class FishingBobberPredicate(val inOpenWater: Boolean) : EntitySubPredicate {
override fun codec(): MapCodec<FishingBobberPredicate> = CODEC
override fun matches(entity: Entity, serverLevel: ServerLevel, vec3: Vec3?): Boolean {
return (entity as? PokeRodFishingBobberEntity)?.inOpenWater == this.inOpenWater
}
@@ -93,13 +93,13 @@ class PlaceHoneyInSaccLeavesTaskConfig : SingleTaskConfig {
if (bl && bl3) {
// mimics the wriggling over a flower the vanilla bees do
if (hoverPos == null) {
hoverPos = leavesPos.bottomCenter.add(0.0, 0.4, 0.0)
hoverPos = Vec3.atBottomCenterOf(leavesPos).add(0.0, 0.4, 0.0)
}
if (leavesPos != null) {
hoverPos = leavesPos.bottomCenter.add(Vec3((entity.random.nextDouble() * 2.0 - 1.0) * (1.0/5.0), 0.3 + (entity.random.nextDouble() * 2.0 - 1.0) * (1.0/7.0), (entity.random.nextDouble() * 2.0 - 1.0) * (1.0/5.0)))
hoverPos = Vec3.atBottomCenterOf(leavesPos).add(Vec3((entity.random.nextDouble() * 2.0 - 1.0) * (1.0/5.0), 0.3 + (entity.random.nextDouble() * 2.0 - 1.0) * (1.0/7.0), (entity.random.nextDouble() * 2.0 - 1.0) * (1.0/5.0)))
entity.getMoveControl()
.setWantedPosition(hoverPos!!.x(), hoverPos!!.y(), hoverPos!!.z(), 0.35)
entity.lookControl.setLookAt(leavesPos.bottomCenter.add(0.0,0.5,0.0))
entity.lookControl.setLookAt(Vec3.atBottomCenterOf(leavesPos).add(0.0,0.5,0.0))
}
} else if (!bl) {
entity.getMoveControl()
@@ -91,20 +91,20 @@ class PollinateFlowerTaskConfig : SingleTaskConfig {
if (bl && bl3) {
// mimics the wriggling over a flower the vanilla bees do
if (hoverPos == null) {
hoverPos = flowerPos.bottomCenter.add(0.0, 0.4, 0.0)
hoverPos = Vec3.atBottomCenterOf(flowerPos).add(0.0, 0.4, 0.0)
}
if (flowerPos != null) {
hoverPos = flowerPos.bottomCenter.add(Vec3((entity.random.nextDouble() * 2.0 - 1.0) * (1.0/5.0), 0.3 + (entity.random.nextDouble() * 2.0 - 1.0) * (1.0/7.0), (entity.random.nextDouble() * 2.0 - 1.0) * (1.0/5.0)))
hoverPos = Vec3.atBottomCenterOf(flowerPos).add(Vec3((entity.random.nextDouble() * 2.0 - 1.0) * (1.0/5.0), 0.3 + (entity.random.nextDouble() * 2.0 - 1.0) * (1.0/7.0), (entity.random.nextDouble() * 2.0 - 1.0) * (1.0/5.0)))
entity.getMoveControl()
.setWantedPosition(hoverPos!!.x(), hoverPos!!.y(), hoverPos!!.z(), 0.35)
entity.lookControl.setLookAt(flowerPos.bottomCenter.add(0.0,0.5,0.0))
entity.lookControl.setLookAt(Vec3.atBottomCenterOf(flowerPos).add(0.0,0.5,0.0))
}
} else if (!bl) {
entity.getMoveControl()
.setWantedPosition(hoverPos!!.x(), hoverPos!!.y(), hoverPos!!.z(), 0.35)
}
entity.lookControl.setLookAt(flowerPos.bottomCenter.add(0.0,0.5,0.0))
entity.lookControl.setLookAt(Vec3.atBottomCenterOf(flowerPos).add(0.0,0.5,0.0))
}
@@ -21,6 +21,7 @@ import net.minecraft.world.entity.ai.behavior.declarative.Trigger
import net.minecraft.world.entity.ai.memory.MemoryModuleType
import net.minecraft.world.entity.ai.memory.WalkTarget
import net.minecraft.world.level.block.BedBlock
import net.minecraft.world.phys.Vec3
class SwitchToSleepOnTrainerBedTaskConfig : SingleTaskConfig {
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
@@ -59,9 +60,9 @@ class SwitchToSleepOnTrainerBedTaskConfig : SingleTaskConfig {
val blockState = entity.level().getBlockState(blockPos)
val bedPos = blockState.getOptionalValue(BedBlock.FACING).orElse(null)
?.let { direction -> blockPos.relative(direction.opposite) }
?: BlockPos(blockPos)
?: BlockPos(blockPos.x, blockPos.y, blockPos.z)
walkTarget.set(WalkTarget(bedPos.center, 0.35F, 0))
walkTarget.set(WalkTarget(Vec3.atCenterOf(bedPos), 0.35F, 0))
entity.brain.setActiveActivityIfPossible(CobblemonActivities.POKEMON_SLEEP_ON_TRAINER_BED)
return@Trigger true
}
@@ -11,14 +11,14 @@ package com.cobblemon.mod.common.api.apricorn
import com.cobblemon.mod.common.CobblemonBlocks
import com.cobblemon.mod.common.CobblemonItems
import com.cobblemon.mod.common.block.ApricornBlock
import com.cobblemon.mod.common.block.ApricornSaplingBlock
import com.cobblemon.mod.common.item.ApricornItem
import com.cobblemon.mod.common.world.feature.CobblemonConfiguredFeatures
import com.mojang.serialization.Codec
import net.minecraft.resources.ResourceKey
import net.minecraft.util.StringRepresentable
import net.minecraft.world.item.BlockItem
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature
import net.minecraft.world.level.block.SaplingBlock
import net.minecraft.world.level.levelgen.feature.Feature
import net.minecraft.world.level.material.MapColor
/**
@@ -66,7 +66,7 @@ enum class Apricorn : StringRepresentable {
YELLOW -> CobblemonBlocks.YELLOW_APRICORN
}
fun sapling(): ApricornSaplingBlock = when(this) {
fun sapling(): SaplingBlock = when(this) {
BLACK -> CobblemonBlocks.BLACK_APRICORN_SAPLING
BLUE -> CobblemonBlocks.BLUE_APRICORN_SAPLING
GREEN -> CobblemonBlocks.GREEN_APRICORN_SAPLING
@@ -86,7 +86,7 @@ enum class Apricorn : StringRepresentable {
YELLOW -> MapColor.COLOR_YELLOW
}
fun configuredFeature(): ResourceKey<ConfiguredFeature<*, *>> = when(this) {
fun feature(): ResourceKey<Feature> = when(this) {
BLACK -> CobblemonConfiguredFeatures.BLACK_APRICORN_TREE_KEY
BLUE -> CobblemonConfiguredFeatures.BLUE_APRICORN_TREE_KEY
GREEN -> CobblemonConfiguredFeatures.GREEN_APRICORN_TREE_KEY
@@ -21,7 +21,7 @@ import com.cobblemon.mod.common.util.adapters.*
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import net.minecraft.advancements.criterion.MinMaxBounds
import net.minecraft.advancements.predicates.MinMaxBounds
import net.minecraft.core.registries.Registries
import net.minecraft.resources.Identifier
import net.minecraft.server.level.ServerPlayer
@@ -22,9 +22,13 @@ import com.cobblemon.mod.common.pokemon.Nature
import com.cobblemon.mod.common.util.readBox
import com.cobblemon.mod.common.util.readEnumConstant
import com.cobblemon.mod.common.util.readIdentifier
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readMap
import com.cobblemon.mod.common.util.writeBox
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeEnumConstant
import com.cobblemon.mod.common.util.writeIdentifier
import com.cobblemon.mod.common.util.writeMap
import com.google.gson.annotations.SerializedName
import net.minecraft.core.BlockPos
import net.minecraft.network.RegistryFriendlyByteBuf
@@ -16,8 +16,8 @@ import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.LivingEntity
class CleanseAllEffect : MobEffect(MobEffectCategory.BENEFICIAL, 0xFFFFFF) {
override fun isInstantenous() = true
override fun applyInstantenousEffect(
override fun isInstantaneous() = true
override fun applyInstantaneousEffect(
serverLevel: ServerLevel,
source: Entity?,
indirect: Entity?,
@@ -16,8 +16,8 @@ import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.LivingEntity
class CleanseNegativeEffect : MobEffect(MobEffectCategory.BENEFICIAL, 0xFFFFFF) {
override fun isInstantenous() = true
override fun applyInstantenousEffect(serverLevel: ServerLevel,
override fun isInstantaneous() = true
override fun applyInstantaneousEffect(serverLevel: ServerLevel,
source: Entity?,
indirect: Entity?,
target: LivingEntity,
@@ -9,7 +9,7 @@
package com.cobblemon.mod.common.api.fossil
import com.cobblemon.mod.common.api.pokemon.PokemonProperties
import net.minecraft.advancements.criterion.ItemPredicate
import net.minecraft.advancements.predicates.ItemPredicate
import net.minecraft.network.chat.Component
import net.minecraft.network.chat.MutableComponent
import net.minecraft.resources.Identifier
@@ -21,7 +21,7 @@ import com.cobblemon.mod.common.util.adapters.pokemonPropertiesShortAdapter
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import net.minecraft.advancements.criterion.ItemPredicate
import net.minecraft.advancements.predicates.ItemPredicate
import net.minecraft.resources.Identifier
import net.minecraft.server.level.ServerPlayer
import net.minecraft.server.packs.PackType
@@ -25,9 +25,6 @@ import com.cobblemon.mod.common.util.toHex
import com.mojang.blaze3d.ProjectionType
import com.mojang.blaze3d.platform.Lighting
import com.mojang.blaze3d.systems.RenderSystem
import com.mojang.blaze3d.textures.FilterMode
import com.mojang.blaze3d.textures.GpuTexture
import com.mojang.blaze3d.textures.GpuTextureView
import com.mojang.blaze3d.vertex.PoseStack
import com.mojang.math.Axis
import net.minecraft.client.Minecraft
@@ -35,6 +32,8 @@ import net.minecraft.client.gui.GuiGraphicsExtractor
import net.minecraft.client.gui.render.TextureSetup
import com.cobblemon.mod.common.client.renderer.CachedOrthoProjectionMatrixBuffer
import com.cobblemon.mod.common.duck.GuiGraphicsExtractorDuck
import com.mojang.renderpearl.api.textures.GpuTexture
import com.mojang.renderpearl.api.textures.GpuTextureView
import net.minecraft.client.renderer.RenderPipelines
import net.minecraft.client.renderer.rendertype.RenderTypes
import net.minecraft.client.renderer.texture.OverlayTexture
@@ -540,8 +539,8 @@ private object DialogueNpcPortraitRenderer {
model.portraitTranslation.z - 4.0
)
poseStack.scale(model.portraitScale, model.portraitScale, 1F / model.portraitScale)
poseStack.mulPose(Axis.YP.rotationDegrees(if (reversed) 32F else -32F))
poseStack.mulPose(Axis.XP.rotationDegrees(5F))
poseStack.rotate(Axis.YP.rotationDegrees(if (reversed) 32F else -32F))
poseStack.rotate(Axis.XP.rotationDegrees(5F))
val minecraft = Minecraft.getInstance()
minecraft.gameRenderer.getLighting().setupFor(Lighting.Entry.ENTITY_IN_UI)
@@ -691,8 +690,8 @@ private fun drawGenericPosablePortrait(
model.portraitTranslation.z - 4.0
)
matrixStack.scale(model.portraitScale, model.portraitScale, 1F / model.portraitScale)
matrixStack.mulPose(Axis.YP.rotationDegrees(if (reversed) 32F else -32F))
matrixStack.mulPose(Axis.XP.rotationDegrees(5F))
matrixStack.rotate(Axis.YP.rotationDegrees(if (reversed) 32F else -32F))
matrixStack.rotate(Axis.XP.rotationDegrees(5F))
val minecraft = Minecraft.getInstance()
val modelViewStack = RenderSystem.getModelViewStack()
@@ -847,8 +846,8 @@ private fun drawGenericProfile(
model.profileTranslation.z - 4.0
)
matrixStack.scale(model.profileScale, model.profileScale, 1 / model.profileScale)
matrixStack.mulPose(Axis.YP.rotationDegrees(-32F))
matrixStack.mulPose(Axis.XP.rotationDegrees(5F))
matrixStack.rotate(Axis.YP.rotationDegrees(-32F))
matrixStack.rotate(Axis.XP.rotationDegrees(5F))
val minecraft = Minecraft.getInstance()
minecraft.gameRenderer.getLighting().setupFor(Lighting.Entry.ENTITY_IN_UI)
@@ -26,7 +26,7 @@ import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import net.minecraft.advancements.criterion.ItemPredicate
import net.minecraft.advancements.predicates.ItemPredicate
import net.minecraft.core.HolderLookup
import net.minecraft.resources.Identifier
import net.minecraft.server.level.ServerPlayer
@@ -54,8 +54,10 @@ import net.minecraft.resources.Identifier
import net.minecraft.server.level.ServerPlayer
import net.minecraft.sounds.SoundSource
import net.minecraft.stats.Stats
import net.minecraft.util.Prediction
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.component.SwingAnimation
import net.minecraft.world.level.GameType
import kotlin.jvm.optionals.getOrNull
@@ -140,7 +142,7 @@ object PlayerMoLangFunctions : AbstractMoLangFunctionHolder<Player>() {
if (freeSlot == -1) {
if (dropIfFull) {
player.drop(stack, false)
player.drop(stack, false, Prediction.SERVER_ONLY)
return@giveItem DoubleValue.ONE
} else {
return@giveItem DoubleValue.ZERO
@@ -158,7 +160,7 @@ object PlayerMoLangFunctions : AbstractMoLangFunctionHolder<Player>() {
),
)
}
functions["swing_hand"] = { player.swing(player.usedItemHand) }
functions["swing_hand"] = { player.swing(player.usedItemHand, SwingAnimation.DEFAULT, true) }
functions["food_level"] = { DoubleValue(player.foodData.foodLevel) }
functions["saturation_level"] = { DoubleValue(player.foodData.saturationLevel) }
functions["tell"] = { params ->
@@ -171,7 +173,7 @@ object PlayerMoLangFunctions : AbstractMoLangFunctionHolder<Player>() {
val y = params.getDouble(1)
val z = params.getDouble(2)
val playParticleOptions = params.getBooleanOrNull(3) ?: false
player.randomTeleport(x, y, z, playParticleOptions)
player.randomTeleport(x, y, z, playParticleOptions) { false }
}
functions["heal"] = { params ->
val amount = params.getDoubleOrNull(0) ?: player.maxHealth
@@ -32,6 +32,7 @@ import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer
import net.minecraft.sounds.SoundSource
import net.minecraft.world.entity.EntityType
import net.minecraft.world.entity.EntityTypes
import net.minecraft.world.entity.LightningBolt
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.item.ItemEntity
@@ -148,7 +149,7 @@ object WorldMoLangFunctions : AbstractMoLangFunctionHolder<Holder<Level>>() {
val x = params.getDouble(0)
val y = params.getDouble(1)
val z = params.getDouble(2)
val lightning = LightningBolt(EntityType.LIGHTNING_BOLT, world)
val lightning = LightningBolt(EntityTypes.LIGHTNING_BOLT, world)
lightning.setPos(x, y, z)
world.addFreshEntity(lightning)
DoubleValue.ONE
@@ -20,7 +20,7 @@ import com.cobblemon.mod.common.util.adapters.*
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import net.minecraft.advancements.criterion.MinMaxBounds
import net.minecraft.advancements.predicates.MinMaxBounds
import net.minecraft.resources.Identifier
import net.minecraft.server.level.ServerPlayer
import net.minecraft.server.packs.PackType
@@ -9,7 +9,7 @@
package com.cobblemon.mod.common.api.multiblock.condition
import com.cobblemon.mod.common.util.blockPositionsAsList
import net.minecraft.advancements.criterion.BlockPredicate
import net.minecraft.advancements.predicates.BlockPredicate
import net.minecraft.core.Direction
import net.minecraft.server.level.ServerLevel
import net.minecraft.world.phys.shapes.VoxelShape
@@ -10,7 +10,9 @@ package com.cobblemon.mod.common.api.net.serializers
import com.cobblemon.mod.common.api.riding.stats.RidingStat
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.readMap
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeMap
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.network.codec.StreamCodec
@@ -19,7 +19,9 @@ import com.cobblemon.mod.common.api.pokemon.PokemonSpecies
import com.cobblemon.mod.common.pokedex.scanner.PokedexEntityData
import com.cobblemon.mod.common.pokemon.Gender
import com.cobblemon.mod.common.util.readEnumConstant
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeEnumConstant
import com.cobblemon.mod.common.util.writeString
import com.google.common.collect.Sets
@@ -193,8 +195,8 @@ class FormDexRecord {
fun decode(buffer: RegistryFriendlyByteBuf) {
genders.clear()
seenShinyStates.clear()
genders.addAll(buffer.readCollection(Sets::newHashSetWithExpectedSize) { buffer.readEnumConstant(Gender::class.java) })
seenShinyStates.addAll(buffer.readCollection(Sets::newHashSetWithExpectedSize) { buffer.readString() })
genders.addAll(buffer.readList { buffer.readEnumConstant(Gender::class.java) })
seenShinyStates.addAll(buffer.readList { buffer.readString() })
highestLevel = buffer.readInt()
knowledge = buffer.readEnumConstant(PokedexEntryProgress::class.java)
}
@@ -13,7 +13,9 @@ import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.api.molang.MoLangFunctions.addStandardFunctions
import com.cobblemon.mod.common.pokedex.scanner.PokedexEntityData
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeString
import com.google.common.collect.Sets
import com.mojang.serialization.Codec
@@ -170,7 +172,7 @@ class SpeciesDexRecord {
fun decode(buffer: RegistryFriendlyByteBuf) {
aspects.clear()
aspects.addAll(buffer.readCollection(Sets::newHashSetWithExpectedSize) { buffer.readString() })
aspects.addAll(buffer.readList { buffer.readString() })
highestLevel = buffer.readInt()
formRecords.clear()
val numForms = buffer.readInt()
@@ -459,7 +459,7 @@ fun buildWeatherRequirement(weatherRequirement: WeatherRequirement): DexEvolutio
val tooltip: MutableComponent
if (weatherRequirement.isThundering == true) {
icon = Items.LIGHTNING_ROD
icon = Items.LIGHTNING_ROD.asList().first()
tooltip = lang("ui.pokedex.requirement.weather.tooltip.thundering")
} else {
icon = Items.WATER_BUCKET
@@ -9,7 +9,9 @@
package com.cobblemon.mod.common.api.pokedex.entry
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.Identifier
@@ -9,7 +9,9 @@
package com.cobblemon.mod.common.api.pokedex.entry
import com.cobblemon.mod.common.util.readIdentifier
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeIdentifier
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
@@ -87,8 +89,8 @@ class PokedexEntry(
form.displayForm = buffer.readString()
form.unlockForms.addAll(buffer.readList { buffer.readString() })
form
}
val variations = buffer.readList { PokedexCosmeticVariation().also { it.decode(buffer) } }
}.toMutableList()
val variations = buffer.readList { PokedexCosmeticVariation().also { it.decode(buffer) } }.toMutableList()
return PokedexEntry(id, entryId, displayAspects, conditionAspects, forms, variations)
}
}
@@ -573,9 +573,9 @@ open class PokemonProperties {
if (!pokemon.heldItem.`is`(result.item)) return@takeIf true
for (entry in result.components.entrySet()) {
val targetPropValue = pokemon.heldItem.get(entry.key)
if (targetPropValue != entry.value.get()) {
for (entry in result.components.split().added.stream().map { it.type to it.value }) {
val targetPropValue = pokemon.heldItem.get(entry.first)
if (targetPropValue != entry.second) {
return@takeIf true
}
}
@@ -60,7 +60,7 @@ import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import com.mojang.datafixers.util.Either
import net.minecraft.advancements.criterion.ItemPredicate
import net.minecraft.advancements.predicates.ItemPredicate
import net.minecraft.core.HolderLookup
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.nbt.CompoundTag
@@ -9,8 +9,10 @@
package com.cobblemon.mod.common.api.pokemon.feature
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.substitute
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
@@ -14,7 +14,9 @@ import com.cobblemon.mod.common.api.properties.CustomPokemonProperty
import com.cobblemon.mod.common.api.properties.CustomPokemonPropertyType
import com.cobblemon.mod.common.client.gui.summary.featurerenderers.SummarySpeciesFeatureRenderer
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeString
import com.google.gson.JsonObject
import net.minecraft.nbt.CompoundTag
@@ -9,8 +9,12 @@
package com.cobblemon.mod.common.api.pokemon.feature
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readMap
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.substitute
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeMap
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.world.entity.ai.behavior.ShufflingList
@@ -13,7 +13,9 @@ import com.cobblemon.mod.common.api.net.Encodable
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
@@ -41,7 +43,7 @@ data class Seat(
return Seat(
buffer.readNullable { buffer.readString() } ?: "",
buffer.readNullable { buffer.readString().asExpression() },
buffer.readNullable { buffer.readList { SeatPoseAnimations.decode(buffer) } },
buffer.readNullable { buffer.readList { SeatPoseAnimations.decode(buffer) }.toMutableList() },
buffer.readBoolean()
)
}
@@ -61,7 +63,7 @@ class SeatPoseAnimations {
fun decode(buffer: RegistryFriendlyByteBuf) : SeatPoseAnimations {
val animations = SeatPoseAnimations()
animations.poseTypes.addAll(buffer.readList { buffer.readString().let { PoseType.valueOf(it) } })
animations.animations = buffer.readList { RidingAnimation.decode(buffer) }
animations.animations = buffer.readList { RidingAnimation.decode(buffer) }.toMutableList()
return animations
}
}
@@ -171,7 +171,7 @@ class BirdBehaviour : RidingBehaviour<BirdSettings, BirdState> {
state.rideVelocity.get().z.toFloat() * -1.0f // Flip the z axis to make this left handed
)
// Unrotate preemptively as this vector gets rotatee later down the line in MC logic.
var worldVelVec = localVelVec.mul(controller.orientation).toVec3d().yRot(vehicle.yRot.toRadians())
var worldVelVec = localVelVec.mul(controller.orientation!!).toVec3d().yRot(vehicle.yRot.toRadians())
worldVelVec = worldVelVec.add(0.0, extraDownwardForce, 0.0) // Add the stamina depletion force to bring the ride down.
return worldVelVec
@@ -176,7 +176,7 @@ class JetBehaviour : RidingBehaviour<JetSettings, JetState> {
(state.rideVelocity.get().y).toFloat(),
state.rideVelocity.get().z.toFloat() * -1.0f // Flip the z axis to make this left handed? orr.. right handed? idk, flip it though
)
var worldVelVec = localVelVec.mul(controller.orientation).toVec3d().yRot(vehicle.yRot.toRadians()) // Unrotate preemptively as this vector gets rotate later down the line in MC logic.
var worldVelVec = localVelVec.mul(controller.orientation!!).toVec3d().yRot(vehicle.yRot.toRadians()) // Unrotate preemptively as this vector gets rotate later down the line in MC logic.
worldVelVec = Vec3(
worldVelVec.x,
worldVelVec.y * (1 - (state.noStamTickCnt.get() / penaltyDeccel).coerceIn(0.0f, 1.0f)), // Dampen the upwards movement depending on stamina depletion time
@@ -12,6 +12,8 @@ import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.api.net.Encodable
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.readExpression
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeExpression
import com.google.gson.annotations.SerializedName
import net.minecraft.network.RegistryFriendlyByteBuf
@@ -177,8 +177,8 @@ class BedrockParticle(
sizeY = MoLang.createParser(buffer.readString()).parseExpression()
maxAge = MoLang.createParser(buffer.readString()).parseExpression()
killExpression = MoLang.createParser(buffer.readString()).parseExpression()
updateExpressions = buffer.readList { MoLang.createParser(it.readString()).parseExpression() }
renderExpressions = buffer.readList { MoLang.createParser(it.readString()).parseExpression() }
updateExpressions = buffer.readList { MoLang.createParser(it.readString()).parseExpression() }.toMutableList()
renderExpressions = buffer.readList { MoLang.createParser(it.readString()).parseExpression() }.toMutableList()
motion = ParticleMotion.readFromBuffer(buffer)
rotation = ParticleRotation.readFromBuffer(buffer)
viewDirection = ParticleViewDirection.readFromBuffer(buffer)
@@ -186,8 +186,8 @@ class BedrockParticle(
tinting = ParticleTinting.readFromBuffer(buffer)
collision.readFromBuffer(buffer)
environmentLighting = buffer.readBoolean()
creationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }
expirationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }
creationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }.toMutableList()
expirationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }.toMutableList()
timeline.decode(buffer)
}
}
@@ -9,8 +9,12 @@
package com.cobblemon.mod.common.api.snowstorm
import com.cobblemon.mod.common.util.readIdentifier
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readMap
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeIdentifier
import com.cobblemon.mod.common.util.writeMap
import com.cobblemon.mod.common.util.writeString
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.PrimitiveCodec
@@ -70,8 +74,8 @@ class BedrockParticleOptions(
id = buffer.readIdentifier()
emitter.readFromBuffer(buffer)
particle.readFromBuffer(buffer)
curves = buffer.readList { MoLangCurve.readFromBuffer(buffer) }
curves = buffer.readList { MoLangCurve.readFromBuffer(buffer) }.toMutableList()
space.readFromBuffer(buffer)
events = buffer.readMap({ buffer.readString() }) { ParticleEvent().also { it.decode(buffer) } }
events = buffer.readMap({ buffer.readString() }) { ParticleEvent().also { it.decode(buffer) } }.toMutableMap()
}
}
@@ -13,7 +13,9 @@ import com.bedrockk.molang.MoLang
import com.bedrockk.molang.ast.NumberExpression
import com.cobblemon.mod.common.util.codec.EXPRESSION_CODEC
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeString
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
@@ -84,15 +86,15 @@ class BedrockParticleEmitter(
}
fun readFromBuffer(buffer: RegistryFriendlyByteBuf) {
startExpressions = buffer.readList { MoLang.createParser(buffer.readString()).parseExpression() }
updateExpressions = buffer.readList { MoLang.createParser(buffer.readString()).parseExpression() }
startExpressions = buffer.readList { MoLang.createParser(buffer.readString()).parseExpression() }.toMutableList()
updateExpressions = buffer.readList { MoLang.createParser(buffer.readString()).parseExpression() }.toMutableList()
rate = ParticleEmitterRate.readFromBuffer(buffer)
shape = ParticleEmitterShape.readFromBuffer(buffer)
lifetime = ParticleEmitterLifetime.readFromBuffer(buffer)
eventTimeline.decode(buffer)
creationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }
expirationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }
creationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }.toMutableList()
expirationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }.toMutableList()
travelDistanceEvents.decode(buffer)
loopingTravelDistanceEvents = buffer.readList { LoopingTravelDistanceEventTrigger(0.0, mutableListOf()).also { it.decode(buffer) } }
loopingTravelDistanceEvents = buffer.readList { LoopingTravelDistanceEventTrigger(0.0, mutableListOf()).also { it.decode(buffer) } }.toMutableList()
}
}
@@ -19,8 +19,12 @@ import com.cobblemon.mod.common.util.codec.EXPRESSION_CODEC
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.math.CatmullRomCurve
import com.cobblemon.mod.common.util.math.CubedBezierCurve
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readMap
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.resolveDouble
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeMap
import com.cobblemon.mod.common.util.writeString
import com.mojang.serialization.Codec
import com.mojang.serialization.DynamicOps
@@ -12,7 +12,11 @@ import com.cobblemon.mod.common.api.net.Decodable
import com.cobblemon.mod.common.api.net.Encodable
import com.cobblemon.mod.common.client.particle.ParticleStorm
import com.cobblemon.mod.common.client.render.SnowstormParticle
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readMap
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeMap
import com.cobblemon.mod.common.util.writeString
import com.mojang.serialization.codecs.PrimitiveCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
@@ -69,11 +73,11 @@ class EventTriggerTimeline(var map: MutableMap<Double, MutableList<String>>): En
}
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeMap(map, { pb, k -> pb.writeDouble(k) }, { pb, v -> pb.writeCollection(v) { _, s -> pb.writeString(s) } })
buffer.writeMap(map, { pb, k -> pb.writeDouble(k) }, { pb, v -> buffer.writeCollection(v) { _, s -> buffer.writeString(s) } })
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
map = buffer.readMap({ pb -> pb.readDouble() }, { pb -> pb.readList { pb.readString() }.toMutableList() }).toMutableMap()
map = buffer.readMap({ pb -> pb.readDouble() }, { pb -> buffer.readList { buffer.readString() }.toMutableList() }).toMutableMap()
}
fun check(storm: ParticleStorm, particle: SnowstormParticle?, previousTime: Double, newTime: Double) {
@@ -14,10 +14,10 @@ import net.minecraft.client.particle.ParticleRenderType
import net.minecraft.client.renderer.texture.TextureAtlas
object ParticleMaterials {
val ALPHA: ParticleRenderType = ParticleRenderType("cobblemon:alpha")
val ADD: ParticleRenderType = ParticleRenderType("cobblemon:add")
val BLEND: ParticleRenderType = ParticleRenderType("cobblemon:blend")
val OPAQUE: ParticleRenderType = ParticleRenderType("cobblemon:opaque")
val ALPHA: ParticleRenderType = ParticleRenderType("cobblemon:alpha", "cobblemon:alpha")
val ADD: ParticleRenderType = ParticleRenderType("cobblemon:add", "cobblemon:add")
val BLEND: ParticleRenderType = ParticleRenderType("cobblemon:blend", "cobblemon:blend")
val OPAQUE: ParticleRenderType = ParticleRenderType("cobblemon:opaque", "cobblemon:opaque")
private val ALPHA_LAYER = SingleQuadParticle.Layer(false, TextureAtlas.LOCATION_PARTICLES, CobblemonShaders.PARTICLE_ALPHA)
private val ADD_LAYER = SingleQuadParticle.Layer(false, TextureAtlas.LOCATION_PARTICLES, CobblemonShaders.PARTICLE_ADD)
@@ -16,8 +16,10 @@ import com.cobblemon.mod.common.api.codec.CodecMapped
import com.cobblemon.mod.common.api.data.ArbitrarilyMappedSerializableCompanion
import com.cobblemon.mod.common.util.codec.EXPRESSION_CODEC
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.resolveDouble
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeString
import com.mojang.serialization.Codec
import com.mojang.serialization.DynamicOps
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.api.spawning.spawner.Spawner
import com.cobblemon.mod.common.util.server
import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.EntityType
import net.minecraft.world.entity.EntityTypes
open class SpawnCause(
val spawner: Spawner,
@@ -25,7 +26,7 @@ open class SpawnCause(
val entity: Entity?
get() =
if (entityType == EntityType.PLAYER) {
if (entityType == EntityTypes.PLAYER) {
entityUUID?.let {
server()?.playerList?.getPlayer(it)
}
@@ -25,6 +25,7 @@ import net.minecraft.server.level.ServerLevel
import net.minecraft.sounds.SoundEvents
import net.minecraft.sounds.SoundSource
import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.PositionPath
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.HorizontalDirectionalBlock
import net.minecraft.world.level.block.RotatedPillarBlock
@@ -65,7 +66,8 @@ class SaccharineLogSlatheredInfluence(val pos: BlockPos? = null) : SpawningInflu
if (blockState.block == CobblemonBlocks.SACCHARINE_LOG_SLATHERED) {
val direction = blockState.getValue(HorizontalDirectionalBlock.FACING)
val safePos = attemptSafeMove(level, entity, logPos, direction)
if (safePos != null) entity.moveOrInterpolateTo(safePos.toVec3d())
if (safePos != null) entity.moveOrInterpolateTo(PositionPath.of(safePos.toVec3d()))
SaccharineLogBlockParticlesPacket(logPos, safePos).sendToPlayersAround(
logPos.x.toDouble(),
@@ -115,7 +115,8 @@ abstract class SpawnablePosition {
fun loadStructures(structureAccess: StructureManager, pos: BlockPos) {
val registry = structureAccess.registryAccess().lookupOrThrow(Registries.STRUCTURE)
structureAccess.startsForStructure(ChunkPos.containing(pos)) { structure ->
val chunkPos = ChunkPos.containing(pos)
structureAccess.startsForStructure(chunkPos.x, chunkPos.z) { structure ->
val entry = registry.wrapAsHolder(structure)
structures.add(entry)
foundIdentifiers.add(entry.unwrapKey().get().identifier())
@@ -15,7 +15,9 @@ import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreTypes
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.net.messages.client.SetClientPlayerDataPacket
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.cobblemon.mod.common.util.readMap
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeMap
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.Identifier
@@ -36,7 +38,7 @@ class ClientPokedexManager(
val map = buf.readMap(
{ buf.readString().asIdentifierDefaultingNamespace() },
{ SpeciesDexRecord().also { it.decode(buf) } }
)
).toMutableMap()
return SetClientPlayerDataPacket(PlayerInstancedDataStoreTypes.POKEDEX, ClientPokedexManager(map))
}
@@ -11,7 +11,9 @@ package com.cobblemon.mod.common.api.storage.player.client
import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreTypes
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.net.messages.client.SetClientPlayerDataPacket
import com.cobblemon.mod.common.util.readList
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeCollection
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.Identifier
@@ -26,10 +28,10 @@ class ClientTMMoveManager(
companion object {
fun decode(buf: RegistryFriendlyByteBuf): SetClientPlayerDataPacket {
val tms = buf.readCollection(
{ mutableSetOf<Identifier>() },
{ buf.readString().let(Identifier::tryParse) ?: Identifier.fromNamespaceAndPath("minecraft", "empty") }
)
val tms = buf.readList {
buf.readString().let(Identifier::tryParse) ?: Identifier.fromNamespaceAndPath("minecraft", "empty")
}.toMutableSet()
return SetClientPlayerDataPacket(
PlayerInstancedDataStoreTypes.TM_MOVES,
ClientTMMoveManager(tms)
@@ -43,13 +43,29 @@ class Text internal constructor() {
is ClickEvent -> style = style.withClickEvent(it)
is HoverEvent -> style = style.withHoverEvent(it)
is ChatFormatting -> {
when {
it.isColor -> style = style.withColor(it)
it == ChatFormatting.UNDERLINE || it == UNDERLINED -> style = style.withUnderlined(true)
it == ChatFormatting.BOLD || it == BOLD -> style = style.withBold(true)
it == ChatFormatting.ITALIC || it == ITALIC -> style = style.withItalic(true)
it == ChatFormatting.OBFUSCATED || it == OBFUSCATED -> style = style.withObfuscated(true)
it == ChatFormatting.RESET || it == RESET -> style = Style.EMPTY
when (it) {
ChatFormatting.BLACK,
ChatFormatting.DARK_BLUE,
ChatFormatting.DARK_GREEN,
ChatFormatting.DARK_AQUA,
ChatFormatting.DARK_RED,
ChatFormatting.DARK_PURPLE,
ChatFormatting.GOLD,
ChatFormatting.GRAY,
ChatFormatting.DARK_GRAY,
ChatFormatting.BLUE,
ChatFormatting.GREEN,
ChatFormatting.AQUA,
ChatFormatting.RED,
ChatFormatting.LIGHT_PURPLE,
ChatFormatting.YELLOW,
ChatFormatting.WHITE -> style.withColor(it)
ChatFormatting.STRIKETHROUGH -> style.withStrikethrough(true)
ChatFormatting.UNDERLINE, UNDERLINED -> style = style.withUnderlined(true)
ChatFormatting.BOLD, BOLD -> style = style.withBold(true)
ChatFormatting.ITALIC, ITALIC -> style = style.withItalic(true)
ChatFormatting.OBFUSCATED, OBFUSCATED -> style = style.withObfuscated(true)
ChatFormatting.RESET, RESET -> style = Style.EMPTY
}
}
else -> addComponent(resolveComponent(it).also { it.style = style.applyTo(it.style) })
@@ -11,7 +11,7 @@ package com.cobblemon.mod.common.berry
import com.cobblemon.mod.common.api.berry.GrowthFactor
import com.cobblemon.mod.common.mixin.accessor.BiomeAccessor
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.advancements.criterion.MinMaxBounds
import net.minecraft.advancements.predicates.MinMaxBounds
import net.minecraft.core.BlockPos
import net.minecraft.world.level.LevelReader
import net.minecraft.world.level.block.state.BlockState
@@ -10,7 +10,7 @@ package com.cobblemon.mod.common.berry
import com.cobblemon.mod.common.api.berry.GrowthFactor
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.advancements.criterion.MinMaxBounds
import net.minecraft.advancements.predicates.MinMaxBounds
import net.minecraft.core.BlockPos
import net.minecraft.world.level.LevelReader
import net.minecraft.world.level.block.state.BlockState
@@ -52,10 +52,6 @@ class ActivatableDecorationBlock(settings: Properties, val type: ActivatableDeco
}
companion object {
val CODEC: MapCodec<ActivatableDecorationBlock> = RecordCodecBuilder.mapCodec { it.group(
propertiesCodec(),
ActivatableDecorationBlockType.CODEC.fieldOf("type").forGetter(ActivatableDecorationBlock::type)
).apply(it, ::ActivatableDecorationBlock) }
val ACTIVE = BooleanProperty.create("active")
val CENTERED_8x = Shapes.box(0.25, 0.0, 0.25, 0.75, 0.5, 0.75)
@@ -77,8 +73,6 @@ class ActivatableDecorationBlock(settings: Properties, val type: ActivatableDeco
)
}
override fun codec(): MapCodec<ActivatableDecorationBlock> = CODEC
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
builder.add(HORIZONTAL_FACING, ACTIVE, WATERLOGGED)
}
@@ -37,6 +37,7 @@ import net.minecraft.world.level.LevelReader
import net.minecraft.world.level.ScheduledTickAccess
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.BonemealSource
import net.minecraft.world.level.block.BonemealableBlock
import net.minecraft.world.level.block.HorizontalDirectionalBlock
import net.minecraft.world.level.block.state.BlockState
@@ -132,11 +133,28 @@ class ApricornBlock(settings: Properties, val apricorn: Apricorn) : HorizontalDi
else super.updateShape(state, world, scheduledTickAccess, pos, direction, neighborPos, neighborState, random)
}
override fun isValidBonemealTarget(world: LevelReader, pos: BlockPos, state: BlockState) = state.getValue(AGE) < MAX_AGE
override fun isValidBonemealTarget(
world: LevelReader,
pos: BlockPos,
state: BlockState,
source: BonemealSource
): Boolean = state.getValue(AGE) < MAX_AGE
override fun isBonemealSuccess(world: Level, random: RandomSource, pos: BlockPos, state: BlockState) = true
override fun isBonemealSuccess(
world: Level,
random: RandomSource,
pos: BlockPos,
state: BlockState,
source: BonemealSource
): Boolean = true
override fun performBonemeal(world: ServerLevel, random: RandomSource, pos: BlockPos, state: BlockState) {
override fun performBonemeal(
world: ServerLevel,
random: RandomSource,
pos: BlockPos,
state: BlockState,
source: BonemealSource
) {
val curAge = state.getValue(AGE)
val newAge = curAge + 1
if (newAge > MAX_AGE) return
@@ -218,16 +236,8 @@ class ApricornBlock(settings: Properties, val apricorn: Apricorn) : HorizontalDi
return true
}
override fun codec(): MapCodec<out HorizontalDirectionalBlock> {
return CODEC
}
companion object {
val CODEC: MapCodec<ApricornBlock> = RecordCodecBuilder.mapCodec { it.group(
propertiesCodec(),
Apricorn.CODEC.fieldOf("apricorn").forGetter(ApricornBlock::apricorn)
).apply(it, ::ApricornBlock) }
val AGE = BlockStateProperties.AGE_3
const val MAX_AGE = BlockStateProperties.MAX_AGE_3
const val MIN_AGE = 0
@@ -1,30 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.block
import com.cobblemon.mod.common.api.apricorn.Apricorn
import com.cobblemon.mod.common.block.grower.ApricornTreeGrower
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.world.level.block.SaplingBlock
class ApricornSaplingBlock(properties : Properties, val apricorn: Apricorn) : SaplingBlock(ApricornTreeGrower(apricorn), properties) {
override fun codec(): MapCodec<out SaplingBlock> {
return CODEC
}
companion object {
val CODEC: MapCodec<ApricornSaplingBlock> = RecordCodecBuilder.mapCodec { it.group(
propertiesCodec(),
Apricorn.CODEC.fieldOf("apricorn").forGetter(ApricornSaplingBlock::apricorn)
).apply(it, ::ApricornSaplingBlock) }
}
}
@@ -24,6 +24,8 @@ import com.mojang.serialization.codecs.RecordCodecBuilder
import com.cobblemon.mod.common.util.sidedSuccess
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.core.component.DataComponentType
import net.minecraft.core.component.DataComponents
import net.minecraft.resources.Identifier
import net.minecraft.server.level.ServerLevel
import net.minecraft.sounds.SoundEvents
@@ -35,7 +37,7 @@ import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import net.minecraft.world.item.ShovelItem
import net.minecraft.world.item.context.UseOnContext
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.Level
import net.minecraft.world.level.LevelAccessor
@@ -78,9 +80,20 @@ class BerryBlock(private val berryIdentifier: Identifier, settings: Properties)
override fun newBlockEntity(pos: BlockPos, state: BlockState) = BerryBlockEntity(pos, state, berryIdentifier)
override fun isValidBonemealTarget(world: LevelReader, pos: BlockPos, state: BlockState) = !this.isMaxAge(state)
override fun isValidBonemealTarget(
world: LevelReader,
pos: BlockPos,
state: BlockState,
source: BonemealSource
): Boolean = !this.isMaxAge(state)
override fun isBonemealSuccess(world: Level, random: RandomSource, pos: BlockPos, state: BlockState) = !this.isMaxAge(state)
override fun isBonemealSuccess(
world: Level,
random: RandomSource,
pos: BlockPos,
state: BlockState,
source: BonemealSource
): Boolean = !this.isMaxAge(state)
// Use Random Tick instead of BlockEntityTicker for performance optimization
override fun <T : BlockEntity> getTicker(world: Level, blockState: BlockState, blockWithEntityType: BlockEntityType<T>): BlockEntityTicker<T>? = null
@@ -117,7 +130,13 @@ class BerryBlock(private val berryIdentifier: Identifier, settings: Properties)
.setValue(IS_ROOTED, false))
}
override fun performBonemeal(world: ServerLevel, random: RandomSource, pos: BlockPos, state: BlockState) {
override fun performBonemeal(
world: ServerLevel,
random: RandomSource,
pos: BlockPos,
state: BlockState,
source: BonemealSource
) {
growHelper(world, random, pos, state, true)
}
@@ -206,11 +225,18 @@ class BerryBlock(private val berryIdentifier: Identifier, settings: Properties)
blockHitResult: BlockHitResult
): InteractionResult {
val treeEntity = world.getBlockEntity(pos) as BerryBlockEntity
if (player.getItemInHand(InteractionHand.MAIN_HAND).item is ShovelItem && getMulch(treeEntity) != MulchVariant.NONE) {
val itemInHand = player.getItemInHand(InteractionHand.MAIN_HAND)
if (itemInHand.get(DataComponents.BLOCK_TRANSFORMER)?.value()?.transformBlock(
UseOnContext(
player,
InteractionHand.MAIN_HAND,
blockHitResult
)
) == InteractionResult.SUCCESS && getMulch(treeEntity) != MulchVariant.NONE) {
treeEntity.setMulch(MulchVariant.NONE, world, state, pos)
treeEntity.setChanged()
world.playSound(null, pos, CobblemonSounds.MULCH_REMOVE, SoundSource.BLOCKS, 0.6F, 1F)
this.spawnDestroyParticles(world, player, pos, state.setValue(AGE, 0))
this.spawnDestroyParticles(world, pos, state.setValue(AGE, 0))
return InteractionResult.SUCCESS
}
@@ -234,10 +260,6 @@ class BerryBlock(private val berryIdentifier: Identifier, settings: Properties)
|| state.getValue(IS_ROOTED)
}
override fun codec(): MapCodec<out BaseEntityBlock> {
return CODEC
}
@Deprecated("Deprecated in Java")
override fun updateShape(
state: BlockState,
@@ -288,11 +310,6 @@ class BerryBlock(private val berryIdentifier: Identifier, settings: Properties)
override fun getRenderShape(blockState: BlockState) = RenderShape.MODEL
companion object {
val CODEC: MapCodec<BerryBlock> = RecordCodecBuilder.mapCodec { it.group(
Identifier.CODEC.fieldOf("berry").forGetter(BerryBlock::berryIdentifier),
propertiesCodec()
).apply(it, ::BerryBlock) }
const val MATURE_AGE = 3
const val FLOWER_AGE = 4
const val FRUIT_AGE = 5
@@ -28,13 +28,7 @@ class BigRootBlock(settings: Properties) : RootBlock(settings) {
override fun shearedDrop(): ItemStack = Items.STRING.defaultInstance
override fun codec(): MapCodec<out Block> {
return CODEC
}
companion object {
val CODEC = simpleCodec(::BigRootBlock)
private val AABB = Shapes.box(0.2, 0.3, 0.2, 0.8, 1.0, 0.8)
}
@@ -18,6 +18,7 @@ import net.minecraft.world.level.Level
import net.minecraft.world.level.LevelReader
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.BonemealSource
import net.minecraft.world.level.block.BonemealableBlock
import net.minecraft.world.level.block.CropBlock
import net.minecraft.world.level.block.state.BlockState
@@ -59,11 +60,28 @@ class BugwortBlock(settings: Properties) : CropBlock(settings), BonemealableBloc
// These 3 are still around for the sake of compatibility, vanilla won't trigger it but some mods might
// We implement applyGrowth & getGrowthAmount for them
override fun isValidBonemealTarget(world: LevelReader, pos: BlockPos, state: BlockState) = state.getValue(BugwortBlock.AGE) < BugwortBlock.MATURE_AGE
override fun isValidBonemealTarget(
world: LevelReader,
pos: BlockPos,
state: BlockState,
source: BonemealSource
): Boolean = state.getValue(BugwortBlock.AGE) < BugwortBlock.MATURE_AGE
override fun isBonemealSuccess(world: Level, random: RandomSource, pos: BlockPos, state: BlockState) = true
override fun isBonemealSuccess(
world: Level,
random: RandomSource,
pos: BlockPos,
state: BlockState,
source: BonemealSource
): Boolean = true
override fun performBonemeal(world: ServerLevel, random: RandomSource, pos: BlockPos, state: BlockState) {
override fun performBonemeal(
world: ServerLevel,
random: RandomSource,
pos: BlockPos,
state: BlockState,
source: BonemealSource
) {
world.setBlock(pos, state.setValue(AGE, state.getValue(AGE) + 1), 2)
}
@@ -65,10 +65,6 @@ class CoinPouchBlock(settings: Properties, val small: Boolean) : HorizontalDirec
return null
}
override fun codec(): MapCodec<out HorizontalDirectionalBlock> {
return CODEC
}
@Deprecated("Deprecated in Java")
override fun updateShape(
state: BlockState,
@@ -106,11 +102,6 @@ class CoinPouchBlock(settings: Properties, val small: Boolean) : HorizontalDirec
companion object {
val NATURAL: BooleanProperty = BooleanProperty.create("natural")
val CODEC: MapCodec<CoinPouchBlock> = RecordCodecBuilder.mapCodec { it.group(
propertiesCodec(),
PrimitiveCodec.BOOL.fieldOf("small").forGetter(CoinPouchBlock::small)
).apply(it, ::CoinPouchBlock) }
private val SMALL_SHAPE = Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.3125, 0.6875)
}
}
@@ -62,11 +62,6 @@ class DecorativeItemBlock(settings: Properties, val type: DecorativeItemBlockTyp
}
companion object {
val CODEC: MapCodec<DecorativeItemBlock> = RecordCodecBuilder.mapCodec { it.group(
propertiesCodec(),
DecorativeItemBlockType.CODEC.fieldOf("type").forGetter(DecorativeItemBlock::type)
).apply(it, ::DecorativeItemBlock) }
val CENTERED_8x = Shapes.box(0.25, 0.0, 0.25, 0.75, 0.5, 0.75)
val CENTERED_6x = Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.375, 0.6875)
val FLAT6_HITBOX = Shapes.box(0.25, 0.0, 0.25, 0.75, 0.375, 0.75)
@@ -108,8 +103,6 @@ class DecorativeItemBlock(settings: Properties, val type: DecorativeItemBlockTyp
.setValue(WATERLOGGED, false))
}
override fun codec(): MapCodec<DecorativeItemBlock> = CODEC
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
builder.add(HORIZONTAL_FACING, WATERLOGGED)
}
@@ -31,7 +31,6 @@ import net.minecraft.world.phys.shapes.VoxelShape
class DiscShelfBlock(properties: Properties) : BaseEntityBlock(properties) {
companion object {
val CODEC: MapCodec<DiscShelfBlock> = simpleCodec(::DiscShelfBlock)
val FACING: EnumProperty<Direction> = HorizontalDirectionalBlock.FACING
}
@@ -39,8 +38,6 @@ class DiscShelfBlock(properties: Properties) : BaseEntityBlock(properties) {
registerDefaultState(stateDefinition.any().setValue(FACING, Direction.NORTH))
}
override fun codec() = CODEC
override fun newBlockEntity(pos: BlockPos, state: BlockState): BlockEntity {
return DiscShelfBlockEntity(pos, state)
}
@@ -120,14 +120,9 @@ class DisplayCaseBlock(settings: Properties) : BaseEntityBlock(settings) {
override fun hasAnalogOutputSignal(state: BlockState): Boolean = true
override fun codec(): MapCodec<out BaseEntityBlock> {
return CODEC
}
override fun isPathfindable(state: BlockState, type: PathComputationType): Boolean = false
companion object {
val CODEC = simpleCodec(::DisplayCaseBlock)
val ITEM_DIRECTION: EnumProperty<Direction> = EnumProperty.create("item_facing", Direction::class.java)
}
@@ -29,13 +29,7 @@ class EnergyRootBlock(settings: Properties) : RootBlock(settings) {
override fun shearedDrop(): ItemStack = CobblemonItems.ENERGY_ROOT.defaultInstance
override fun codec(): MapCodec<out Block> {
return CODEC
}
companion object {
private val CODEC = simpleCodec(::EnergyRootBlock)
private val AABB = Shapes.box(0.2, 0.1, 0.2, 0.8, 1.0, 0.8)
}
@@ -43,10 +43,6 @@ class FossilAnalyzerBlock(settings: Properties) : MultiblockBlock(settings), Wor
return FossilAnalyzerBlockEntity(pos, state, FossilMultiblockBuilder(pos))
}
override fun codec(): MapCodec<out BaseEntityBlock> {
return CODEC
}
override fun <T : BlockEntity> getTicker(
world: Level,
state: BlockState,
@@ -74,7 +70,5 @@ class FossilAnalyzerBlock(settings: Properties) : MultiblockBlock(settings), Wor
companion object {
val ON = BooleanProperty.create("on")
val CODEC = simpleCodec(::FossilAnalyzerBlock)
}
}
@@ -23,10 +23,6 @@ import net.minecraft.world.phys.shapes.VoxelShape
class GalaricaWreathBlock(properties: Properties) : SixFaceRotationalBlock(properties) {
companion object {
val CODEC: MapCodec<GalaricaWreathBlock> = RecordCodecBuilder.mapCodec {
it.group(propertiesCodec()).apply(it, ::GalaricaWreathBlock)
}
val FLOOR_NORTH = Shapes.box(0.125, 0.0, 0.125, 0.875, 0.25, 0.875)
val WALL_NORTH = Shapes.box(0.125, 0.125, 0.75, 0.875, 0.875, 1.0)
val CEILING_NORTH = Shapes.box(0.125, 0.125, 0.375, 0.875, 0.625, 0.5625)
@@ -40,8 +36,6 @@ class GalaricaWreathBlock(properties: Properties) : SixFaceRotationalBlock(prope
)
}
override fun codec(): MapCodec<GalaricaWreathBlock> = CODEC
override fun getShape(state: BlockState, blockGetter: BlockGetter, pos: BlockPos, collisionContext: CollisionContext): VoxelShape {
val direction = state.getValue(FACING)
return when (state.getValue(FACE)) {
@@ -54,8 +54,6 @@ import net.minecraft.world.phys.shapes.VoxelShape
@Suppress("DEPRECATED", "OVERRIDE_DEPRECATION")
class HealingMachineBlock(settings: Properties) : BaseEntityBlock(settings) {
companion object {
val CODEC: MapCodec<HealingMachineBlock> = simpleCodec(::HealingMachineBlock)
private val NORTH_SOUTH_AABB = Shapes.or(
Shapes.box(0.0, 0.0, 0.0, 1.0, 0.625, 1.0),
Shapes.box(0.0625, 0.625, 0.0, 0.9375, 0.875, 0.125),
@@ -104,10 +102,6 @@ class HealingMachineBlock(settings: Properties) : BaseEntityBlock(settings) {
return this.defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, blockPlaceContext.horizontalDirection)
}
override fun codec(): MapCodec<out BaseEntityBlock> {
return CODEC
}
override fun isPathfindable(
blockState: BlockState,
pathComputationType: PathComputationType

Some files were not shown because too many files have changed in this diff Show More