diff --git a/src/main/java/cf/witcheskitchen/api/WKApi.java b/src/main/java/cf/witcheskitchen/api/WKApi.java index 90b18f87..cd07bd66 100644 --- a/src/main/java/cf/witcheskitchen/api/WKApi.java +++ b/src/main/java/cf/witcheskitchen/api/WKApi.java @@ -1,6 +1,5 @@ package cf.witcheskitchen.api; -import cf.witcheskitchen.api.entity.WKCreatureTypeEnum; import cf.witcheskitchen.common.item.TaglockItem; import cf.witcheskitchen.common.registry.WKTags; import net.minecraft.entity.EntityGroup; diff --git a/src/main/java/cf/witcheskitchen/api/block/crop/WKCropBlock.java b/src/main/java/cf/witcheskitchen/api/block/crop/WKCropBlock.java index b82a71a9..6a028e18 100644 --- a/src/main/java/cf/witcheskitchen/api/block/crop/WKCropBlock.java +++ b/src/main/java/cf/witcheskitchen/api/block/crop/WKCropBlock.java @@ -1,5 +1,7 @@ package cf.witcheskitchen.api.block.crop; +import cf.witcheskitchen.common.component.WKComponents; +import cf.witcheskitchen.common.component.item.SeedTypeData; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.CropBlock; @@ -9,14 +11,13 @@ import net.minecraft.entity.passive.BeeEntity; import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; import net.minecraft.server.world.ServerWorld; import net.minecraft.state.StateManager; import net.minecraft.state.property.IntProperty; import net.minecraft.util.ItemScatterer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.random.RandomGenerator; +import net.minecraft.util.math.random.Random; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; import net.minecraft.world.World; @@ -129,7 +130,7 @@ protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) * @return The current age at the given crop BlockState */ @Override - protected int getAge(BlockState state) { + public int getAge(BlockState state) { return super.getAge(state); } @@ -169,7 +170,7 @@ public boolean isMature(BlockState state) { *

*

* This is triggered in {@link ServerWorld#tickChunk(WorldChunk, int)} and - * if this returns false, {@link WKCropBlock#randomTick(BlockState, ServerWorld, BlockPos, RandomGenerator)} + * if this returns false, {@link WKCropBlock#randomTick(BlockState, ServerWorld, BlockPos, Random)} * will never get executed. *

*/ @@ -194,13 +195,13 @@ public boolean hasRandomTicks(BlockState state) { *

*/ @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, RandomGenerator random) { + public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { super.randomTick(state, world, pos, random); } /** * Updates the crop {@link BlockState}, by checking {@link CropBlock#getAge(BlockState)} is < {@link CropBlock#getMaxAge()}. - * NOTE: THIS METHOD IS ONLY TRIGGERED BY {@link WKCropBlock#grow(ServerWorld, RandomGenerator, BlockPos, BlockState)} + * NOTE: THIS METHOD IS ONLY TRIGGERED BY {@link WKCropBlock#grow(ServerWorld, Random, BlockPos, BlockState)} */ @Override public void applyGrowth(World world, BlockPos pos, BlockState state) { @@ -210,14 +211,14 @@ public void applyGrowth(World world, BlockPos pos, BlockState state) { /** *

- * This method is a filter for {@link #grow(ServerWorld, RandomGenerator, BlockPos, BlockState)} and the BoneMeal grow method. + * This method is a filter for {@link #grow(ServerWorld, Random, BlockPos, BlockState)} and the BoneMeal grow method. * It is only used by {@link net.minecraft.item.BoneMealItem#useOnFertilizable(ItemStack, World, BlockPos)}, - * although when extending this class it will also be triggered by {@link #grow(ServerWorld, RandomGenerator, BlockPos, BlockState)}. + * although when extending this class it will also be triggered by {@link #grow(ServerWorld, Random, BlockPos, BlockState)}. *

* It is always returning true by the parent class unless overridden. */ @Override - public boolean canGrow(World world, RandomGenerator random, BlockPos pos, BlockState state) { + public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { return super.canGrow(world, random, pos, state); } @@ -233,7 +234,7 @@ public boolean canGrow(World world, RandomGenerator random, BlockPos pos, BlockS * {@link BeeEntity.GrowCropsGoal#tick()} */ @Override - public void grow(ServerWorld world, RandomGenerator random, BlockPos pos, BlockState state) { + public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { if (canGrow(world, random, pos, state)) { super.grow(world, random, pos, state); } @@ -269,15 +270,15 @@ protected ItemConvertible getSeedsItem() { } @Override - public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) { + public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state) { return getSeedsItemStack(); } protected abstract ItemStack getSeedsItemStack(); - public void getNextSeed(World world, BlockPos pos, NbtCompound nbtCompound) { + public void getNextSeed(World world, BlockPos pos, SeedTypeData data) { ItemStack itemStack2 = getSeedsItemStack(); - itemStack2.getOrCreateNbt().copyFrom(nbtCompound); + itemStack2.set(WKComponents.SEED_TYPE, data); ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), itemStack2); } } \ No newline at end of file diff --git a/src/main/java/cf/witcheskitchen/api/entity/WKCreatureTypeEnum.java b/src/main/java/cf/witcheskitchen/api/entity/WKCreatureTypeEnum.java deleted file mode 100644 index e0c8b0a2..00000000 --- a/src/main/java/cf/witcheskitchen/api/entity/WKCreatureTypeEnum.java +++ /dev/null @@ -1,19 +0,0 @@ -package cf.witcheskitchen.api.entity; - -import net.minecraft.entity.EntityGroup; - -//To be used by the main mod addons and eventual mobs -public class WKCreatureTypeEnum { - - /** - * Demons - */ - @SuppressWarnings("InstantiationOfUtilityClass") - public static final EntityGroup DEMONIC = new EntityGroup(); - - /** - * Golems and tulpas - */ - @SuppressWarnings("InstantiationOfUtilityClass") - public static final EntityGroup CONSTRUCT = new EntityGroup(); -} diff --git a/src/main/java/cf/witcheskitchen/api/fluid/FluidTank.java b/src/main/java/cf/witcheskitchen/api/fluid/FluidTank.java index cbf08fb9..6775e003 100644 --- a/src/main/java/cf/witcheskitchen/api/fluid/FluidTank.java +++ b/src/main/java/cf/witcheskitchen/api/fluid/FluidTank.java @@ -251,7 +251,7 @@ public boolean isEmpty() { /** * @return Current {@link FluidStack} in the tank */ - @Nonnull + @NotNull public FluidStack getStack() { return stack; } diff --git a/src/main/java/cf/witcheskitchen/api/util/SeedTypeHelper.java b/src/main/java/cf/witcheskitchen/api/util/SeedTypeHelper.java index be9ecea3..1d6951b4 100644 --- a/src/main/java/cf/witcheskitchen/api/util/SeedTypeHelper.java +++ b/src/main/java/cf/witcheskitchen/api/util/SeedTypeHelper.java @@ -1,11 +1,10 @@ package cf.witcheskitchen.api.util; +import cf.witcheskitchen.common.component.WKComponents; +import cf.witcheskitchen.common.component.item.SeedTypeData; import cf.witcheskitchen.common.registry.WKBlocks; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; -import net.minecraft.nbt.NbtList; import net.minecraft.text.MutableText; import net.minecraft.text.Style; import net.minecraft.text.Text; @@ -16,17 +15,14 @@ public class SeedTypeHelper { /** - * Gets the block corresponding to the present nbt + * Gets the block corresponding to the present data * - * @param nbt the nbt to test for a block + * @param data the data to test for a block * @return optional block depending on if the nbt was valid for a block to be returned */ - public static Optional getBlockFromNbt(NbtCompound nbt) { - NbtList nbtList = nbt.getList("Variant", NbtElement.COMPOUND_TYPE); - if (!nbtList.isEmpty()) { - NbtCompound nameNbt = nbtList.getCompound(0); - NbtCompound typeNbt = nbtList.getCompound(1); - String fullName = nameNbt.getString("Name") + "_" + typeNbt.getString("Type"); + public static Optional getBlockFromComponent(SeedTypeData data) { + if (data != null) { + String fullName = data.getBlockId(); for (Map.Entry entry : WKBlocks.getTypeBlocks().entrySet()) { String nameMap = entry.getKey(); Block blockMap = entry.getValue(); @@ -38,33 +34,14 @@ public static Optional getBlockFromNbt(NbtCompound nbt) { return Optional.empty(); } - public static NbtCompound toNbt(NbtCompound nbt, String plantName, String typeName, int variantColor) { - NbtList list = new NbtList(); - - NbtCompound name = new NbtCompound(); - name.putString("Name", plantName); - NbtCompound type = new NbtCompound(); - type.putString("Type", typeName); - NbtCompound color = new NbtCompound(); - color.putInt("Color", variantColor); - - list.add(name); - list.add(type); - list.add(color); - - nbt.put("Variant", list); - return nbt; + public static SeedTypeData toComponent(String plantName, String typeName, int variantColor) { + return new SeedTypeData(plantName, typeName, variantColor); } public static MutableText getSeedTypeText(ItemStack stack) { - - NbtList nbtList = stack.getOrCreateNbt().getList("Variant", NbtElement.COMPOUND_TYPE); - if (!nbtList.isEmpty() && !nbtList.getCompound(1).isEmpty() && !nbtList.getCompound(2).isEmpty()) { - String name = nbtList.getCompound(1).getString("Type"); - String formatName = TextUtils.capitalizeString(name); - NbtCompound colorNbt = nbtList.getCompound(2); - int color = colorNbt.getInt("Color"); - return Text.translatable(formatName).setStyle(Style.EMPTY.withColor(color)); + if (stack.contains(WKComponents.SEED_TYPE)) { + var seedType = stack.get(WKComponents.SEED_TYPE); + return Text.translatable(TextUtils.capitalizeString(seedType.type())).setStyle(Style.EMPTY.withColor(seedType.color())); } return null; } diff --git a/src/main/java/cf/witcheskitchen/common/block/BrewingBarrelBlock.java b/src/main/java/cf/witcheskitchen/common/block/BrewingBarrelBlock.java index a91440a2..2866e2f8 100644 --- a/src/main/java/cf/witcheskitchen/common/block/BrewingBarrelBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/BrewingBarrelBlock.java @@ -83,7 +83,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt @Override public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(FACING, ctx.getPlayerFacing().getOpposite()).with(Properties.WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + return this.getDefaultState().with(FACING, ctx.getPlayerLookDirection().getOpposite()).with(Properties.WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); } @Override diff --git a/src/main/java/cf/witcheskitchen/common/block/CopperTeapotBlock.java b/src/main/java/cf/witcheskitchen/common/block/CopperTeapotBlock.java index 5f6bab4d..9933302e 100644 --- a/src/main/java/cf/witcheskitchen/common/block/CopperTeapotBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/CopperTeapotBlock.java @@ -11,19 +11,19 @@ import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.random.RandomGenerator; +import net.minecraft.util.math.random.Random; import net.minecraft.world.World; public class CopperTeapotBlock extends TeapotBlock implements Oxidizable { - private final Oxidizable.OxidizationLevel oxidizationLevel; + private final Oxidizable.OxidationLevel oxidizationLevel; - public CopperTeapotBlock(Settings settings, Oxidizable.OxidizationLevel oxidizationLevel) { + public CopperTeapotBlock(Settings settings, Oxidizable.OxidationLevel oxidizationLevel) { super(settings); this.oxidizationLevel = oxidizationLevel; } @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, RandomGenerator random) { + public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { this.tickDegradation(state, world, pos, random); } @@ -43,7 +43,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt } @Override - public OxidizationLevel getDegradationLevel() { + public OxidationLevel getDegradationLevel() { return this.oxidizationLevel; } } diff --git a/src/main/java/cf/witcheskitchen/common/block/CopperWitchesOvenBlock.java b/src/main/java/cf/witcheskitchen/common/block/CopperWitchesOvenBlock.java index d77cbe70..e6347ab8 100644 --- a/src/main/java/cf/witcheskitchen/common/block/CopperWitchesOvenBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/CopperWitchesOvenBlock.java @@ -11,19 +11,19 @@ import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.random.RandomGenerator; +import net.minecraft.util.math.random.Random; import net.minecraft.world.World; public class CopperWitchesOvenBlock extends WitchesOvenBlock implements Oxidizable { - private final Oxidizable.OxidizationLevel oxidizationLevel; + private final Oxidizable.OxidationLevel oxidizationLevel; - public CopperWitchesOvenBlock(Settings settings, Oxidizable.OxidizationLevel oxidizationLevel) { + public CopperWitchesOvenBlock(Settings settings, Oxidizable.OxidationLevel oxidizationLevel) { super(settings); this.oxidizationLevel = oxidizationLevel; } @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, RandomGenerator random) { + public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { this.tickDegradation(state, world, pos, random); } @@ -43,7 +43,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt } @Override - public OxidizationLevel getDegradationLevel() { + public OxidationLevel getDegradationLevel() { return this.oxidizationLevel; } } diff --git a/src/main/java/cf/witcheskitchen/common/block/GlyphBlock.java b/src/main/java/cf/witcheskitchen/common/block/GlyphBlock.java index f92257ac..24639b7c 100644 --- a/src/main/java/cf/witcheskitchen/common/block/GlyphBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/GlyphBlock.java @@ -15,7 +15,6 @@ import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.IntProperty; import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -38,11 +37,11 @@ public GlyphBlock(Settings settings) { } @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { if (world.getBlockEntity(pos) instanceof GlyphBlockEntity be) { be.onUse(world, state, pos, player, hit); } - return super.onUse(state, world, pos, player, hand, hit); + return super.onUse(state, world, pos, player, hit); } @Nullable diff --git a/src/main/java/cf/witcheskitchen/common/block/SaltBlock.java b/src/main/java/cf/witcheskitchen/common/block/SaltBlock.java index a4ca4532..a1721d79 100644 --- a/src/main/java/cf/witcheskitchen/common/block/SaltBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/SaltBlock.java @@ -17,7 +17,6 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.BlockMirror; import net.minecraft.util.BlockRotation; -import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -28,7 +27,6 @@ import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; import org.jetbrains.annotations.Nullable; -import org.quiltmc.qsl.block.extensions.api.QuiltBlockSettings; import java.util.Iterator; import java.util.Map; @@ -48,7 +46,7 @@ public class SaltBlock extends Block { private final BlockState dotState; - public SaltBlock(QuiltBlockSettings settings) { + public SaltBlock(AbstractBlock.Settings settings) { super(settings); this.setDefaultState(this.stateManager.getDefaultState().with(WIRE_CONNECTION_NORTH, WireConnection.NONE).with(WIRE_CONNECTION_EAST, WireConnection.NONE).with(WIRE_CONNECTION_SOUTH, WireConnection.NONE).with(WIRE_CONNECTION_WEST, WireConnection.NONE)); this.dotState = this.getDefaultState().with(WIRE_CONNECTION_NORTH, WireConnection.SIDE).with(WIRE_CONNECTION_EAST, WireConnection.SIDE).with(WIRE_CONNECTION_SOUTH, WireConnection.SIDE).with(WIRE_CONNECTION_WEST, WireConnection.SIDE); @@ -154,7 +152,7 @@ public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos if (spiritual && !WKApi.isGreaterDemon(livingEntity)) { boolean onSalt = world.getBlockState(livingEntity.getBlockPos().add(0, 0, 0)).getBlock() instanceof SaltBlock; if (!onSalt) { - return getSaltShape(livingEntity.stepHeight); + return getSaltShape(livingEntity.getStepHeight()); } else { livingEntity.setOnFireFor(1); } @@ -343,7 +341,7 @@ protected void appendProperties(StateManager.Builder builder) } @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { if (player.getAbilities().allowModifyWorld) { if (isFullyConnected(state) || isNotConnected(state)) { BlockState blockState = isFullyConnected(state) ? this.getDefaultState() : this.dotState; diff --git a/src/main/java/cf/witcheskitchen/common/block/TeapotBlock.java b/src/main/java/cf/witcheskitchen/common/block/TeapotBlock.java index 917e2a84..7a24e093 100644 --- a/src/main/java/cf/witcheskitchen/common/block/TeapotBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/TeapotBlock.java @@ -8,6 +8,7 @@ import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; +import net.minecraft.particle.EntityEffectParticleEffect; import net.minecraft.particle.ParticleTypes; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; @@ -21,7 +22,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.random.RandomGenerator; +import net.minecraft.util.math.random.Random; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; @@ -54,7 +55,7 @@ public FluidState getFluidState(BlockState state) { @Override public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(FACING, ctx.getPlayerFacing().getOpposite()).with(Properties.WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + return this.getDefaultState().with(FACING, ctx.getPlayerLookDirection().getOpposite()).with(Properties.WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); } @Nullable @@ -92,7 +93,7 @@ public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockSt } @Override - public void randomDisplayTick(BlockState state, World world, BlockPos pos, RandomGenerator random) { + public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { if (world.getBlockEntity(pos) instanceof TeapotBlockEntity be) { Direction direction = state.get(FACING).rotateClockwise(Direction.Axis.Y); Direction.Axis axis = direction.getAxis(); @@ -103,12 +104,12 @@ public void randomDisplayTick(BlockState state, World world, BlockPos pos, Rando double k = axis == Direction.Axis.Z ? (double) direction.getOffsetZ() * g : h; if (be.effect != null) { - int color = be.effect.getColor(); + int color = be.effect.value().getColor(); float width = 0.25f; double d = (double) (color >> 16 & 0xFF) / 255.0; double e = (double) (color >> 8 & 0xFF) / 255.0; double f = (double) (color >> 0 & 0xFF) / 255.0; - world.addParticle(ParticleTypes.ENTITY_EFFECT, pos.getX() + 0.5 + MathHelper.nextDouble(world.random, -width, width), pos.getY() + 0.25, pos.getZ() + 0.5 + MathHelper.nextDouble(world.random, -width, width), d, e, f); + world.addParticle(EntityEffectParticleEffect.create(ParticleTypes.ENTITY_EFFECT, color), pos.getX() + 0.5 + MathHelper.nextDouble(world.random, -width, width), pos.getY() + 0.25, pos.getZ() + 0.5 + MathHelper.nextDouble(world.random, -width, width), d, e, f); } else if (be.progress > 0) { double d = (double) pos.getX() + 0.5; double e = (double) pos.getY() + 0.5f; diff --git a/src/main/java/cf/witcheskitchen/common/block/WitchesCauldronBlock.java b/src/main/java/cf/witcheskitchen/common/block/WitchesCauldronBlock.java index a7e58e7b..df4271d3 100644 --- a/src/main/java/cf/witcheskitchen/common/block/WitchesCauldronBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/WitchesCauldronBlock.java @@ -13,7 +13,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.ItemEntity; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; @@ -31,11 +30,10 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.BlockMirror; import net.minecraft.util.BlockRotation; -import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.random.RandomGenerator; +import net.minecraft.util.math.random.Random; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; @@ -77,7 +75,7 @@ static void playSoundToPlayer(World world, BlockPos pos, PlayerEntity player, So @Nullable @Override public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(FACING, ctx.getPlayerFacing()).with(Properties.WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + return this.getDefaultState().with(FACING, ctx.getPlayerLookDirection()).with(Properties.WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); } @Override @@ -102,8 +100,10 @@ public BlockState getStateForNeighborUpdate(BlockState state, Direction directio } // Cauldron fill/drain fluid logic + @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { + final var hand = player.getActiveHand(); final var blockEntity = world.getBlockEntity(pos); final var heldStack = player.getStackInHand(hand); final var side = hit.getSide(); @@ -181,7 +181,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt } } } - return super.onUse(state, world, pos, player, hand, hit); + return super.onUse(state, world, pos, player, hit); } @Override @@ -197,7 +197,7 @@ public void onEntityCollision(BlockState state, World world, BlockPos pos, Entit } } else if (entity instanceof LivingEntity living) { if (state.get(LIT)) { - living.damage(DamageSource.LAVA, 4); + living.damage(entity.getDamageSources().lava(), 4); living.setFireTicks(TimeHelper.toTicks(15)); } } @@ -207,7 +207,7 @@ public void onEntityCollision(BlockState state, World world, BlockPos pos, Entit } @Override - public void randomDisplayTick(BlockState state, World world, BlockPos pos, RandomGenerator random) { + public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { final BlockEntity entity = world.getBlockEntity(pos); if (entity instanceof WitchesCauldronBlockEntity cauldron) { if (cauldron.isPowered()) { diff --git a/src/main/java/cf/witcheskitchen/common/block/WitchesOvenBlock.java b/src/main/java/cf/witcheskitchen/common/block/WitchesOvenBlock.java index 21967e09..49efe8be 100644 --- a/src/main/java/cf/witcheskitchen/common/block/WitchesOvenBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/WitchesOvenBlock.java @@ -4,9 +4,10 @@ import cf.witcheskitchen.api.util.WKUtils; import cf.witcheskitchen.common.blockentity.WitchesOvenBlockEntity; import cf.witcheskitchen.common.registry.WKDamageSources; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; @@ -26,13 +27,12 @@ import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.random.RandomGenerator; +import net.minecraft.util.math.random.Random; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import org.quiltmc.loader.api.minecraft.ClientOnly; @SuppressWarnings("deprecation") public class WitchesOvenBlock extends WKBlock implements Waterloggable { @@ -68,7 +68,7 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po @Override public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(FACING, ctx.getPlayerFacing().getOpposite()).with(Properties.WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + return this.getDefaultState().with(FACING, ctx.getPlayerLookDirection().getOpposite()).with(Properties.WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); } @Override @@ -115,8 +115,8 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt } @Override - @ClientOnly - public void randomDisplayTick(BlockState state, World world, BlockPos pos, RandomGenerator random) { + @Environment(EnvType.CLIENT) + public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { if (state.get(LIT)) { CampfireBlock.spawnSmokeParticle(world, pos, false, false); Blocks.FURNACE.randomDisplayTick(state, world, pos, random); @@ -127,9 +127,7 @@ public void randomDisplayTick(BlockState state, World world, BlockPos pos, Rando public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) { super.onSteppedOn(world, pos, state, entity); if (state.get(LIT) && !entity.isFireImmune() && entity instanceof LivingEntity) { - if (!EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) { - entity.damage(WKDamageSources.ON_OVEN, 1); - } + entity.damage(WKDamageSources.ON_OVEN, 1); } } diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/AmaranthCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/AmaranthCropBlock.java index aed8bb8d..b85254d5 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/AmaranthCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/AmaranthCropBlock.java @@ -62,7 +62,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl Optional nextType = type.next(type); if (nextType.isPresent()) { NbtCompound nbtCompound = new NbtCompound(); - SeedTypeHelper.toNbt(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); + SeedTypeHelper.toComponent(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); getNextSeed(world, pos, nbtCompound); } super.onBreak(world, pos, state, player); @@ -72,7 +72,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + SeedTypeHelper.toComponent(nbt, type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.AMARANTH_SEEDS); seed.getOrCreateNbt().copyFrom(nbt); return seed; diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/BelladonnaCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/BelladonnaCropBlock.java index 4292a1d6..38928222 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/BelladonnaCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/BelladonnaCropBlock.java @@ -48,7 +48,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl Optional nextType = type.next(type); if (nextType.isPresent()) { NbtCompound nbtCompound = new NbtCompound(); - SeedTypeHelper.toNbt(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); + SeedTypeHelper.toComponent(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); getNextSeed(world, pos, nbtCompound); } super.onBreak(world, pos, state, player); @@ -58,7 +58,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + SeedTypeHelper.toComponent(nbt, type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.BELLADONNA_SEEDS); seed.getOrCreateNbt().copyFrom(nbt); return seed; diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/CamelliaCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/CamelliaCropBlock.java index 70c07983..97d5496c 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/CamelliaCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/CamelliaCropBlock.java @@ -69,7 +69,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl Optional nextType = type.next(type); if (nextType.isPresent()) { NbtCompound nbtCompound = new NbtCompound(); - SeedTypeHelper.toNbt(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); + SeedTypeHelper.toComponent(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); getNextSeed(world, pos, nbtCompound); } super.onBreak(world, pos, state, player); @@ -137,7 +137,7 @@ public IntProperty getAgeProperty() { @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + SeedTypeHelper.toComponent(nbt, type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.CAMELLIA_SEEDS); seed.getOrCreateNbt().copyFrom(nbt); return seed; diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/ChamomileCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/ChamomileCropBlock.java index 87679706..d7101630 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/ChamomileCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/ChamomileCropBlock.java @@ -4,7 +4,10 @@ import cf.witcheskitchen.api.interfaces.CropVariants; import cf.witcheskitchen.api.util.SeedTypeHelper; import cf.witcheskitchen.common.block.crop.types.ChamomileTypes; +import cf.witcheskitchen.common.component.WKComponents; import cf.witcheskitchen.common.registry.WKItems; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -12,7 +15,6 @@ import net.minecraft.state.property.IntProperty; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import org.quiltmc.loader.api.minecraft.ClientOnly; import java.util.Optional; @@ -31,14 +33,14 @@ public ChamomileCropBlock(Settings settings, ChamomileTypes rarity) { } @Override - public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { Optional nextType = type.next(type); if (nextType.isPresent()) { NbtCompound nbtCompound = new NbtCompound(); - SeedTypeHelper.toNbt(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); - getNextSeed(world, pos, nbtCompound); + var data = SeedTypeHelper.toComponent(nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); + getNextSeed(world, pos, data); } - super.onBreak(world, pos, state, player); + return super.onBreak(world, pos, state, player); } @Override @@ -46,13 +48,13 @@ public IntProperty getAgeProperty() { return IntProperty.of("age", 0, MAX_AGE); } - @ClientOnly + @Environment(EnvType.CLIENT) @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + var data = SeedTypeHelper.toComponent(type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.CHAMOMILE_SEEDS); - seed.getOrCreateNbt().copyFrom(nbt); + seed.set(WKComponents.SEED_TYPE, data); return seed; } diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/ConeflowerCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/ConeflowerCropBlock.java index 5e2f1c81..3517cf67 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/ConeflowerCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/ConeflowerCropBlock.java @@ -59,7 +59,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl Optional nextType = type.next(type); if (nextType.isPresent()) { NbtCompound nbtCompound = new NbtCompound(); - SeedTypeHelper.toNbt(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); + SeedTypeHelper.toComponent(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); getNextSeed(world, pos, nbtCompound); } super.onBreak(world, pos, state, player); @@ -84,7 +84,7 @@ public IntProperty getAgeProperty() { @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + SeedTypeHelper.toComponent(nbt, type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.CONEFLOWER_SEEDS); seed.getOrCreateNbt().copyFrom(nbt); return seed; diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/FoxgloveCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/FoxgloveCropBlock.java index e3dcd295..de9a8170 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/FoxgloveCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/FoxgloveCropBlock.java @@ -60,7 +60,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl if (nextType.isPresent()) { System.out.println(type.getType() + " : " + nextType.get().getType()); NbtCompound nbtCompound = new NbtCompound(); - SeedTypeHelper.toNbt(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); + SeedTypeHelper.toComponent(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); getNextSeed(world, pos, nbtCompound); } super.onBreak(world, pos, state, player); @@ -85,7 +85,7 @@ public IntProperty getAgeProperty() { @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + SeedTypeHelper.toComponent(nbt, type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.FOXGLOVE_SEEDS); seed.getOrCreateNbt().copyFrom(nbt); return seed; diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/HelleboreCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/HelleboreCropBlock.java index 4daf9f75..3a3c9b00 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/HelleboreCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/HelleboreCropBlock.java @@ -35,7 +35,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl Optional nextType = type.next(type); if (nextType.isPresent()) { NbtCompound nbtCompound = new NbtCompound(); - SeedTypeHelper.toNbt(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); + SeedTypeHelper.toComponent(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); getNextSeed(world, pos, nbtCompound); } super.onBreak(world, pos, state, player); @@ -50,7 +50,7 @@ public IntProperty getAgeProperty() { @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + SeedTypeHelper.toComponent(nbt, type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.HELLEBORE_SEEDS); seed.getOrCreateNbt().copyFrom(nbt); return seed; diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/IrisCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/IrisCropBlock.java index 54b9665b..71d0d3bc 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/IrisCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/IrisCropBlock.java @@ -66,7 +66,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl Optional nextType = type.next(type); if (nextType.isPresent()) { NbtCompound nbtCompound = new NbtCompound(); - SeedTypeHelper.toNbt(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); + SeedTypeHelper.toComponent(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); getNextSeed(world, pos, nbtCompound); } super.onBreak(world, pos, state, player); @@ -81,7 +81,7 @@ public IntProperty getAgeProperty() { @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + SeedTypeHelper.toComponent(nbt, type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.IRIS_SEEDS); seed.getOrCreateNbt().copyFrom(nbt); return seed; diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/MintCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/MintCropBlock.java index 9125bb50..ef594a9b 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/MintCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/MintCropBlock.java @@ -33,7 +33,7 @@ public IntProperty getAgeProperty() { @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + SeedTypeHelper.toComponent(nbt, type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.MINT_SPRIG); seed.getOrCreateNbt().copyFrom(nbt); return seed; diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/SanguinaryCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/SanguinaryCropBlock.java index 411eca7a..56de53da 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/SanguinaryCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/SanguinaryCropBlock.java @@ -35,7 +35,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl Optional nextType = type.next(type); if (nextType.isPresent()) { NbtCompound nbtCompound = new NbtCompound(); - SeedTypeHelper.toNbt(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); + SeedTypeHelper.toComponent(nbtCompound, nextType.get().getName(), nextType.get().getType(), nextType.get().getColor()); getNextSeed(world, pos, nbtCompound); } super.onBreak(world, pos, state, player); @@ -50,7 +50,7 @@ public IntProperty getAgeProperty() { @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + SeedTypeHelper.toComponent(nbt, type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.SANGUINARY_SEEDS); seed.getOrCreateNbt().copyFrom(nbt); return seed; diff --git a/src/main/java/cf/witcheskitchen/common/block/crop/WormwoodCropBlock.java b/src/main/java/cf/witcheskitchen/common/block/crop/WormwoodCropBlock.java index 081dda97..a9ca2b41 100644 --- a/src/main/java/cf/witcheskitchen/common/block/crop/WormwoodCropBlock.java +++ b/src/main/java/cf/witcheskitchen/common/block/crop/WormwoodCropBlock.java @@ -68,7 +68,7 @@ public IntProperty getAgeProperty() { @Override protected ItemStack getSeedsItemStack() { NbtCompound nbt = new NbtCompound(); - SeedTypeHelper.toNbt(nbt, type.getName(), type.getType(), type.getColor()); + SeedTypeHelper.toComponent(nbt, type.getName(), type.getType(), type.getColor()); ItemStack seed = new ItemStack(WKItems.WORMWOOD_SEEDS); seed.getOrCreateNbt().copyFrom(nbt); return seed; diff --git a/src/main/java/cf/witcheskitchen/common/blockentity/BrewingBarrelBlockEntity.java b/src/main/java/cf/witcheskitchen/common/blockentity/BrewingBarrelBlockEntity.java index 334dbdc1..dfc2359b 100644 --- a/src/main/java/cf/witcheskitchen/common/blockentity/BrewingBarrelBlockEntity.java +++ b/src/main/java/cf/witcheskitchen/common/blockentity/BrewingBarrelBlockEntity.java @@ -3,10 +3,13 @@ import cf.witcheskitchen.api.block.entity.WKBlockEntity; import cf.witcheskitchen.api.block.entity.WKBlockEntityWithInventory; import cf.witcheskitchen.api.util.InventoryManager; -import cf.witcheskitchen.client.gui.screen.handler.BrewingBarrelScreenHandler; import cf.witcheskitchen.common.recipe.BarrelFermentingRecipe; +import cf.witcheskitchen.common.recipe.MultipleStackRecipeInput; import cf.witcheskitchen.common.registry.WKBlockEntityTypes; import cf.witcheskitchen.common.registry.WKRecipeTypes; +import cf.witcheskitchen.common.screenhandler.BrewingBarrelScreenHandler; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.HorizontalFacingBlock; @@ -18,6 +21,8 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.recipe.Ingredient; +import net.minecraft.recipe.RecipeEntry; +import net.minecraft.registry.RegistryWrapper; import net.minecraft.screen.NamedScreenHandlerFactory; import net.minecraft.screen.PropertyDelegate; import net.minecraft.screen.ScreenHandler; @@ -30,12 +35,12 @@ import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import org.quiltmc.loader.api.minecraft.ClientOnly; public class BrewingBarrelBlockEntity extends WKBlockEntityWithInventory implements NamedScreenHandlerFactory { public static final int MAX_TIME = 168_000; // 7 days - @ClientOnly + // TODO: are we sure this wouldn't crash the dedicated server? + @Environment(EnvType.CLIENT) private final InventoryManager clientInventoryManager; private final PropertyDelegate delegate; private boolean hasWater; @@ -153,7 +158,7 @@ private boolean canMakeAlcohol(BarrelFermentingRecipe matchingRecipe) { if (this.clientInventoryManager.isEmpty()) { return false; } - return matchingRecipe.matches(this, this.world); + return matchingRecipe.matches(new MultipleStackRecipeInput(this.clientInventoryManager.getStacks()), this.world); } } @@ -162,14 +167,15 @@ private BarrelFermentingRecipe findRecipeFor(World world, DefaultedList brewingRecipe.matches(this, world)) + .filter(brewingRecipe -> brewingRecipe.value().matches(new MultipleStackRecipeInput(this.manager.getStacks()), world)) .findFirst() + .map(RecipeEntry::value) .orElse(null); if (recipe != null) { this.previousRecipe = recipe; @@ -202,27 +208,27 @@ private boolean makeAlcohol(BarrelFermentingRecipe recipe) { } } } - this.clientInventoryManager.setStack(0, recipe.craft(this.clientInventoryManager)); + this.clientInventoryManager.setStack(0, recipe.craft(new MultipleStackRecipeInput(this.clientInventoryManager.getStacks()), world.getRegistryManager())); world.updateListeners(pos, this.getCachedState(), this.getCachedState(), Block.NOTIFY_ALL); return true; } } @Override - public void readNbt(NbtCompound nbt) { - super.readNbt(nbt); + public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup lookup) { + super.readNbt(nbt, lookup); this.clientInventoryManager.clear(); - Inventories.readNbt(nbt.getCompound("ClientInventory"), this.clientInventoryManager.getStacks()); + Inventories.readNbt(nbt.getCompound("ClientInventory"), this.clientInventoryManager.getStacks(), lookup); this.timer = nbt.getInt("Timer"); this.hasWater = nbt.getBoolean("HasWater"); this.hasFinished = nbt.getBoolean("HasFinished"); } @Override - protected void writeNbt(NbtCompound nbt) { - super.writeNbt(nbt); + protected void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup lookup) { + super.writeNbt(nbt, lookup); NbtCompound clientData = new NbtCompound(); - Inventories.writeNbt(clientData, this.clientInventoryManager.getStacks()); + Inventories.writeNbt(clientData, this.clientInventoryManager.getStacks(), lookup); nbt.put("ClientInventory", clientData); nbt.putInt("Timer", this.timer); nbt.putBoolean("HasWater", this.hasWater); @@ -263,13 +269,13 @@ public ScreenHandler createMenu(int syncId, PlayerInventory inv, PlayerEntity pl // Client Sync @Override public BlockEntityUpdateS2CPacket toUpdatePacket() { - return BlockEntityUpdateS2CPacket.of(this); + return BlockEntityUpdateS2CPacket.create(this); } @Override - public NbtCompound toSyncedNbt() { + public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registryLookup) { final NbtCompound data = new NbtCompound(); - writeNbt(data); + writeNbt(data, registryLookup); return data; } @@ -281,7 +287,7 @@ private void playSound(SoundEvent soundEvent) { this.world.playSound(null, d, e, f, soundEvent, SoundCategory.BLOCKS, 0.5f, this.world.random.nextFloat() * 0.1f + 0.9f); } - @ClientOnly + @Environment(EnvType.CLIENT) public ItemStack getRenderStack() { if (this.clientInventoryManager.isEmpty()) { return ItemStack.EMPTY; diff --git a/src/main/java/cf/witcheskitchen/common/blockentity/GlyphBlockEntity.java b/src/main/java/cf/witcheskitchen/common/blockentity/GlyphBlockEntity.java index e294f3a3..b8f965fb 100644 --- a/src/main/java/cf/witcheskitchen/common/blockentity/GlyphBlockEntity.java +++ b/src/main/java/cf/witcheskitchen/common/blockentity/GlyphBlockEntity.java @@ -4,6 +4,7 @@ import cf.witcheskitchen.api.block.entity.WKBlockEntityWithInventory; import cf.witcheskitchen.api.ritual.Ritual; import cf.witcheskitchen.api.ritual.RitualCircle; +import cf.witcheskitchen.common.recipe.MultipleStackRecipeInput; import cf.witcheskitchen.common.recipe.RitualRecipe; import cf.witcheskitchen.common.registry.WKBlockEntityTypes; import cf.witcheskitchen.common.registry.WKBlocks; @@ -16,10 +17,11 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.recipe.RecipeEntry; +import net.minecraft.registry.RegistryWrapper; import net.minecraft.util.Identifier; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; @@ -72,7 +74,7 @@ public void onUse(World world, BlockState state, BlockPos pos, PlayerEntity play ItemStack handStack = player.getMainHandStack(); if (handStack.isEmpty()) { - RitualRecipe ritualRecipeNoCircleCheck = world.getRecipeManager().listAllOfType(WKRecipeTypes.RITUAL_RECIPE_TYPE).stream().filter(recipe -> recipe.matches(this.manager, world)).findFirst().orElse(null); + RitualRecipe ritualRecipeNoCircleCheck = world.getRecipeManager().listAllOfType(WKRecipeTypes.RITUAL_RECIPE_TYPE).stream().filter(entry -> entry.value().matches(new MultipleStackRecipeInput(this.manager.getStacks()), world)).findFirst().map(RecipeEntry::value).orElse(null); if (ritualRecipeNoCircleCheck != null) { Set circle = ritualRecipeNoCircleCheck.circleSet; if (checkValidCircle(world, pos, circle)) { @@ -103,7 +105,7 @@ private boolean checkValidSacrifices(RitualRecipe ritual, World world) { for (EntityType entityType : ritualSacrifices) { LivingEntity foundEntity = getClosestEntity(livingEntityList, entityType, this.pos); if (foundEntity != null) { - foundEntity.damage(DamageSource.MAGIC, Integer.MAX_VALUE); + foundEntity.damage(world.getDamageSources().magic(), Integer.MAX_VALUE); } } return true; @@ -160,15 +162,15 @@ private boolean isValidGlyph(RitualCircle.Type type, Block block) { } @Override - public void readNbt(NbtCompound nbt) { - super.readNbt(nbt); + protected void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { + super.readNbt(nbt, registryLookup); progress = nbt.getInt("Progress"); - ritual = WKRegistries.RITUAL.get(new Identifier(nbt.getString("Ritual"))); + ritual = WKRegistries.RITUAL.get(Identifier.tryParse(nbt.getString("Ritual"))); } @Override - protected void writeNbt(NbtCompound nbt) { - super.writeNbt(nbt); + protected void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { + super.writeNbt(nbt, registryLookup); nbt.putInt("Progress", progress); nbt.putString("Ritual", ritual.toString()); } diff --git a/src/main/java/cf/witcheskitchen/common/blockentity/TeapotBlockEntity.java b/src/main/java/cf/witcheskitchen/common/blockentity/TeapotBlockEntity.java index c941b5b6..272cdb99 100644 --- a/src/main/java/cf/witcheskitchen/common/blockentity/TeapotBlockEntity.java +++ b/src/main/java/cf/witcheskitchen/common/blockentity/TeapotBlockEntity.java @@ -4,10 +4,14 @@ import cf.witcheskitchen.api.block.entity.WKBlockEntityWithInventory; import cf.witcheskitchen.api.util.ItemUtil; import cf.witcheskitchen.common.block.WitchesOvenBlock; +import cf.witcheskitchen.common.component.WKComponents; +import cf.witcheskitchen.common.component.blockentity.TeapotData; import cf.witcheskitchen.common.recipe.TeaRecipe; import cf.witcheskitchen.common.registry.WKBlockEntityTypes; import cf.witcheskitchen.common.registry.WKRecipeTypes; import net.minecraft.block.BlockState; +import net.minecraft.component.ComponentMap; +import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffect; @@ -15,9 +19,10 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.nbt.NbtCompound; import net.minecraft.potion.Potions; +import net.minecraft.recipe.RecipeEntry; import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.util.Hand; @@ -26,8 +31,6 @@ import net.minecraft.util.math.Box; import net.minecraft.world.World; -import java.util.stream.Collectors; - public class TeapotBlockEntity extends WKBlockEntityWithInventory { public static final int MAX_DURATION = 20 * 60 * 20; //20min public static final int UNOBTAINABLE_OUTPUT = MAX_DURATION / 10; @@ -35,30 +38,25 @@ public class TeapotBlockEntity extends WKBlockEntityWithInventory { public int progress = 0; public int effectTimer = 0; public TeaRecipe teaRecipe = null; - public StatusEffect effect = null; + public RegistryEntry effect = null; public boolean hasWater = false; public TeapotBlockEntity(BlockPos pos, BlockState state) { super(WKBlockEntityTypes.TEAPOT, pos, state, 1); } - static StatusEffect getPotionEffectById(int id) { - StatusEffect statusEffect = StatusEffect.byRawId(id); - return Registries.STATUS_EFFECT.stream().collect(Collectors.toSet()).contains(statusEffect) ? statusEffect : null; - } - @Override public void tick(World world, BlockPos blockPos, BlockState blockState, WKBlockEntity blockEntity) { if (world.getBlockState(pos.down()).getBlock() instanceof WitchesOvenBlock && world.getBlockState(pos.down()).get(WitchesOvenBlock.LIT)) { if (teaRecipe == null) { - teaRecipe = world.getRecipeManager().listAllOfType(WKRecipeTypes.TEA_RECIPE_TYPE).stream().filter(recipe -> recipe.input.test(this.manager.getStack(0))).findFirst().orElse(null); + teaRecipe = world.getRecipeManager().listAllOfType(WKRecipeTypes.TEA_RECIPE_TYPE).stream().filter(recipe -> recipe.value().input.test(this.manager.getStack(0))).findFirst().map(RecipeEntry::value).orElse(null); } else { if (hasWater) { if (effect == null) { effectTimer = 0; progress++; if (progress >= UNOBTAINABLE_OUTPUT) { - effect = teaRecipe.getEffect(); + effect = Registries.STATUS_EFFECT.getEntry(teaRecipe.getEffect()); } } else { progress = 0; @@ -94,13 +92,11 @@ public void onUse(World world, BlockState state, BlockPos pos, PlayerEntity play } else { if (player.getMainHandStack().isOf(Items.GLASS_BOTTLE)) { tryFillBottle(player); - } else if (stack.isOf(Items.POTION) && PotionUtil.getPotion(stack) == Potions.WATER) { + } else if (stack.isOf(Items.POTION) && stack.contains(DataComponentTypes.POTION_CONTENTS) && stack.get(DataComponentTypes.POTION_CONTENTS).potion().isPresent() && stack.get(DataComponentTypes.POTION_CONTENTS).potion().orElseThrow().matches(Potions.WATER)) { fillKettle(player); } else { - TeaRecipe teaRecipe = world.getRecipeManager().listAllOfType(WKRecipeTypes.TEA_RECIPE_TYPE).stream().filter(recipe -> recipe.input.test(stack)).findFirst().orElse(null); - if (teaRecipe != null) { - tryAddIngredientToTeaPot(stack, world); - } + world.getRecipeManager().listAllOfType(WKRecipeTypes.TEA_RECIPE_TYPE).stream().filter(recipe -> recipe.value().input.test(stack)).findFirst().map(RecipeEntry::value) + .ifPresent(teaRecipe -> tryAddIngredientToTeaPot(stack, world)); } } } @@ -116,7 +112,7 @@ private void tryAddIngredientToTeaPot(ItemStack input, World world) { private void fillKettle(PlayerEntity player) { if (!hasWater) { ItemUtil.addItemToInventoryAndConsume(player, Hand.MAIN_HAND, new ItemStack(Items.GLASS_BOTTLE)); - player.world.playSound(null, pos, SoundEvents.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1 / 3f, 1.0f); + player.getWorld().playSound(null, pos, SoundEvents.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1 / 3f, 1.0f); hasWater = true; } } @@ -124,7 +120,7 @@ private void fillKettle(PlayerEntity player) { private void tryFillBottle(PlayerEntity player) { if (progress > TIME_TO_BREW && progress < UNOBTAINABLE_OUTPUT) { if (teaRecipe != null) { - player.world.playSound(null, pos, SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1 / 3f, 1.0F); + player.getWorld().playSound(null, pos, SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1 / 3f, 1.0F); ItemUtil.addItemToInventoryAndConsume(player, Hand.MAIN_HAND, teaRecipe.getOutput()); emptyInventoryAndReset(world, false); } @@ -145,20 +141,21 @@ private void emptyInventoryAndReset(World world, boolean sound) { } @Override - public void readNbt(NbtCompound nbt) { - super.readNbt(nbt); - progress = nbt.getInt("Progress"); - effectTimer = nbt.getInt("EffectTimer"); - hasWater = nbt.getBoolean("HasWater"); - effect = getPotionEffectById(nbt.getInt("Effect")); + protected void readComponents(ComponentsAccess components) { + super.readComponents(components); + TeapotData data = components.get(WKComponents.TEAPOT); + + if (data != null) { + this.progress = data.progress(); + this.effectTimer = data.effectTimer(); + this.hasWater = data.hasWater(); + this.effect = data.effect(); + } } @Override - protected void writeNbt(NbtCompound nbt) { - super.writeNbt(nbt); - nbt.putInt("Progress", progress); - nbt.putInt("EffectTimer", effectTimer); - nbt.putBoolean("HasWater", hasWater); - nbt.putInt("Effect", StatusEffect.getEffectRawId(this.effect)); + protected void addComponents(ComponentMap.Builder builder) { + super.addComponents(builder); + builder.add(WKComponents.TEAPOT, new TeapotData(this.progress, this.effectTimer, this.hasWater, this.effect)); } } diff --git a/src/main/java/cf/witcheskitchen/common/blockentity/WitchesCauldronBlockEntity.java b/src/main/java/cf/witcheskitchen/common/blockentity/WitchesCauldronBlockEntity.java index 2588ff13..ec99161e 100644 --- a/src/main/java/cf/witcheskitchen/common/blockentity/WitchesCauldronBlockEntity.java +++ b/src/main/java/cf/witcheskitchen/common/blockentity/WitchesCauldronBlockEntity.java @@ -183,6 +183,8 @@ private void updateCauldron(ItemStack stack) { markDirty(); } + // TODO: write to NBT or to components? + // or some to components and some to NBT? @Override protected void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { super.readNbt(nbt, registryLookup); @@ -225,6 +227,13 @@ protected void addComponents(ComponentMap.Builder componentMapBuilder) { )); } + @Override + public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registryLookup) { + final NbtCompound data = new NbtCompound(); + writeNbt(data, registryLookup); + return data; + } + @Override public int fill(FluidStack stack, Direction side) { return this.tank.fill(stack, side); diff --git a/src/main/java/cf/witcheskitchen/common/blockentity/WitchesOvenBlockEntity.java b/src/main/java/cf/witcheskitchen/common/blockentity/WitchesOvenBlockEntity.java index 3c83275c..f0ef0c36 100644 --- a/src/main/java/cf/witcheskitchen/common/blockentity/WitchesOvenBlockEntity.java +++ b/src/main/java/cf/witcheskitchen/common/blockentity/WitchesOvenBlockEntity.java @@ -5,15 +5,16 @@ import cf.witcheskitchen.api.block.entity.WKBlockEntity; import cf.witcheskitchen.api.block.entity.WKBlockEntityWithInventory; import cf.witcheskitchen.api.util.InventoryManager; -import cf.witcheskitchen.client.gui.screen.handler.WitchesOvenScreenHandler; import cf.witcheskitchen.common.block.WitchesOvenBlock; import cf.witcheskitchen.common.recipe.OvenCookingRecipe; import cf.witcheskitchen.common.registry.WKBlockEntityTypes; import cf.witcheskitchen.common.registry.WKRecipeTypes; +import cf.witcheskitchen.common.screenhandler.WitchesOvenScreenHandler; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.CampfireBlock; import net.minecraft.block.entity.AbstractFurnaceBlockEntity; +import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.ExperienceOrbEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; @@ -24,6 +25,8 @@ import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.particle.ParticleTypes; import net.minecraft.recipe.*; +import net.minecraft.recipe.input.SingleStackRecipeInput; +import net.minecraft.registry.RegistryWrapper; import net.minecraft.screen.NamedScreenHandlerFactory; import net.minecraft.screen.PropertyDelegate; import net.minecraft.screen.ScreenHandler; @@ -39,6 +42,7 @@ import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; +import java.util.List; import java.util.Objects; import java.util.Optional; @@ -122,17 +126,18 @@ private static Optional> findMatchingRecipeFor(World world, final Item if (optionalOvenRecipe.isPresent()) { return Optional.of(optionalOvenRecipe.get()); } - if (input.isFood()) { + if (input.contains(DataComponentTypes.FOOD)) { final Optional optional = world.getRecipeManager() .listAllOfType(RecipeType.SMELTING) .stream() - .filter(recipe -> { + .filter(entry -> { + var recipe = entry.value(); final DefaultedList ingredients = recipe.getIngredients(); if (ingredients.size() == 1 && ingredients.get(0).test(input)) { - return recipe.getOutput().isFood(); + return recipe.getResult(world.getRegistryManager()).contains(DataComponentTypes.FOOD); } return false; - }).findFirst(); + }).findFirst().map(RecipeEntry::value); if (optional.isPresent()) return Optional.of(optional.get()); } return Optional.empty(); @@ -144,16 +149,17 @@ private static Optional> findMatchingRecipeFor(World world, final Item private static Optional getOvenRecipe(World world, ItemStack input) { return world.getRecipeManager().listAllOfType(WKRecipeTypes.WITCHES_OVEN_COOKING_RECIPE_TYPE) .stream() - .filter(type -> type.getInput().test(input)) - .findFirst(); + .filter(type -> type.value().input().test(input)) + .findFirst() + .map(RecipeEntry::value); } @Override - public void readNbt(NbtCompound nbt) { - super.readNbt(nbt); + public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup lookup) { + super.readNbt(nbt, lookup); // Load Inventories this.passiveInventory.clear(); - Inventories.readNbt(nbt.getCompound("PassiveInventory"), this.getStacksOnTop()); + Inventories.readNbt(nbt.getCompound("PassiveInventory"), this.getStacksOnTop(), lookup); this.burnTime = nbt.getShort("BurnTime"); this.activeProgress = nbt.getShort("Progress"); if (nbt.contains("PassiveProgress", NbtElement.INT_ARRAY_TYPE)) { @@ -165,11 +171,11 @@ public void readNbt(NbtCompound nbt) { } @Override - protected void writeNbt(NbtCompound nbt) { - super.writeNbt(nbt); + protected void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup lookup) { + super.writeNbt(nbt, lookup); // Save Inventories var inventoryNbt = new NbtCompound(); - Inventories.writeNbt(inventoryNbt, this.getStacksOnTop()); + Inventories.writeNbt(inventoryNbt, this.getStacksOnTop(), lookup); nbt.put("PassiveInventory", inventoryNbt); nbt.putShort("BurnTime", (short) this.burnTime); nbt.putShort("Progress", (short) this.activeProgress); @@ -216,7 +222,7 @@ public void tick(World world, BlockPos pos, BlockState state, WKBlockEntity bloc final Optional> optionRecipe = findMatchingRecipeFor(world, this.getStack(this.input)); if (optionRecipe.isPresent()) { final Recipe recipe = optionRecipe.get(); - final DefaultedList outputs = this.getResults(recipe); + final List outputs = this.getResults(recipe, world); this.maxProgress = getCookingTime(recipe); if (outputs != null && !outputs.isEmpty()) { if (!this.isBurning() && canCraft(outputs)) { @@ -267,7 +273,7 @@ public void tick(World world, BlockPos pos, BlockState state, WKBlockEntity bloc WitchesKitchen.LOGGER.error("Attempted to craft a null passive recipe from Witches' Oven. This must be fixed"); return; } - final ItemStack output = passiveRecipe.craft(this.passiveInventory); + final ItemStack output = passiveRecipe.craft(new SingleStackRecipeInput(this.passiveInventory.getStack(0)), world.getRegistryManager()); ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), output); this.passiveInventory.setStack(i, ItemStack.EMPTY); world.updateListeners(pos, state, state, Block.NOTIFY_ALL); @@ -295,7 +301,7 @@ public void tick(World world, BlockPos pos, BlockState state, WKBlockEntity bloc */ protected int getCookingTime(Recipe recipe) { if (recipe instanceof SmeltingRecipe) { - return ((SmeltingRecipe) recipe).getCookTime(); + return ((SmeltingRecipe) recipe).getCookingTime(); } else if (recipe instanceof OvenCookingRecipe) { return ((OvenCookingRecipe) recipe).time(); } else { @@ -337,12 +343,13 @@ public void onClientTick(World world, BlockPos pos, BlockState state, WKBlockEnt public @Nullable CampfireCookingRecipe getCampfireRecipeFor(World world, ItemStack stack) { return world.getRecipeManager().listAllOfType(RecipeType.CAMPFIRE_COOKING) .stream() - .filter(recipe -> { + .filter(entry -> { + var recipe = entry.value(); if (recipe.getIngredients().size() == 1 && recipe.getIngredients().get(0).test(stack)) { - return recipe.getOutput().isFood(); + return recipe.getResult(world.getRegistryManager()).contains(DataComponentTypes.FOOD); } return false; - }).findFirst().orElse(null); + }).findFirst().map(RecipeEntry::value).orElse(null); } /** @@ -384,9 +391,9 @@ public int getItemBurnTime(ItemStack stack) { * @param recipe Recipe * @return the outputs of the given recipe */ - private DefaultedList getResults(final Recipe recipe) { + private List getResults(final Recipe recipe, World world) { if (recipe instanceof SmeltingRecipe) { - return DefaultedList.ofSize(1, recipe.getOutput()); + return DefaultedList.ofSize(1, recipe.getResult(world.getRegistryManager())); } else if (recipe instanceof OvenCookingRecipe ovenRecipe) { return ovenRecipe.outputs(); } else { @@ -401,7 +408,7 @@ private DefaultedList getResults(final Recipe recipe) { * It also checks that we have enough space for crafting *

*/ - public boolean canCraft(final DefaultedList outputs) { + public boolean canCraft(final List outputs) { if (this.world == null) { return false; } else if (outputs.isEmpty()) { @@ -422,14 +429,14 @@ public boolean canCraft(final DefaultedList outputs) { if (stackInOutput.isEmpty()) { //if first output is empty //extra output is not - if (!stackInExtra.isItemEqualIgnoreDamage(recipeExtra)) { + if (!ItemStack.areItemsEqual(stackInExtra, recipeExtra)) { return false; } } if (stackInExtra.isEmpty()) { //if extra output is empty //we know first output is not empty - if (!stackInOutput.isItemEqualIgnoreDamage(recipeOutput)) { + if (!ItemStack.areItemsEqual(stackInOutput, recipeOutput)) { return false; } } @@ -441,7 +448,7 @@ public boolean canCraft(final DefaultedList outputs) { // Otherwise, there is only 1 output if (stackInOutput.isEmpty()) { return true; - } else if (!stackInOutput.isItemEqualIgnoreDamage(recipeOutput)) { + } else if (!ItemStack.areItemsEqual(stackInOutput, recipeOutput)) { return false; } else { return nextOutputCount <= this.getMaxCountPerStack() && nextOutputCount <= recipeOutput.getMaxCount(); @@ -455,7 +462,7 @@ public boolean canCraft(final DefaultedList outputs) { *

Logic to craft the given recipe.

*

It also increments the experience count.

*/ - public boolean craftRecipe(final DefaultedList outputs, final float experience) { + public boolean craftRecipe(final List outputs, final float experience) { if (this.world == null) { return false; } else if (outputs == null) { @@ -513,15 +520,15 @@ public boolean craftRecipe(final DefaultedList outputs, final float e // Client Sync @Override public BlockEntityUpdateS2CPacket toUpdatePacket() { - return BlockEntityUpdateS2CPacket.of(this); + return BlockEntityUpdateS2CPacket.create(this); } // Syncs the inventory // with the client @Override - public NbtCompound toSyncedNbt() { + public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup lookup) { final NbtCompound data = new NbtCompound(); - writeNbt(data); + writeNbt(data, lookup); return data; } diff --git a/src/main/java/cf/witcheskitchen/common/component/WKComponents.java b/src/main/java/cf/witcheskitchen/common/component/WKComponents.java index df5027bd..4004f532 100644 --- a/src/main/java/cf/witcheskitchen/common/component/WKComponents.java +++ b/src/main/java/cf/witcheskitchen/common/component/WKComponents.java @@ -2,7 +2,9 @@ import cf.witcheskitchen.WitchesKitchen; import cf.witcheskitchen.api.fluid.FluidStack; +import cf.witcheskitchen.common.component.blockentity.TeapotData; import cf.witcheskitchen.common.component.blockentity.WitchesCauldronData; +import cf.witcheskitchen.common.component.item.SeedTypeData; import cf.witcheskitchen.common.component.item.TaglockEntityData; import net.minecraft.component.ComponentType; import net.minecraft.registry.Registries; @@ -34,6 +36,18 @@ public class WKComponents { .build() ); + public static final ComponentType TEAPOT = register("teapot", ComponentType.builder() + .codec(TeapotData.CODEC) + .packetCodec(TeapotData.PACKET_CODEC) + .build() + ); + + public static final ComponentType SEED_TYPE = register("seed_type", ComponentType.builder() + .codec(SeedTypeData.CODEC) + .packetCodec(SeedTypeData.PACKET_CODEC) + .build() + ); + private static ComponentType register(String name, ComponentType component) { return Registry.register(Registries.DATA_COMPONENT_TYPE, WitchesKitchen.id(name), component); } diff --git a/src/main/java/cf/witcheskitchen/common/component/blockentity/TeapotData.java b/src/main/java/cf/witcheskitchen/common/component/blockentity/TeapotData.java new file mode 100644 index 00000000..5a44d177 --- /dev/null +++ b/src/main/java/cf/witcheskitchen/common/component/blockentity/TeapotData.java @@ -0,0 +1,39 @@ +package cf.witcheskitchen.common.component.blockentity; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.network.RegistryByteBuf; +import net.minecraft.network.codec.PacketCodec; +import net.minecraft.network.codec.PacketCodecs; +import net.minecraft.registry.Registries; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; + +public record TeapotData(int progress, int effectTimer, boolean hasWater, RegistryEntry effect) { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> + instance.group( + Codec.INT + .fieldOf("progress") + .forGetter(TeapotData::progress), + Codec.INT + .fieldOf("effectTimer") + .forGetter(TeapotData::effectTimer), + Codec.BOOL + .fieldOf("hasWater") + .forGetter(TeapotData::hasWater), + Registries.STATUS_EFFECT.getEntryCodec() + .fieldOf("effect") + .forGetter(TeapotData::effect) + ) + .apply(instance, TeapotData::new) + ); + + public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( + PacketCodecs.INTEGER, TeapotData::progress, + PacketCodecs.INTEGER, TeapotData::effectTimer, + PacketCodecs.BOOL, TeapotData::hasWater, + PacketCodecs.registryEntry(RegistryKeys.STATUS_EFFECT), TeapotData::effect, + TeapotData::new + ); +} diff --git a/src/main/java/cf/witcheskitchen/common/component/item/SeedTypeData.java b/src/main/java/cf/witcheskitchen/common/component/item/SeedTypeData.java new file mode 100644 index 00000000..15c3b429 --- /dev/null +++ b/src/main/java/cf/witcheskitchen/common/component/item/SeedTypeData.java @@ -0,0 +1,37 @@ +package cf.witcheskitchen.common.component.item; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.codec.PacketCodec; +import net.minecraft.network.codec.PacketCodecs; + +public record SeedTypeData( + String name, String type, int color +) { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> + instance.group( + Codec.STRING + .fieldOf("name") + .forGetter(SeedTypeData::name), + Codec.STRING + .fieldOf("type") + .forGetter(SeedTypeData::type), + Codec.INT + .optionalFieldOf("color", 0xFFFFFF) + .forGetter(SeedTypeData::color) + ) + .apply(instance, SeedTypeData::new) + ); + + public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( + PacketCodecs.STRING, SeedTypeData::name, + PacketCodecs.STRING, SeedTypeData::type, + PacketCodecs.VAR_INT, SeedTypeData::color, + SeedTypeData::new + ); + + public String getBlockId() { + return this.name + "_" + this.type; + } +} diff --git a/src/main/java/cf/witcheskitchen/common/entity/ai/FerretBrain.java b/src/main/java/cf/witcheskitchen/common/entity/ai/FerretBrain.java index f2559d7c..aca1bbe4 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/ai/FerretBrain.java +++ b/src/main/java/cf/witcheskitchen/common/entity/ai/FerretBrain.java @@ -11,13 +11,13 @@ import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.brain.Brain; +import net.minecraft.entity.ai.brain.LivingTargetCache; import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.VisibleLivingEntitiesCache; import net.minecraft.entity.ai.brain.sensor.Sensor; import net.minecraft.entity.ai.brain.task.LookAroundTask; import net.minecraft.entity.ai.brain.task.LookTargetUtil; +import net.minecraft.entity.ai.brain.task.MoveToTargetTask; import net.minecraft.entity.ai.brain.task.StayAboveWaterTask; -import net.minecraft.entity.ai.brain.task.WanderAroundTask; import net.tslat.smartbrainlib.api.core.BrainActivityGroup; import net.tslat.smartbrainlib.api.core.behaviour.FirstApplicableBehaviour; import net.tslat.smartbrainlib.api.core.behaviour.OneRandomBehaviour; @@ -64,7 +64,7 @@ public static BrainActivityGroup getCoreTasks() { new DontMoveTask(), new StayAboveWaterTask(0.6f), new LookAroundTask(45, 90), - new WanderAroundTask() + new MoveToTargetTask() ); } @@ -95,9 +95,9 @@ public static Optional getAttackTarget(FerretEntity ferr return optional; } if (brain.hasMemoryModule(MemoryModuleType.VISIBLE_MOBS)) { - Optional visibleLivingEntitiesCache = ferretEntity.getBrain().getOptionalMemory(MemoryModuleType.VISIBLE_MOBS); + Optional visibleLivingEntitiesCache = ferretEntity.getBrain().getOptionalMemory(MemoryModuleType.VISIBLE_MOBS); if (visibleLivingEntitiesCache.isPresent()) { - return visibleLivingEntitiesCache.get().m_yzezovsk(UNTAMED_TARGET_PREDICATE); + return visibleLivingEntitiesCache.get().findFirst(UNTAMED_TARGET_PREDICATE); } } return Optional.empty(); diff --git a/src/main/java/cf/witcheskitchen/common/entity/ai/HedgehogBrain.java b/src/main/java/cf/witcheskitchen/common/entity/ai/HedgehogBrain.java index 6c46367e..e084a9c2 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/ai/HedgehogBrain.java +++ b/src/main/java/cf/witcheskitchen/common/entity/ai/HedgehogBrain.java @@ -9,8 +9,8 @@ import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.brain.task.LookAroundTask; +import net.minecraft.entity.ai.brain.task.MoveToTargetTask; import net.minecraft.entity.ai.brain.task.StayAboveWaterTask; -import net.minecraft.entity.ai.brain.task.WanderAroundTask; import net.tslat.smartbrainlib.api.core.BrainActivityGroup; import net.tslat.smartbrainlib.api.core.behaviour.OneRandomBehaviour; import net.tslat.smartbrainlib.api.core.behaviour.custom.misc.Idle; @@ -35,7 +35,7 @@ public static BrainActivityGroup getCoreTasks() { new DontMoveTask(), new StayAboveWaterTask(0.6f), new LookAroundTask(45, 90), - new WanderAroundTask() + new MoveToTargetTask() ); } diff --git a/src/main/java/cf/witcheskitchen/common/entity/ai/sensor/TimeOfDaySensor.java b/src/main/java/cf/witcheskitchen/common/entity/ai/sensor/TimeOfDaySensor.java index 197a0ed4..70a84aa0 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/ai/sensor/TimeOfDaySensor.java +++ b/src/main/java/cf/witcheskitchen/common/entity/ai/sensor/TimeOfDaySensor.java @@ -17,7 +17,7 @@ public class TimeOfDaySensor extends PredicateSensor> MEMORIES = ObjectArrayList.of(WKMemoryModuleTypes.IS_NIGHT); public TimeOfDaySensor() { - super((entity2, entity) -> entity.world.isNight()); + super((entity2, entity) -> entity.getWorld().isNight()); } @Override diff --git a/src/main/java/cf/witcheskitchen/common/entity/ai/task/AnimatableMeleeAttack.java b/src/main/java/cf/witcheskitchen/common/entity/ai/task/AnimatableMeleeAttack.java index c7303249..865181ac 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/ai/task/AnimatableMeleeAttack.java +++ b/src/main/java/cf/witcheskitchen/common/entity/ai/task/AnimatableMeleeAttack.java @@ -47,7 +47,7 @@ protected List, MemoryModuleState>> getMemoryRequiremen protected boolean shouldRun(ServerWorld world, E entity) { this.target = BrainUtils.getTargetOfEntity(entity); - return entity.getVisibilityCache().canSee(this.target) && entity.m_kxhmsdlh(this.target); + return entity.getVisibilityCache().canSee(this.target) && entity.isInAttackRange(this.target); } @Override @@ -68,7 +68,7 @@ protected void doDelayedAction(E entity) { if (this.target == null) return; - if (!entity.getVisibilityCache().canSee(this.target) || !entity.m_kxhmsdlh(this.target)) + if (!entity.getVisibilityCache().canSee(this.target) || !entity.isInAttackRange(this.target)) return; entity.tryAttack(this.target); diff --git a/src/main/java/cf/witcheskitchen/common/entity/ai/task/DontMoveTask.java b/src/main/java/cf/witcheskitchen/common/entity/ai/task/DontMoveTask.java index 6ae6b57b..163e64d2 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/ai/task/DontMoveTask.java +++ b/src/main/java/cf/witcheskitchen/common/entity/ai/task/DontMoveTask.java @@ -6,11 +6,11 @@ import net.minecraft.entity.ai.brain.Brain; import net.minecraft.entity.ai.brain.MemoryModuleState; import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.Task; +import net.minecraft.entity.ai.brain.task.MultiTickTask; import net.minecraft.server.world.ServerWorld; -public class DontMoveTask extends Task { +public class DontMoveTask extends MultiTickTask { public DontMoveTask() { super(ImmutableMap.of(MemoryModuleType.WALK_TARGET, MemoryModuleState.REGISTERED, MemoryModuleType.LOOK_TARGET, MemoryModuleState.REGISTERED), Integer.MAX_VALUE); } diff --git a/src/main/java/cf/witcheskitchen/common/entity/ai/task/FerretMeleeAttackTask.java b/src/main/java/cf/witcheskitchen/common/entity/ai/task/FerretMeleeAttackTask.java index 0d9c04e0..7278f913 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/ai/task/FerretMeleeAttackTask.java +++ b/src/main/java/cf/witcheskitchen/common/entity/ai/task/FerretMeleeAttackTask.java @@ -6,10 +6,10 @@ import net.minecraft.entity.ai.brain.MemoryModuleState; import net.minecraft.entity.ai.brain.MemoryModuleType; import net.minecraft.entity.ai.brain.task.LookTargetUtil; -import net.minecraft.entity.ai.brain.task.Task; +import net.minecraft.entity.ai.brain.task.MultiTickTask; import net.minecraft.server.world.ServerWorld; -public class FerretMeleeAttackTask extends Task { +public class FerretMeleeAttackTask extends MultiTickTask { private final int interval; private LivingEntity target; private int coolDown = 0; @@ -25,7 +25,7 @@ public FerretMeleeAttackTask(int interval) { protected boolean shouldRun(ServerWorld serverWorld, FerretEntity ferret) { LivingEntity livingEntity = this.getAttackTarget(ferret); - return LookTargetUtil.isVisibleInMemory(ferret, livingEntity) && ferret.m_kxhmsdlh(livingEntity); + return LookTargetUtil.isVisibleInMemory(ferret, livingEntity) && ferret.isInAttackRange(livingEntity); } @Override diff --git a/src/main/java/cf/witcheskitchen/common/entity/ai/task/FollowOwnerTask.java b/src/main/java/cf/witcheskitchen/common/entity/ai/task/FollowOwnerTask.java index f123f7ad..c74f3f2d 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/ai/task/FollowOwnerTask.java +++ b/src/main/java/cf/witcheskitchen/common/entity/ai/task/FollowOwnerTask.java @@ -3,14 +3,14 @@ import cf.witcheskitchen.common.registry.WKMemoryModuleTypes; import com.google.common.collect.ImmutableMap; import net.minecraft.entity.ai.brain.*; -import net.minecraft.entity.ai.brain.task.Task; +import net.minecraft.entity.ai.brain.task.MultiTickTask; import net.minecraft.entity.mob.PathAwareEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.world.ServerWorld; import java.util.Optional; -public class FollowOwnerTask extends Task { +public class FollowOwnerTask extends MultiTickTask { public FollowOwnerTask() { super(ImmutableMap.of( MemoryModuleType.LOOK_TARGET, MemoryModuleState.REGISTERED, diff --git a/src/main/java/cf/witcheskitchen/common/entity/hostile/CuSithEntity.java b/src/main/java/cf/witcheskitchen/common/entity/hostile/CuSithEntity.java index 849ad7bc..c48f537c 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/hostile/CuSithEntity.java +++ b/src/main/java/cf/witcheskitchen/common/entity/hostile/CuSithEntity.java @@ -4,12 +4,20 @@ import cf.witcheskitchen.common.entity.tameable.FerretEntity; import cf.witcheskitchen.common.registry.WKSoundEvents; import cf.witcheskitchen.common.registry.WKStatusEffects; +import mod.azure.azurelib.common.api.common.animatable.GeoEntity; +import mod.azure.azurelib.common.internal.common.constant.DefaultAnimations; +import mod.azure.azurelib.core.animatable.instance.AnimatableInstanceCache; +import mod.azure.azurelib.core.animatable.instance.SingletonAnimatableInstanceCache; +import mod.azure.azurelib.core.animation.AnimationState; +import mod.azure.azurelib.core.animation.*; +import mod.azure.azurelib.core.object.PlayState; import net.minecraft.block.BlockState; import net.minecraft.entity.*; import net.minecraft.entity.ai.goal.*; import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.damage.DamageTypes; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.mob.*; @@ -17,6 +25,8 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.tag.DamageTypeTags; +import net.minecraft.registry.tag.EntityTypeTags; import net.minecraft.registry.tag.TagKey; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundEvent; @@ -27,13 +37,6 @@ import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.constant.DefaultAnimations; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animatable.instance.SingletonAnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.animation.*; -import software.bernie.geckolib.core.object.PlayState; import java.util.Random; import java.util.SplittableRandom; @@ -82,30 +85,20 @@ protected void initGoals() { this.goalSelector.add(2, new MeleeAttackGoal(this, 1, true)); this.goalSelector.add(4, new StopAndLookAtEntityGoal(this, MobEntity.class, 2.0f, 0.8f)); this.goalSelector.add(6, new WanderAroundFarGoal(this, 0.8D, 1)); - this.targetSelector.add(3, new TargetGoal<>(this, PlayerEntity.class, false)); - this.targetSelector.add(3, new TargetGoal<>(this, VillagerEntity.class, false)); - this.targetSelector.add(3, new TargetGoal<>(this, GolemEntity.class, false)); - this.targetSelector.add(3, new TargetGoal<>(this, WitchEntity.class, false)); - this.targetSelector.add(3, new TargetGoal<>(this, CowEntity.class, false)); - this.targetSelector.add(3, new TargetGoal<>(this, PiglinEntity.class, false)); - this.targetSelector.add(3, new TargetGoal<>(this, PiglinBruteEntity.class, false)); - this.targetSelector.add(3, new TargetGoal<>(this, SheepEntity.class, false)); - this.targetSelector.add(3, new TargetGoal<>(this, GoatEntity.class, false)); - this.targetSelector.add(3, new TargetGoal<>(this, FerretEntity.class, false)); - this.targetSelector.add(3, new TargetGoal<>(this, LivingEntity.class, 10, false, false, entity -> entity.getGroup() == EntityGroup.ILLAGER)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, PlayerEntity.class, false)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, VillagerEntity.class, false)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, GolemEntity.class, false)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, WitchEntity.class, false)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, CowEntity.class, false)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, PiglinEntity.class, false)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, PiglinBruteEntity.class, false)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, SheepEntity.class, false)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, GoatEntity.class, false)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, FerretEntity.class, false)); + this.targetSelector.add(3, new ActiveTargetGoal<>(this, LivingEntity.class, 10, false, false, entity -> entity.getType().isIn(EntityTypeTags.ILLAGER))); this.targetSelector.add(0, new RevengeGoal(this).setGroupRevenge()); } - @Override - public float getEyeHeight(EntityPose pose) { - return super.getEyeHeight(pose); - } - - @Override - public EntityGroup getGroup() { - return EntityGroup.UNDEAD; - } - @Override public boolean isPushable() { return false; @@ -114,7 +107,7 @@ public boolean isPushable() { @Override public void tick() { super.tick(); - if (!world.isClient && !hasCustomName() && world.isDay() && !world.isRaining() && !world.isThundering() && world.isSkyVisibleAllowingSea(getBlockPos())) { + if (!getWorld().isClient && !hasCustomName() && getWorld().isDay() && !getWorld().isRaining() && !getWorld().isThundering() && getWorld().isSkyVisibleAllowingSea(getBlockPos())) { remove(Entity.RemovalReason.KILLED); } } @@ -148,12 +141,12 @@ protected void swimUpward(TagKey fluid) { @Nullable @Override - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable NbtCompound entityNbt) { + public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData) { SplittableRandom random = new SplittableRandom(); int var = random.nextInt(0, 8); this.setVariant(var); this.dataTracker.set(VARIANT, random.nextInt(EYE_VARIANTS)); - return super.initialize(world, difficulty, spawnReason, entityData, entityNbt); + return super.initialize(world, difficulty, spawnReason, entityData); } @Override @@ -198,7 +191,7 @@ protected void playStepSound(BlockPos pos, BlockState state) { @Override public boolean damage(DamageSource source, float amount) { - if (source.isFallingBlock() || source.isFire() || source.isFromFalling()) { + if (source.isOf(DamageTypes.FALLING_BLOCK) || source.isIn(DamageTypeTags.IS_FIRE) || source.isIn(DamageTypeTags.IS_FALL)) { return false; } return super.damage(source, amount); @@ -209,16 +202,6 @@ public boolean isFireImmune() { return true; } - @Override - public boolean isUndead() { - return true; - } - - @Override - public boolean canBreatheInWater() { - return true; - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllers) { controllers.add(DefaultAnimations.genericIdleController(this), new AnimationController<>(this, "move", 20, this::legTransform)); diff --git a/src/main/java/cf/witcheskitchen/common/entity/hostile/RoggenwolfEntity.java b/src/main/java/cf/witcheskitchen/common/entity/hostile/RoggenwolfEntity.java index 38e2e5ed..63776c6a 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/hostile/RoggenwolfEntity.java +++ b/src/main/java/cf/witcheskitchen/common/entity/hostile/RoggenwolfEntity.java @@ -1,21 +1,23 @@ package cf.witcheskitchen.common.entity.hostile; -import cf.witcheskitchen.api.entity.WKCreatureTypeEnum; import cf.witcheskitchen.api.entity.WKHostileEntity; -import net.minecraft.entity.*; +import mod.azure.azurelib.common.api.common.animatable.GeoEntity; +import mod.azure.azurelib.core.animatable.instance.AnimatableInstanceCache; +import mod.azure.azurelib.core.animation.AnimatableManager; +import net.minecraft.entity.EntityData; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.SpawnReason; import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.damage.DamageTypes; import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.nbt.NbtCompound; import net.minecraft.util.math.MathHelper; import net.minecraft.world.LocalDifficulty; import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; import java.util.SplittableRandom; @@ -33,10 +35,10 @@ public static DefaultAttributeContainer.Builder createAttributes() { @Nullable @Override - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable NbtCompound entityNbt) { + public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData) { int var = new SplittableRandom().nextInt(1, 7); this.setVariant(var); - return super.initialize(world, difficulty, spawnReason, entityData, entityNbt); + return super.initialize(world, difficulty, spawnReason, entityData); } @Override @@ -67,11 +69,6 @@ public boolean isFireImmune() { return false; } - @Override - public boolean canBreatheInWater() { - return true; - } - @Override public boolean isPushable() { return true; @@ -79,7 +76,7 @@ public boolean isPushable() { @Override public boolean damage(DamageSource source, float amount) { - if (source.isFallingBlock()) { + if (source.isOf(DamageTypes.FALLING_BLOCK)) { return false; } return super.damage(source, amount); @@ -95,16 +92,11 @@ public boolean handleFallDamage(float fallDistance, float damageMultiplier, Dama public DamageSource getRecentDamageSource() { if (isOnFire()) { setOnFireFor(15); - this.applyDamage(DamageSource.ON_FIRE, 500); + this.applyDamage(this.getDamageSources().onFire(), 500); } return super.getRecentDamageSource(); } - @Override - public EntityGroup getGroup() { - return WKCreatureTypeEnum.DEMONIC; - } - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return null; diff --git a/src/main/java/cf/witcheskitchen/common/entity/neutral/ChurchGrimEntity.java b/src/main/java/cf/witcheskitchen/common/entity/neutral/ChurchGrimEntity.java index 46f9d498..bb76b010 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/neutral/ChurchGrimEntity.java +++ b/src/main/java/cf/witcheskitchen/common/entity/neutral/ChurchGrimEntity.java @@ -1,19 +1,27 @@ package cf.witcheskitchen.common.entity.neutral; import cf.witcheskitchen.api.entity.WKTameableEntity; +import mod.azure.azurelib.common.api.common.animatable.GeoEntity; +import mod.azure.azurelib.common.internal.common.constant.DefaultAnimations; +import mod.azure.azurelib.common.internal.common.util.AzureLibUtil; +import mod.azure.azurelib.core.animatable.instance.AnimatableInstanceCache; +import mod.azure.azurelib.core.animation.AnimatableManager; import net.minecraft.block.BlockState; import net.minecraft.entity.*; import net.minecraft.entity.ai.goal.*; import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.damage.DamageTypes; import net.minecraft.entity.mob.Angerable; import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.passive.PassiveEntity; import net.minecraft.entity.passive.TameableEntity; import net.minecraft.fluid.Fluid; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.tag.DamageTypeTags; import net.minecraft.registry.tag.TagKey; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundEvent; @@ -24,11 +32,6 @@ import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.constant.DefaultAnimations; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.util.GeckoLibUtil; import java.util.SplittableRandom; import java.util.UUID; @@ -37,7 +40,7 @@ public class ChurchGrimEntity extends WKTameableEntity implements GeoEntity, Angerable, Tameable { private final int VARIANTS = 8; //Add a string or something here for a variant that is a white, short-haired dog and can appear if one is named Max - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final AnimatableInstanceCache cache = AzureLibUtil.createInstanceCache(this); public ChurchGrimEntity(EntityType entityType, World world) { super(entityType, world); @@ -67,11 +70,11 @@ public void setAngerTime(int ticks) { @Nullable @Override - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable NbtCompound entityNbt) { + public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData) { SplittableRandom random = new SplittableRandom(); int var = random.nextInt(0, 9); this.setVariant(var); - return super.initialize(world, difficulty, spawnReason, entityData, entityNbt); + return super.initialize(world, difficulty, spawnReason, entityData); } @Override @@ -119,16 +122,16 @@ public void writeCustomDataToNbt(NbtCompound nbt) { this.writeAngerToNbt(nbt); } - @Override - public float getEyeHeight(EntityPose pose) { - return super.getEyeHeight(pose); - } - @Override public void readCustomDataFromNbt(NbtCompound tag) { super.readCustomDataFromNbt(tag); this.setVariant(tag.getInt("Variant")); - this.readAngerFromNbt(this.world, tag); + this.readAngerFromNbt(this.getWorld(), tag); + } + + @Override + public boolean isBreedingItem(ItemStack stack) { + return false; } @Override @@ -168,14 +171,9 @@ public boolean isFireImmune() { return true; } - @Override - public boolean canBreatheInWater() { - return true; - } - @Override public boolean damage(DamageSource source, float amount) { - if (source.isFallingBlock() || source.isFire() || source.isFromFalling()) { + if (source.isOf(DamageTypes.FALLING_BLOCK) || source.isIn(DamageTypeTags.IS_FIRE) || source.isIn(DamageTypeTags.IS_FALL)) { return false; } return super.damage(source, amount); @@ -197,16 +195,6 @@ public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) { return null; } - @Override - public boolean isUndead() { - return true; - } - - @Override - public EntityGroup getGroup() { - return EntityGroup.UNDEAD; - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controller) { diff --git a/src/main/java/cf/witcheskitchen/common/entity/tameable/FerretEntity.java b/src/main/java/cf/witcheskitchen/common/entity/tameable/FerretEntity.java index 7a2554d2..f32801e6 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/tameable/FerretEntity.java +++ b/src/main/java/cf/witcheskitchen/common/entity/tameable/FerretEntity.java @@ -4,6 +4,12 @@ import cf.witcheskitchen.common.entity.ai.FerretBrain; import cf.witcheskitchen.common.registry.WKEntityTypes; import cf.witcheskitchen.common.registry.WKSoundEvents; +import mod.azure.azurelib.common.api.common.animatable.GeoEntity; +import mod.azure.azurelib.common.internal.common.constant.DefaultAnimations; +import mod.azure.azurelib.common.internal.common.util.AzureLibUtil; +import mod.azure.azurelib.core.animatable.instance.AnimatableInstanceCache; +import mod.azure.azurelib.core.animation.*; +import mod.azure.azurelib.core.object.PlayState; import net.minecraft.block.BlockState; import net.minecraft.entity.EntityData; import net.minecraft.entity.EntityType; @@ -41,12 +47,6 @@ import net.tslat.smartbrainlib.api.core.SmartBrainProvider; import net.tslat.smartbrainlib.api.core.sensor.ExtendedSensor; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.constant.DefaultAnimations; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.*; -import software.bernie.geckolib.core.object.PlayState; -import software.bernie.geckolib.util.GeckoLibUtil; import java.util.List; import java.util.SplittableRandom; @@ -58,11 +58,11 @@ public class FerretEntity extends WKTameableEntity implements GeoEntity, SmartBr public static final TrackedData NIGHT = DataTracker.registerData(FerretEntity.class, TrackedDataHandlerRegistry.BOOLEAN); public static final Ingredient BREEDING_INGREDIENTS = Ingredient.ofItems(Items.RABBIT, Items.COOKED_RABBIT, Items.CHICKEN, Items.COOKED_CHICKEN, Items.EGG, Items.RABBIT_FOOT, Items.TURTLE_EGG); public static final Item TAMING_INGREDIENT = Items.EGG; - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final AnimatableInstanceCache cache = AzureLibUtil.createInstanceCache(this); public FerretEntity(EntityType entityType, World world) { super(entityType, world); - this.setTamed(false); + this.setTamed(false, true); } public static DefaultAttributeContainer.Builder createAttributes() { @@ -79,10 +79,10 @@ protected Brain.Profile createBrainProfile() { @Nullable @Override - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable NbtCompound entityNbt) { + public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData) { int var = new SplittableRandom().nextInt(1, 13); this.setVariant(var); - return super.initialize(world, difficulty, spawnReason, entityData, entityNbt); + return super.initialize(world, difficulty, spawnReason, entityData); } @Override @@ -97,8 +97,8 @@ protected void mobTick() { @Override protected void initDataTracker() { super.initDataTracker(); - this.dataTracker.startTracking(NIGHT, false); - this.dataTracker.startTracking(TARGET_ID, 0); + this.dataTracker.set(NIGHT, false); + this.dataTracker.set(TARGET_ID, 0); } @Override @@ -122,7 +122,7 @@ public void setTarget(@Nullable LivingEntity target) { @Nullable public LivingEntity getTargetFromData() { - return this.world.getEntityById(this.getDataTracker().get(TARGET_ID)) instanceof LivingEntity livingEntity ? livingEntity : null; + return this.getWorld().getEntityById(this.getDataTracker().get(TARGET_ID)) instanceof LivingEntity livingEntity ? livingEntity : null; } @Override @@ -142,27 +142,27 @@ public void readCustomDataFromNbt(NbtCompound nbt) { public ActionResult interactMob(PlayerEntity player, Hand hand) { final ItemStack stack = player.getStackInHand(hand); if (!isTamed() && stack.isOf(TAMING_INGREDIENT)) { - if (world.isClient()) { + if (getWorld().isClient()) { return ActionResult.CONSUME; } else { if (!player.isCreative()) { stack.decrement(1); } - if (!world.isClient()) { + if (!getWorld().isClient()) { if (this.random.nextInt(3) == 0) { super.setOwner(player); this.navigation.recalculatePath(); this.setTarget(null); setSitting(true); - this.world.sendEntityStatus(this, (byte) 7); + this.getWorld().sendEntityStatus(this, (byte) 7); } else { - this.world.sendEntityStatus(this, (byte) 6); + this.getWorld().sendEntityStatus(this, (byte) 6); } } return ActionResult.SUCCESS; } } - if (isTamed() && !this.world.isClient() && hand == Hand.MAIN_HAND) { + if (isTamed() && !this.getWorld().isClient() && hand == Hand.MAIN_HAND) { setSitting(!isSitting()); return ActionResult.SUCCESS; } @@ -180,7 +180,7 @@ public int getVariants() { @Override public boolean damage(DamageSource source, float amount) { boolean bl = super.damage(source, amount); - if (this.world.isClient) { + if (this.getWorld().isClient) { return false; } else { if (bl && source.getAttacker() instanceof LivingEntity l) { @@ -209,13 +209,13 @@ public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) { UUID uUID = this.getOwnerUuid(); if (uUID != null && ferretEntity != null) { ferretEntity.setOwnerUuid(uUID); - ferretEntity.setTamed(true); + ferretEntity.setTamed(true, true); } return ferretEntity; } @Override - public boolean canBeLeashedBy(PlayerEntity player) { + public boolean canBeLeashed() { return true; } diff --git a/src/main/java/cf/witcheskitchen/common/entity/tameable/HedgehogEntity.java b/src/main/java/cf/witcheskitchen/common/entity/tameable/HedgehogEntity.java index 3048988c..92d2c3cc 100644 --- a/src/main/java/cf/witcheskitchen/common/entity/tameable/HedgehogEntity.java +++ b/src/main/java/cf/witcheskitchen/common/entity/tameable/HedgehogEntity.java @@ -3,6 +3,15 @@ import cf.witcheskitchen.api.entity.WKTameableEntity; import cf.witcheskitchen.common.entity.ai.HedgehogBrain; import cf.witcheskitchen.common.registry.WKEntityTypes; +import mod.azure.azurelib.common.api.common.animatable.GeoEntity; +import mod.azure.azurelib.common.internal.common.constant.DefaultAnimations; +import mod.azure.azurelib.common.internal.common.util.AzureLibUtil; +import mod.azure.azurelib.core.animatable.instance.AnimatableInstanceCache; +import mod.azure.azurelib.core.animation.AnimatableManager; +import mod.azure.azurelib.core.animation.AnimationController; +import mod.azure.azurelib.core.animation.AnimationState; +import mod.azure.azurelib.core.animation.RawAnimation; +import mod.azure.azurelib.core.object.PlayState; import net.minecraft.entity.EntityData; import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnReason; @@ -12,7 +21,7 @@ import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.passive.PassiveEntity; import net.minecraft.entity.passive.TameableEntity; -import net.minecraft.nbt.NbtCompound; +import net.minecraft.item.ItemStack; import net.minecraft.server.world.ServerWorld; import net.minecraft.world.LocalDifficulty; import net.minecraft.world.ServerWorldAccess; @@ -22,26 +31,17 @@ import net.tslat.smartbrainlib.api.core.SmartBrainProvider; import net.tslat.smartbrainlib.api.core.sensor.ExtendedSensor; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.constant.DefaultAnimations; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.animation.RawAnimation; -import software.bernie.geckolib.core.object.PlayState; -import software.bernie.geckolib.util.GeckoLibUtil; import java.util.List; import java.util.SplittableRandom; import java.util.UUID; public class HedgehogEntity extends WKTameableEntity implements GeoEntity, SmartBrainOwner { - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final AnimatableInstanceCache cache = AzureLibUtil.createInstanceCache(this); public HedgehogEntity(EntityType entityType, World world) { super(entityType, world); - this.setTamed(false); + this.setTamed(false, true); } public static DefaultAttributeContainer.Builder createAttributes() { @@ -61,12 +61,17 @@ protected void mobTick() { tickBrain(this); } + @Override + public boolean isBreedingItem(ItemStack stack) { + return false; + } + @Nullable @Override - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable NbtCompound entityNbt) { + public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData) { int var = new SplittableRandom().nextInt(1, 7); this.setVariant(var); - return super.initialize(world, difficulty, spawnReason, entityData, entityNbt); + return super.initialize(world, difficulty, spawnReason, entityData); } @Override @@ -81,7 +86,7 @@ public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) { UUID uUID = this.getOwnerUuid(); if (uUID != null && hedgehogEntity != null) { hedgehogEntity.setOwnerUuid(uUID); - hedgehogEntity.setTamed(true); + hedgehogEntity.setTamed(true, true); } return hedgehogEntity; } diff --git a/src/main/java/cf/witcheskitchen/common/event/WKEventsHandler.java b/src/main/java/cf/witcheskitchen/common/event/WKEventsHandler.java index 5b928388..71e99fd2 100644 --- a/src/main/java/cf/witcheskitchen/common/event/WKEventsHandler.java +++ b/src/main/java/cf/witcheskitchen/common/event/WKEventsHandler.java @@ -1,15 +1,15 @@ package cf.witcheskitchen.common.event; import cf.witcheskitchen.WitchesKitchen; -import net.fabricmc.fabric.api.loot.v2.LootTableEvents; -import net.fabricmc.fabric.api.loot.v2.LootTableSource; +import net.fabricmc.fabric.api.loot.v3.LootTableEvents; +import net.fabricmc.fabric.api.loot.v3.LootTableSource; import net.minecraft.block.Blocks; -import net.minecraft.loot.LootManager; import net.minecraft.loot.LootPool; import net.minecraft.loot.LootTable; import net.minecraft.loot.entry.LootTableEntry; -import net.minecraft.resource.ResourceManager; -import net.minecraft.util.Identifier; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryWrapper; public class WKEventsHandler { /** @@ -21,11 +21,11 @@ public class WKEventsHandler { */ public static class LootTablesListener implements LootTableEvents.Modify { @Override - public void modifyLootTable(ResourceManager resourceManager, LootManager lootManager, Identifier id, LootTable.Builder tableBuilder, LootTableSource source) { - final Identifier grassLootTable = Blocks.GRASS.getLootTableId(); - final Identifier tallGrassLootTable = Blocks.TALL_GRASS.getLootTableId(); - final Identifier seedsAddition = WitchesKitchen.id("listener/seeds"); - if (id.equals(grassLootTable) || id.equals(tallGrassLootTable)) { + public void modifyLootTable(RegistryKey key, LootTable.Builder tableBuilder, LootTableSource source, RegistryWrapper.WrapperLookup registries) { + final RegistryKey grassLootTable = Blocks.SHORT_GRASS.getLootTableKey(); + final RegistryKey tallGrassLootTable = Blocks.TALL_GRASS.getLootTableKey(); + final RegistryKey seedsAddition = RegistryKey.of(RegistryKeys.LOOT_TABLE, WitchesKitchen.id("listener/seeds")); + if (key.equals(grassLootTable) || key.equals(tallGrassLootTable)) { // Adds a new entry for grass and tall grass loot tables tableBuilder.pool(LootPool.builder().with(LootTableEntry.builder(seedsAddition).weight(1)).build()); } diff --git a/src/main/java/cf/witcheskitchen/common/event/WKItemGroupEvents.java b/src/main/java/cf/witcheskitchen/common/event/WKItemGroupEvents.java index a7097900..97506f3f 100644 --- a/src/main/java/cf/witcheskitchen/common/event/WKItemGroupEvents.java +++ b/src/main/java/cf/witcheskitchen/common/event/WKItemGroupEvents.java @@ -8,230 +8,245 @@ import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.text.Text; import static cf.witcheskitchen.common.registry.WKBlocks.*; import static cf.witcheskitchen.common.registry.WKItems.*; public class WKItemGroupEvents { - public static final ItemGroup GENERAL_TAB = FabricItemGroup.builder(WitchesKitchen.id("general")).icon(() -> new ItemStack(WKBlocks.IRON_WITCHES_OVEN.asItem())).build(); - public static final ItemGroup FOOD_TAB = FabricItemGroup.builder(WitchesKitchen.id("food")).icon(() -> new ItemStack(WKItems.ELDER_TEA)).build(); + public static final RegistryKey GENERAL_TAB = RegistryKey.of(RegistryKeys.ITEM_GROUP, WitchesKitchen.id("general")); + public static final RegistryKey FOOD_TAB = RegistryKey.of(RegistryKeys.ITEM_GROUP, WitchesKitchen.id("food")); public static void init() { + Registry.register(Registries.ITEM_GROUP, GENERAL_TAB, FabricItemGroup.builder() + .displayName(Text.translatable(GENERAL_TAB.getValue().toTranslationKey("itemGroup"))) + .icon(() -> new ItemStack(WKBlocks.IRON_WITCHES_OVEN.asItem())) + .build() + ); + Registry.register(Registries.ITEM_GROUP, FOOD_TAB, FabricItemGroup.builder() + .displayName(Text.translatable(FOOD_TAB.getValue().toTranslationKey("itemGroup"))) + .icon(() -> new ItemStack(WKItems.ELDER_TEA)).build() + ); + ItemGroupEvents.modifyEntriesEvent(GENERAL_TAB).register(WKItemGroupEvents::generalGroup); ItemGroupEvents.modifyEntriesEvent(FOOD_TAB).register(WKItemGroupEvents::foodGroup); } private static void generalGroup(FabricItemGroupEntries e) { - e.addItem(CHALK); - e.addItem(ENCHANTED_CHALK); - e.addItem(BONE_NEEDLE); - e.addItem(TAGLOCK); - e.addItem(WAYSTONE); - e.addItem(SALT_BLOCK); - e.addItem(HEART_OF_INNOCENCE); - - e.addItem(BELLADONNA_BLOSSOM); - e.addItem(WORMWOOD_SPRIG); - e.addItem(ELDER_BLOSSOM); - e.addItem(CONEFLOWER_BLOSSOM); - e.addItem(SANGUINARY_BLOSSOM); - e.addItem(ST_JOHNS_WORT_BLOSSOM); - e.addItem(IRIS_BLOSSOM); - e.addItem(CHAMOMILE_BLOSSOM); - e.addItem(GINGER_ROOTS); - e.addItem(HELLEBORE_BLOSSOM); - e.addItem(FOXGLOVE_BLOSSOM); - - e.addItem(CALEFACTION_BUNDLE); - e.addItem(CURSE_OF_MIDAS_BUNDLE); - e.addItem(FEAR_BUNDLE); - e.addItem(FIELD_GEISTER_HEX_BUNDLE); - e.addItem(HUNGRY_POCKETS_BUNDLE); - e.addItem(INEPTITUDE_BUNDLE); - e.addItem(MISPLACEMENT_BUNDLE); - e.addItem(NULLARDOR_BUNDLE); - e.addItem(PARANOIA_BUNDLE); - e.addItem(PERUNS_JEST_BUNDLE); - - e.addItem(AMARANTH_SEEDS); - e.addItem(BELLADONNA_SEEDS); - e.addItem(BRIAR_SEEDS); - e.addItem(CAMELLIA_SEEDS); - e.addItem(CHAMOMILE_SEEDS); - e.addItem(CONEFLOWER_SEEDS); - e.addItem(FOXGLOVE_SEEDS); - e.addItem(HELLEBORE_SEEDS); - e.addItem(IRIS_SEEDS); - e.addItem(SANGUINARY_SEEDS); - e.addItem(ST_JOHNS_WORT_SEEDS); - e.addItem(WORMWOOD_SEEDS); - - e.addItem(BLACKTHORN_LOG); - e.addItem(BLACKTHORN_WOOD); - e.addItem(STRIPPED_BLACKTHORN_LOG); - e.addItem(STRIPPED_BLACKTHORN_WOOD); - e.addItem(BLACKTHORN_PLANKS); - e.addItem(BLACKTHORN_STAIRS); - e.addItem(BLACKTHORN_SLAB); - e.addItem(BLACKTHORN_FENCE); - e.addItem(BLACKTHORN_FENCE_GATE); - e.addItem(BLACKTHORN_DOOR); - e.addItem(BLACKTHORN_PRESSURE_PLATE); - e.addItem(BLACKTHORN_BUTTON); - e.addItem(BLACKTHORN_LEAVES); - e.addItem(BLACKTHORN_SAPLING); - - e.addItem(ELDER_LOG); - e.addItem(ELDER_WOOD); - e.addItem(STRIPPED_ELDER_LOG); - e.addItem(STRIPPED_ELDER_WOOD); - e.addItem(ELDER_PLANKS); - e.addItem(ELDER_STAIRS); - e.addItem(ELDER_SLAB); - e.addItem(ELDER_FENCE); - e.addItem(ELDER_FENCE_GATE); - e.addItem(ELDER_DOOR); - e.addItem(ELDER_PRESSURE_PLATE); - e.addItem(ELDER_BUTTON); - e.addItem(ELDER_LEAVES); - e.addItem(ELDER_SAPLING); - - e.addItem(HAWTHORN_LOG); - e.addItem(HAWTHORN_WOOD); - e.addItem(STRIPPED_HAWTHORN_LOG); - e.addItem(STRIPPED_HAWTHORN_WOOD); - e.addItem(HAWTHORN_PLANKS); - e.addItem(HAWTHORN_STAIRS); - e.addItem(HAWTHORN_SLAB); - e.addItem(HAWTHORN_FENCE); - e.addItem(HAWTHORN_FENCE_GATE); - e.addItem(HAWTHORN_DOOR); - e.addItem(HAWTHORN_PRESSURE_PLATE); - e.addItem(HAWTHORN_BUTTON); - e.addItem(HAWTHORN_LEAVES); - e.addItem(HAWTHORN_SAPLING); - - e.addItem(JUNIPER_LOG); - e.addItem(JUNIPER_WOOD); - e.addItem(STRIPPED_JUNIPER_LOG); - e.addItem(STRIPPED_JUNIPER_WOOD); - e.addItem(JUNIPER_PLANKS); - e.addItem(JUNIPER_STAIRS); - e.addItem(JUNIPER_SLAB); - e.addItem(JUNIPER_FENCE); - e.addItem(JUNIPER_FENCE_GATE); - e.addItem(JUNIPER_DOOR); - e.addItem(JUNIPER_PRESSURE_PLATE); - e.addItem(JUNIPER_BUTTON); - e.addItem(JUNIPER_LEAVES); - e.addItem(JUNIPER_SAPLING); - - e.addItem(ROWAN_LOG); - e.addItem(ROWAN_WOOD); - e.addItem(STRIPPED_ROWAN_LOG); - e.addItem(STRIPPED_ROWAN_WOOD); - e.addItem(ROWAN_PLANKS); - e.addItem(ROWAN_STAIRS); - e.addItem(ROWAN_SLAB); - e.addItem(ROWAN_FENCE); - e.addItem(ROWAN_FENCE_GATE); - e.addItem(ROWAN_DOOR); - e.addItem(ROWAN_PRESSURE_PLATE); - e.addItem(ROWAN_BUTTON); - e.addItem(ROWAN_LEAVES); - e.addItem(ROWAN_SAPLING); - - e.addItem(SUMAC_LOG); - e.addItem(SUMAC_WOOD); - e.addItem(STRIPPED_SUMAC_LOG); - e.addItem(STRIPPED_SUMAC_WOOD); - e.addItem(SUMAC_PLANKS); - e.addItem(SUMAC_STAIRS); - e.addItem(SUMAC_SLAB); - e.addItem(SUMAC_FENCE); - e.addItem(SUMAC_FENCE_GATE); - e.addItem(SUMAC_DOOR); - e.addItem(SUMAC_PRESSURE_PLATE); - e.addItem(SUMAC_BUTTON); - e.addItem(SUMAC_LEAVES); - e.addItem(SUMAC_SAPLING); - - e.addItem(TEAPOT); - e.addItem(CAST_IRON_TEAPOT); - e.addItem(COPPER_TEAPOT); - e.addItem(WAXED_COPPER_TEAPOT); - e.addItem(EXPOSED_COPPER_TEAPOT); - e.addItem(WAXED_EXPOSED_COPPER_TEAPOT); - e.addItem(WEATHERED_COPPER_TEAPOT); - e.addItem(WAXED_WEATHERED_COPPER_TEAPOT); - e.addItem(OXIDIZED_COPPER_TEAPOT); - e.addItem(WAXED_OXIDIZED_COPPER_TEAPOT); - - e.addItem(IRON_WITCHES_OVEN); - e.addItem(COPPER_WITCHES_OVEN); - e.addItem(WAXED_COPPER_WITCHES_OVEN); - e.addItem(EXPOSED_COPPER_WITCHES_OVEN); - e.addItem(WAXED_EXPOSED_COPPER_WITCHES_OVEN); - e.addItem(WEATHERED_COPPER_WITCHES_OVEN); - e.addItem(WAXED_WEATHERED_COPPER_WITCHES_OVEN); - e.addItem(OXIDIZED_COPPER_WITCHES_OVEN); - e.addItem(WAXED_OXIDIZED_COPPER_WITCHES_OVEN); - e.addItem(IRON_WITCHES_CAULDRON); - e.addItem(OAK_BREWING_BARREL); - e.addItem(SPRUCE_BREWING_BARREL); - e.addItem(BIRCH_BREWING_BARREL); - e.addItem(JUNGLE_BREWING_BARREL); - e.addItem(ACACIA_BREWING_BARREL); - e.addItem(DARK_OAK_BREWING_BARREL); - e.addItem(CRIMSON_BREWING_BARREL); - e.addItem(WARPED_BREWING_BARREL); - - e.addItem(CU_SITH_SPAWN_EGG); - e.addItem(CHURCH_GRIM_SPAWN_EGG); - e.addItem(FERRET_SPAWN_EGG); - e.addItem(HEDGEHOG_SPAWN_EGG); - e.addItem(ROGGENWOLF_SPAWN_EGG); + e.add(CHALK); + e.add(ENCHANTED_CHALK); + e.add(BONE_NEEDLE); + e.add(TAGLOCK); + e.add(WAYSTONE); + e.add(SALT_BLOCK); + e.add(HEART_OF_INNOCENCE); + + e.add(BELLADONNA_BLOSSOM); + e.add(WORMWOOD_SPRIG); + e.add(ELDER_BLOSSOM); + e.add(CONEFLOWER_BLOSSOM); + e.add(SANGUINARY_BLOSSOM); + e.add(ST_JOHNS_WORT_BLOSSOM); + e.add(IRIS_BLOSSOM); + e.add(CHAMOMILE_BLOSSOM); + e.add(GINGER_ROOTS); + e.add(HELLEBORE_BLOSSOM); + e.add(FOXGLOVE_BLOSSOM); + + e.add(CALEFACTION_BUNDLE); + e.add(CURSE_OF_MIDAS_BUNDLE); + e.add(FEAR_BUNDLE); + e.add(FIELD_GEISTER_HEX_BUNDLE); + e.add(HUNGRY_POCKETS_BUNDLE); + e.add(INEPTITUDE_BUNDLE); + e.add(MISPLACEMENT_BUNDLE); + e.add(NULLARDOR_BUNDLE); + e.add(PARANOIA_BUNDLE); + e.add(PERUNS_JEST_BUNDLE); + + e.add(AMARANTH_SEEDS); + e.add(BELLADONNA_SEEDS); + e.add(BRIAR_SEEDS); + e.add(CAMELLIA_SEEDS); + e.add(CHAMOMILE_SEEDS); + e.add(CONEFLOWER_SEEDS); + e.add(FOXGLOVE_SEEDS); + e.add(HELLEBORE_SEEDS); + e.add(IRIS_SEEDS); + e.add(SANGUINARY_SEEDS); + e.add(ST_JOHNS_WORT_SEEDS); + e.add(WORMWOOD_SEEDS); + + e.add(BLACKTHORN_LOG); + e.add(BLACKTHORN_WOOD); + e.add(STRIPPED_BLACKTHORN_LOG); + e.add(STRIPPED_BLACKTHORN_WOOD); + e.add(BLACKTHORN_PLANKS); + e.add(BLACKTHORN_STAIRS); + e.add(BLACKTHORN_SLAB); + e.add(BLACKTHORN_FENCE); + e.add(BLACKTHORN_FENCE_GATE); + e.add(BLACKTHORN_DOOR); + e.add(BLACKTHORN_PRESSURE_PLATE); + e.add(BLACKTHORN_BUTTON); + e.add(BLACKTHORN_LEAVES); + e.add(BLACKTHORN_SAPLING); + + e.add(ELDER_LOG); + e.add(ELDER_WOOD); + e.add(STRIPPED_ELDER_LOG); + e.add(STRIPPED_ELDER_WOOD); + e.add(ELDER_PLANKS); + e.add(ELDER_STAIRS); + e.add(ELDER_SLAB); + e.add(ELDER_FENCE); + e.add(ELDER_FENCE_GATE); + e.add(ELDER_DOOR); + e.add(ELDER_PRESSURE_PLATE); + e.add(ELDER_BUTTON); + e.add(ELDER_LEAVES); + e.add(ELDER_SAPLING); + + e.add(HAWTHORN_LOG); + e.add(HAWTHORN_WOOD); + e.add(STRIPPED_HAWTHORN_LOG); + e.add(STRIPPED_HAWTHORN_WOOD); + e.add(HAWTHORN_PLANKS); + e.add(HAWTHORN_STAIRS); + e.add(HAWTHORN_SLAB); + e.add(HAWTHORN_FENCE); + e.add(HAWTHORN_FENCE_GATE); + e.add(HAWTHORN_DOOR); + e.add(HAWTHORN_PRESSURE_PLATE); + e.add(HAWTHORN_BUTTON); + e.add(HAWTHORN_LEAVES); + e.add(HAWTHORN_SAPLING); + + e.add(JUNIPER_LOG); + e.add(JUNIPER_WOOD); + e.add(STRIPPED_JUNIPER_LOG); + e.add(STRIPPED_JUNIPER_WOOD); + e.add(JUNIPER_PLANKS); + e.add(JUNIPER_STAIRS); + e.add(JUNIPER_SLAB); + e.add(JUNIPER_FENCE); + e.add(JUNIPER_FENCE_GATE); + e.add(JUNIPER_DOOR); + e.add(JUNIPER_PRESSURE_PLATE); + e.add(JUNIPER_BUTTON); + e.add(JUNIPER_LEAVES); + e.add(JUNIPER_SAPLING); + + e.add(ROWAN_LOG); + e.add(ROWAN_WOOD); + e.add(STRIPPED_ROWAN_LOG); + e.add(STRIPPED_ROWAN_WOOD); + e.add(ROWAN_PLANKS); + e.add(ROWAN_STAIRS); + e.add(ROWAN_SLAB); + e.add(ROWAN_FENCE); + e.add(ROWAN_FENCE_GATE); + e.add(ROWAN_DOOR); + e.add(ROWAN_PRESSURE_PLATE); + e.add(ROWAN_BUTTON); + e.add(ROWAN_LEAVES); + e.add(ROWAN_SAPLING); + + e.add(SUMAC_LOG); + e.add(SUMAC_WOOD); + e.add(STRIPPED_SUMAC_LOG); + e.add(STRIPPED_SUMAC_WOOD); + e.add(SUMAC_PLANKS); + e.add(SUMAC_STAIRS); + e.add(SUMAC_SLAB); + e.add(SUMAC_FENCE); + e.add(SUMAC_FENCE_GATE); + e.add(SUMAC_DOOR); + e.add(SUMAC_PRESSURE_PLATE); + e.add(SUMAC_BUTTON); + e.add(SUMAC_LEAVES); + e.add(SUMAC_SAPLING); + + e.add(TEAPOT); + e.add(CAST_IRON_TEAPOT); + e.add(COPPER_TEAPOT); + e.add(WAXED_COPPER_TEAPOT); + e.add(EXPOSED_COPPER_TEAPOT); + e.add(WAXED_EXPOSED_COPPER_TEAPOT); + e.add(WEATHERED_COPPER_TEAPOT); + e.add(WAXED_WEATHERED_COPPER_TEAPOT); + e.add(OXIDIZED_COPPER_TEAPOT); + e.add(WAXED_OXIDIZED_COPPER_TEAPOT); + + e.add(IRON_WITCHES_OVEN); + e.add(COPPER_WITCHES_OVEN); + e.add(WAXED_COPPER_WITCHES_OVEN); + e.add(EXPOSED_COPPER_WITCHES_OVEN); + e.add(WAXED_EXPOSED_COPPER_WITCHES_OVEN); + e.add(WEATHERED_COPPER_WITCHES_OVEN); + e.add(WAXED_WEATHERED_COPPER_WITCHES_OVEN); + e.add(OXIDIZED_COPPER_WITCHES_OVEN); + e.add(WAXED_OXIDIZED_COPPER_WITCHES_OVEN); + e.add(IRON_WITCHES_CAULDRON); + e.add(OAK_BREWING_BARREL); + e.add(SPRUCE_BREWING_BARREL); + e.add(BIRCH_BREWING_BARREL); + e.add(JUNGLE_BREWING_BARREL); + e.add(ACACIA_BREWING_BARREL); + e.add(DARK_OAK_BREWING_BARREL); + e.add(CRIMSON_BREWING_BARREL); + e.add(WARPED_BREWING_BARREL); + + e.add(CU_SITH_SPAWN_EGG); + e.add(CHURCH_GRIM_SPAWN_EGG); + e.add(FERRET_SPAWN_EGG); + e.add(HEDGEHOG_SPAWN_EGG); + e.add(ROGGENWOLF_SPAWN_EGG); } private static void foodGroup(FabricItemGroupEntries e) { - e.addItem(AMARANTH_SPRIG); - e.addItem(MINT_SPRIG); - e.addItem(ROWAN_BERRIES); - e.addItem(SLOE_BERRIES); - e.addItem(JUNIPER_BERRIES); - e.addItem(BLACKBERRY); - e.addItem(HAWTHORN_BERRIES); - e.addItem(SUMAC_BERRIES); - e.addItem(BRIAR_HIPS); - e.addItem(TEA_LEAF); - - e.addItem(BLACKBERRY_TEA); - e.addItem(CHAMOMILE_TEA); - e.addItem(DOGROSE_TEA); - e.addItem(ECHINACEA_TEA); - e.addItem(ELDER_TEA); - e.addItem(GINGER_TEA); - e.addItem(HAWTHORN_TEA); - e.addItem(ST_JOHNS_WORT_TEA); - e.addItem(MINT_TEA); - e.addItem(SUMAC_TEA); - e.addItem(YARROW_TEA); - - e.addItem(ABSINTHE); - e.addItem(BLACKBERRY_LIQUEUR); - e.addItem(BRINJEVEC); - e.addItem(HOLUNDERSEKT); - e.addItem(JUNIPER_MEAD); - e.addItem(RUM); - e.addItem(TRAVARICA); - e.addItem(GROUND_BEEF); - e.addItem(GROUND_MUTTON); - e.addItem(GROUND_PORK); - e.addItem(HEART_PIE); - e.addItem(ROOTS_PLATTER); - e.addItem(DEMONIC_STEW); - e.addItem(MEATY_STEW); - e.addItem(VEGETABLE_STEW); + e.add(AMARANTH_SPRIG); + e.add(MINT_SPRIG); + e.add(ROWAN_BERRIES); + e.add(SLOE_BERRIES); + e.add(JUNIPER_BERRIES); + e.add(BLACKBERRY); + e.add(HAWTHORN_BERRIES); + e.add(SUMAC_BERRIES); + e.add(BRIAR_HIPS); + e.add(TEA_LEAF); + + e.add(BLACKBERRY_TEA); + e.add(CHAMOMILE_TEA); + e.add(DOGROSE_TEA); + e.add(ECHINACEA_TEA); + e.add(ELDER_TEA); + e.add(GINGER_TEA); + e.add(HAWTHORN_TEA); + e.add(ST_JOHNS_WORT_TEA); + e.add(MINT_TEA); + e.add(SUMAC_TEA); + e.add(YARROW_TEA); + + e.add(ABSINTHE); + e.add(BLACKBERRY_LIQUEUR); + e.add(BRINJEVEC); + e.add(HOLUNDERSEKT); + e.add(JUNIPER_MEAD); + e.add(RUM); + e.add(TRAVARICA); + e.add(GROUND_BEEF); + e.add(GROUND_MUTTON); + e.add(GROUND_PORK); + e.add(HEART_PIE); + e.add(ROOTS_PLATTER); + e.add(DEMONIC_STEW); + e.add(MEATY_STEW); + e.add(VEGETABLE_STEW); } diff --git a/src/main/java/cf/witcheskitchen/common/item/ChalkItem.java b/src/main/java/cf/witcheskitchen/common/item/ChalkItem.java index 132444d4..5b852eb0 100644 --- a/src/main/java/cf/witcheskitchen/common/item/ChalkItem.java +++ b/src/main/java/cf/witcheskitchen/common/item/ChalkItem.java @@ -4,11 +4,11 @@ import cf.witcheskitchen.common.registry.WKBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockState; -import net.minecraft.client.item.TooltipContext; import net.minecraft.item.Item; import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; +import net.minecraft.item.tooltip.TooltipType; import net.minecraft.registry.Registries; import net.minecraft.sound.SoundCategory; import net.minecraft.text.Style; @@ -17,8 +17,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; -import org.quiltmc.loader.api.minecraft.ClientOnly; import java.util.List; @@ -52,9 +50,8 @@ public ActionResult useOnBlock(ItemUsageContext context) { return super.useOnBlock(context); } - @ClientOnly @Override - public void appendTooltip(ItemStack stack, @Nullable World world, List tooltip, TooltipContext context) { + public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { if (glyphType != null) { String name = Registries.BLOCK.getId(glyphType).getPath(); int rgb = glyphType == WKBlocks.ENCHANTED_GLYPH ? 0xD8EAB4 : 0xffffff; diff --git a/src/main/java/cf/witcheskitchen/common/item/CurseBundleItem.java b/src/main/java/cf/witcheskitchen/common/item/CurseBundleItem.java index 9e8dbab7..45be40a8 100644 --- a/src/main/java/cf/witcheskitchen/common/item/CurseBundleItem.java +++ b/src/main/java/cf/witcheskitchen/common/item/CurseBundleItem.java @@ -1,11 +1,9 @@ package cf.witcheskitchen.common.item; -import net.minecraft.client.item.TooltipContext; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.tooltip.TooltipType; import net.minecraft.text.Text; -import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; import java.util.List; @@ -18,8 +16,8 @@ public CurseBundleItem(Settings settings, int levels) { } @Override - public void appendTooltip(ItemStack stack, @Nullable World world, List tooltip, TooltipContext context) { + public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { tooltip.add(Text.translatable("tooltip.witcheskitchen.bundle.potency" + " " + levels)); - super.appendTooltip(stack, world, tooltip, context); + super.appendTooltip(stack, context, tooltip, type); } } diff --git a/src/main/java/cf/witcheskitchen/common/item/TaglockItem.java b/src/main/java/cf/witcheskitchen/common/item/TaglockItem.java index c1959fb2..69f3a698 100644 --- a/src/main/java/cf/witcheskitchen/common/item/TaglockItem.java +++ b/src/main/java/cf/witcheskitchen/common/item/TaglockItem.java @@ -1,12 +1,11 @@ package cf.witcheskitchen.common.item; -import net.minecraft.client.item.TooltipContext; +import cf.witcheskitchen.common.component.WKComponents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.tooltip.TooltipType; import net.minecraft.text.Style; import net.minecraft.text.Text; -import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; import java.util.List; @@ -16,9 +15,10 @@ public TaglockItem(Settings settings) { } @Override - public void appendTooltip(ItemStack stack, @Nullable World world, List tooltip, TooltipContext context) { - if (stack.hasNbt() && stack.getOrCreateNbt().contains("Name")) { - tooltip.add(Text.literal(stack.getOrCreateNbt().getString("Name")).setStyle(Style.EMPTY.withColor(0xF90C19))); + public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { + if (stack.contains(WKComponents.TAGLOCK)) { + var taglock = stack.get(WKComponents.TAGLOCK); + tooltip.add(Text.literal(taglock.name()).setStyle(Style.EMPTY.withColor(0xF90C19))); } } } diff --git a/src/main/java/cf/witcheskitchen/common/item/VariantSeedItem.java b/src/main/java/cf/witcheskitchen/common/item/VariantSeedItem.java index 6f4df806..fa4a4443 100644 --- a/src/main/java/cf/witcheskitchen/common/item/VariantSeedItem.java +++ b/src/main/java/cf/witcheskitchen/common/item/VariantSeedItem.java @@ -1,14 +1,15 @@ package cf.witcheskitchen.common.item; import cf.witcheskitchen.api.util.SeedTypeHelper; +import cf.witcheskitchen.common.component.WKComponents; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.FarmlandBlock; -import net.minecraft.client.item.TooltipContext; import net.minecraft.item.AliasedBlockItem; import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; +import net.minecraft.item.tooltip.TooltipType; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; @@ -30,8 +31,8 @@ public VariantSeedItem(Block block, Settings settings) { @Override protected BlockState getPlacementState(ItemPlacementContext context) { ItemStack itemStack = context.getStack(); - if (itemStack.hasNbt() && itemStack.getNbt().contains("Variant")) { - Optional blockState = SeedTypeHelper.getBlockFromNbt(itemStack.getNbt()); + if (itemStack.contains(WKComponents.SEED_TYPE)) { + Optional blockState = SeedTypeHelper.getBlockFromComponent(itemStack.get(WKComponents.SEED_TYPE)); if (blockState.isPresent() && this.canPlace(context, blockState.get().getDefaultState())) { return blockState.get().getDefaultState(); } @@ -52,11 +53,11 @@ public ActionResult useOnBlock(ItemUsageContext context) { } @Override - public void appendTooltip(ItemStack stack, @Nullable World world, List tooltip, TooltipContext context) { + public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { MutableText text = SeedTypeHelper.getSeedTypeText(stack); if (text != null) { tooltip.add(text); } - super.appendTooltip(stack, world, tooltip, context); + super.appendTooltip(stack, context, tooltip, type); } } diff --git a/src/main/java/cf/witcheskitchen/common/item/WaystoneItem.java b/src/main/java/cf/witcheskitchen/common/item/WaystoneItem.java index 1ce4428a..f2a94839 100644 --- a/src/main/java/cf/witcheskitchen/common/item/WaystoneItem.java +++ b/src/main/java/cf/witcheskitchen/common/item/WaystoneItem.java @@ -3,13 +3,13 @@ import cf.witcheskitchen.api.util.TextUtils; import cf.witcheskitchen.data.DimColorReloadListener; import com.mojang.datafixers.util.Pair; -import net.minecraft.client.item.TooltipContext; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; +import net.minecraft.network.packet.s2c.play.PositionFlag; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; import net.minecraft.server.MinecraftServer; @@ -20,12 +20,11 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.TeleportTarget; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import org.quiltmc.qsl.worldgen.dimension.api.QuiltDimensions; import java.util.List; +import java.util.Set; public class WaystoneItem extends Item { private static final int MAX_USE_TIME = 40; @@ -45,7 +44,7 @@ public ActionResult useOnBlock(ItemUsageContext context) { @Override public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { - if (!user.world.isClient()) { + if (!user.getWorld().isClient()) { bindEntityPosition(entity, stack); } return super.useOnEntity(stack, user, entity, hand); @@ -56,7 +55,9 @@ public void teleportToWaystoneLocation(World world, ItemStack waystone, Entity e BlockPos blockPos = getPosFromWaystone(waystone); ServerWorld toWorld = getDimFromWaystone(serverWorld, waystone); if (blockPos != null) { - QuiltDimensions.teleport(entity, toWorld != null ? toWorld : serverWorld, new TeleportTarget(new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()), entity.getVelocity(), entity.getYaw(), entity.getPitch())); + Vec3d center = blockPos.toBottomCenterPos(); + // TODO: is this correct? + entity.teleport(toWorld != null ? toWorld : serverWorld, center.x, center.y, center.z, Set.of(PositionFlag.X, PositionFlag.Y, PositionFlag.Z), entity.getYaw(), entity.getPitch()); } } } diff --git a/src/main/java/cf/witcheskitchen/common/registry/WKBlocks.java b/src/main/java/cf/witcheskitchen/common/registry/WKBlocks.java index 73bfccf8..e2e6f25f 100644 --- a/src/main/java/cf/witcheskitchen/common/registry/WKBlocks.java +++ b/src/main/java/cf/witcheskitchen/common/registry/WKBlocks.java @@ -18,11 +18,9 @@ import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.sound.SoundEvents; import net.minecraft.util.Identifier; import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.TreeFeatureConfig; -import org.quiltmc.qsl.block.extensions.api.QuiltBlockSettings; import java.util.*; @@ -79,59 +77,59 @@ public interface WKBlocks { Block BLACKTHORN_LEAVES = register("blackthorn_leaves", new BlackthornLeavesBlock(leavesSettings()), true); Block JUNIPER_LEAVES = registerLeaf("juniper_leaves"); Block ROWAN_LEAVES = registerLeaf("rowan_leaves"); - Block BLACKTHORN_DOOR = register("blackthorn_door", new DoorBlock(plankSettings(), SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE), true); - Block ELDER_DOOR = register("elder_door", new DoorBlock(plankSettings(), SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE), true); - Block HAWTHORN_DOOR = register("hawthorn_door", new DoorBlock(plankSettings(), SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE), true); - Block JUNIPER_DOOR = register("juniper_door", new DoorBlock(plankSettings(), SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE), true); - Block ROWAN_DOOR = register("rowan_door", new DoorBlock(plankSettings(), SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE), true); - Block SUMAC_DOOR = register("sumac_door", new DoorBlock(plankSettings(), SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE), true); + Block BLACKTHORN_DOOR = register("blackthorn_door", createDoorBlock(plankSettings()), true); + Block ELDER_DOOR = register("elder_door", createDoorBlock(plankSettings()), true); + Block HAWTHORN_DOOR = register("hawthorn_door", createDoorBlock(plankSettings()), true); + Block JUNIPER_DOOR = register("juniper_door", createDoorBlock(plankSettings()), true); + Block ROWAN_DOOR = register("rowan_door", createDoorBlock(plankSettings()), true); + Block SUMAC_DOOR = register("sumac_door", createDoorBlock(plankSettings()), true); Block BLACKTHORN_FENCE = register("blackthorn_fence", new FenceBlock(plankSettings()), true); Block ELDER_FENCE = register("elder_fence", new FenceBlock(plankSettings()), true); Block HAWTHORN_FENCE = register("hawthorn_fence", new FenceBlock(plankSettings()), true); Block JUNIPER_FENCE = register("juniper_fence", new FenceBlock(plankSettings()), true); Block ROWAN_FENCE = register("rowan_fence", new FenceBlock(plankSettings()), true); Block SUMAC_FENCE = register("sumac_fence", new FenceBlock(plankSettings()), true); - Block BLACKTHORN_FENCE_GATE = register("blackthorn_fence_gate", new FenceGateBlock(plankSettings(), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN), true); - Block ELDER_FENCE_GATE = register("elder_fence_gate", new FenceGateBlock(plankSettings(), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN), true); - Block HAWTHORN_FENCE_GATE = register("hawthorn_fence_gate", new FenceGateBlock(plankSettings(), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN), true); - Block JUNIPER_FENCE_GATE = register("juniper_fence_gate", new FenceGateBlock(plankSettings(), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN), true); - Block ROWAN_FENCE_GATE = register("rowan_fence_gate", new FenceGateBlock(plankSettings(), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN), true); - Block SUMAC_FENCE_GATE = register("sumac_fence_gate", new FenceGateBlock(plankSettings(), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN), true); - Block BLACKTHORN_PRESSURE_PLATE = register("blackthorn_pressure_plate", new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, plankSettings(), SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON), true); - Block ELDER_PRESSURE_PLATE = register("elder_pressure_plate", new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, plankSettings(), SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON), true); - Block HAWTHORN_PRESSURE_PLATE = register("hawthorn_pressure_plate", new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, plankSettings(), SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON), true); - Block JUNIPER_PRESSURE_PLATE = register("juniper_pressure_plate", new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, plankSettings(), SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON), true); - Block ROWAN_PRESSURE_PLATE = register("rowan_pressure_plate", new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, plankSettings(), SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON), true); - Block SUMAC_PRESSURE_PLATE = register("sumac_pressure_plate", new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, plankSettings(), SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON), true); - Block BLACKTHORN_BUTTON = register("blackthorn_button", new AbstractButtonBlock(plankSettings(), 30, true, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON), true); - Block ELDER_BUTTON = register("elder_button", new AbstractButtonBlock(plankSettings(), 30, true, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON), true); - Block HAWTHORN_BUTTON = register("hawthorn_button", new AbstractButtonBlock(plankSettings(), 30, true, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON), true); - Block JUNIPER_BUTTON = register("juniper_button", new AbstractButtonBlock(plankSettings(), 30, true, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON), true); - Block ROWAN_BUTTON = register("rowan_button", new AbstractButtonBlock(plankSettings(), 30, true, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON), true); - Block SUMAC_BUTTON = register("sumac_button", new AbstractButtonBlock(plankSettings(), 30, true, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON), true); + Block BLACKTHORN_FENCE_GATE = register("blackthorn_fence_gate", new FenceGateBlock(WoodType.OAK, plankSettings()), true); + Block ELDER_FENCE_GATE = register("elder_fence_gate", new FenceGateBlock(WoodType.OAK, plankSettings()), true); + Block HAWTHORN_FENCE_GATE = register("hawthorn_fence_gate", new FenceGateBlock(WoodType.OAK, plankSettings()), true); + Block JUNIPER_FENCE_GATE = register("juniper_fence_gate", new FenceGateBlock(WoodType.OAK, plankSettings()), true); + Block ROWAN_FENCE_GATE = register("rowan_fence_gate", new FenceGateBlock(WoodType.OAK, plankSettings()), true); + Block SUMAC_FENCE_GATE = register("sumac_fence_gate", new FenceGateBlock(WoodType.OAK, plankSettings()), true); + Block BLACKTHORN_PRESSURE_PLATE = register("blackthorn_pressure_plate", new PressurePlateBlock(BlockSetType.OAK, plankSettings()), true); + Block ELDER_PRESSURE_PLATE = register("elder_pressure_plate", new PressurePlateBlock(BlockSetType.OAK, plankSettings()), true); + Block HAWTHORN_PRESSURE_PLATE = register("hawthorn_pressure_plate", new PressurePlateBlock(BlockSetType.OAK, plankSettings()), true); + Block JUNIPER_PRESSURE_PLATE = register("juniper_pressure_plate", new PressurePlateBlock(BlockSetType.OAK, plankSettings()), true); + Block ROWAN_PRESSURE_PLATE = register("rowan_pressure_plate", new PressurePlateBlock(BlockSetType.OAK, plankSettings()), true); + Block SUMAC_PRESSURE_PLATE = register("sumac_pressure_plate", new PressurePlateBlock(BlockSetType.OAK, plankSettings()), true); + Block BLACKTHORN_BUTTON = register("blackthorn_button", new ButtonBlock(BlockSetType.OAK, 30, plankSettings()), true); + Block ELDER_BUTTON = register("elder_button", new ButtonBlock(BlockSetType.OAK, 30, plankSettings()), true); + Block HAWTHORN_BUTTON = register("hawthorn_button", new ButtonBlock(BlockSetType.OAK, 30, plankSettings()), true); + Block JUNIPER_BUTTON = register("juniper_button", new ButtonBlock(BlockSetType.OAK, 30, plankSettings()), true); + Block ROWAN_BUTTON = register("rowan_button", new ButtonBlock(BlockSetType.OAK, 30, plankSettings()), true); + Block SUMAC_BUTTON = register("sumac_button", new ButtonBlock(BlockSetType.OAK, 30, plankSettings()), true); //Tile Entities - Block TEAPOT = register("teapot", new TeapotBlock(QuiltBlockSettings.copyOf(Blocks.TERRACOTTA).nonOpaque()), true); - Block CAST_IRON_TEAPOT = register("cast_iron_teapot", new TeapotBlock(QuiltBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()), true); - Block COPPER_TEAPOT = register("copper_teapot", new CopperTeapotBlock(QuiltBlockSettings.copyOf(Blocks.COPPER_BLOCK).nonOpaque(), Oxidizable.OxidizationLevel.UNAFFECTED), true); - Block WAXED_COPPER_TEAPOT = register("waxed_copper_teapot", new TeapotBlock(QuiltBlockSettings.copyOf(Blocks.COPPER_BLOCK).nonOpaque()), true); - Block EXPOSED_COPPER_TEAPOT = register("exposed_copper_teapot", new CopperTeapotBlock(QuiltBlockSettings.copyOf(Blocks.EXPOSED_COPPER).nonOpaque(), Oxidizable.OxidizationLevel.EXPOSED), true); - Block WAXED_EXPOSED_COPPER_TEAPOT = register("waxed_exposed_copper_teapot", new TeapotBlock(QuiltBlockSettings.copyOf(Blocks.COPPER_BLOCK).nonOpaque()), true); - Block WEATHERED_COPPER_TEAPOT = register("weathered_copper_teapot", new CopperTeapotBlock(QuiltBlockSettings.copyOf(Blocks.WEATHERED_COPPER).nonOpaque(), Oxidizable.OxidizationLevel.WEATHERED), true); - Block WAXED_WEATHERED_COPPER_TEAPOT = register("waxed_weathered_copper_teapot", new TeapotBlock(QuiltBlockSettings.copyOf(Blocks.COPPER_BLOCK).nonOpaque()), true); - Block OXIDIZED_COPPER_TEAPOT = register("oxidized_copper_teapot", new CopperTeapotBlock(QuiltBlockSettings.copyOf(Blocks.OXIDIZED_COPPER).nonOpaque(), Oxidizable.OxidizationLevel.OXIDIZED), true); - Block WAXED_OXIDIZED_COPPER_TEAPOT = register("waxed_oxidized_copper_teapot", new TeapotBlock(QuiltBlockSettings.copyOf(Blocks.COPPER_BLOCK).nonOpaque()), true); - Block IRON_WITCHES_OVEN = register("iron_witches_oven", new WitchesOvenBlock(QuiltBlockSettings.of(Material.METAL).strength(4.0F, 5.0F).requiresTool().nonOpaque().luminance(state -> state.get(WitchesOvenBlock.LIT) ? 13 : 0)), true); - Block COPPER_WITCHES_OVEN = register("copper_witches_oven", new CopperWitchesOvenBlock(QuiltBlockSettings.copyOf(Blocks.COPPER_BLOCK).luminance(state -> state.get(WitchesOvenBlock.LIT) ? 13 : 0), Oxidizable.OxidizationLevel.UNAFFECTED), true); - Block WAXED_COPPER_WITCHES_OVEN = register("waxed_copper_witches_oven", new WitchesOvenBlock(QuiltBlockSettings.copy(COPPER_WITCHES_OVEN)), true); - Block EXPOSED_COPPER_WITCHES_OVEN = register("exposed_copper_witches_oven", new CopperWitchesOvenBlock(QuiltBlockSettings.copy(Blocks.EXPOSED_COPPER).luminance(state -> state.get(WitchesOvenBlock.LIT) ? 13 : 0), Oxidizable.OxidizationLevel.EXPOSED), true); - Block WAXED_EXPOSED_COPPER_WITCHES_OVEN = register("waxed_exposed_copper_witches_oven", new WitchesOvenBlock(QuiltBlockSettings.copy(EXPOSED_COPPER_WITCHES_OVEN)), true); - Block WEATHERED_COPPER_WITCHES_OVEN = register("weathered_copper_witches_oven", new CopperWitchesOvenBlock(QuiltBlockSettings.copy(Blocks.WEATHERED_COPPER).luminance(state -> state.get(WitchesOvenBlock.LIT) ? 13 : 0), Oxidizable.OxidizationLevel.WEATHERED), true); - Block WAXED_WEATHERED_COPPER_WITCHES_OVEN = register("waxed_weathered_copper_witches_oven", new WitchesOvenBlock(QuiltBlockSettings.copy(WEATHERED_COPPER_WITCHES_OVEN)), true); - Block OXIDIZED_COPPER_WITCHES_OVEN = register("oxidized_copper_witches_oven", new CopperWitchesOvenBlock(QuiltBlockSettings.copy(Blocks.OXIDIZED_COPPER).luminance(state -> state.get(WitchesOvenBlock.LIT) ? 13 : 0), Oxidizable.OxidizationLevel.OXIDIZED), true); - Block WAXED_OXIDIZED_COPPER_WITCHES_OVEN = register("waxed_oxidized_copper_witches_oven", new WitchesOvenBlock(QuiltBlockSettings.copy(OXIDIZED_COPPER_WITCHES_OVEN)), true); - Block GLYPH = register("glyph", new GlyphBlock(QuiltBlockSettings.of(Material.DECORATION).noCollision().dropsNothing().strength(1, 0)), false); - Block ENCHANTED_GLYPH = register("enchanted_glyph", new GlyphBlock(QuiltBlockSettings.copyOf(GLYPH)), false); - Block IRON_WITCHES_CAULDRON = register("iron_witches_cauldron", new WitchesCauldronBlock(QuiltBlockSettings.copy(Blocks.CAULDRON).luminance(state -> state.get(WitchesCauldronBlock.LIT) ? 13 : 0)), true); + Block TEAPOT = register("teapot", new TeapotBlock(AbstractBlock.Settings.copy(Blocks.TERRACOTTA).nonOpaque()), true); + Block CAST_IRON_TEAPOT = register("cast_iron_teapot", new TeapotBlock(AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).nonOpaque()), true); + Block COPPER_TEAPOT = register("copper_teapot", new CopperTeapotBlock(AbstractBlock.Settings.copy(Blocks.COPPER_BLOCK).nonOpaque(), Oxidizable.OxidationLevel.UNAFFECTED), true); + Block WAXED_COPPER_TEAPOT = register("waxed_copper_teapot", new TeapotBlock(AbstractBlock.Settings.copy(Blocks.COPPER_BLOCK).nonOpaque()), true); + Block EXPOSED_COPPER_TEAPOT = register("exposed_copper_teapot", new CopperTeapotBlock(AbstractBlock.Settings.copy(Blocks.EXPOSED_COPPER).nonOpaque(), Oxidizable.OxidationLevel.EXPOSED), true); + Block WAXED_EXPOSED_COPPER_TEAPOT = register("waxed_exposed_copper_teapot", new TeapotBlock(AbstractBlock.Settings.copy(Blocks.COPPER_BLOCK).nonOpaque()), true); + Block WEATHERED_COPPER_TEAPOT = register("weathered_copper_teapot", new CopperTeapotBlock(AbstractBlock.Settings.copy(Blocks.WEATHERED_COPPER).nonOpaque(), Oxidizable.OxidationLevel.WEATHERED), true); + Block WAXED_WEATHERED_COPPER_TEAPOT = register("waxed_weathered_copper_teapot", new TeapotBlock(AbstractBlock.Settings.copy(Blocks.COPPER_BLOCK).nonOpaque()), true); + Block OXIDIZED_COPPER_TEAPOT = register("oxidized_copper_teapot", new CopperTeapotBlock(AbstractBlock.Settings.copy(Blocks.OXIDIZED_COPPER).nonOpaque(), Oxidizable.OxidationLevel.OXIDIZED), true); + Block WAXED_OXIDIZED_COPPER_TEAPOT = register("waxed_oxidized_copper_teapot", new TeapotBlock(AbstractBlock.Settings.copy(Blocks.COPPER_BLOCK).nonOpaque()), true); + Block IRON_WITCHES_OVEN = register("iron_witches_oven", new WitchesOvenBlock(AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(4.0F, 5.0F).requiresTool().nonOpaque().luminance(state -> state.get(WitchesOvenBlock.LIT) ? 13 : 0)), true); + Block COPPER_WITCHES_OVEN = register("copper_witches_oven", new CopperWitchesOvenBlock(AbstractBlock.Settings.copy(Blocks.COPPER_BLOCK).luminance(state -> state.get(WitchesOvenBlock.LIT) ? 13 : 0), Oxidizable.OxidationLevel.UNAFFECTED), true); + Block WAXED_COPPER_WITCHES_OVEN = register("waxed_copper_witches_oven", new WitchesOvenBlock(AbstractBlock.Settings.copy(COPPER_WITCHES_OVEN)), true); + Block EXPOSED_COPPER_WITCHES_OVEN = register("exposed_copper_witches_oven", new CopperWitchesOvenBlock(AbstractBlock.Settings.copy(Blocks.EXPOSED_COPPER).luminance(state -> state.get(WitchesOvenBlock.LIT) ? 13 : 0), Oxidizable.OxidationLevel.EXPOSED), true); + Block WAXED_EXPOSED_COPPER_WITCHES_OVEN = register("waxed_exposed_copper_witches_oven", new WitchesOvenBlock(AbstractBlock.Settings.copy(EXPOSED_COPPER_WITCHES_OVEN)), true); + Block WEATHERED_COPPER_WITCHES_OVEN = register("weathered_copper_witches_oven", new CopperWitchesOvenBlock(AbstractBlock.Settings.copy(Blocks.WEATHERED_COPPER).luminance(state -> state.get(WitchesOvenBlock.LIT) ? 13 : 0), Oxidizable.OxidationLevel.WEATHERED), true); + Block WAXED_WEATHERED_COPPER_WITCHES_OVEN = register("waxed_weathered_copper_witches_oven", new WitchesOvenBlock(AbstractBlock.Settings.copy(WEATHERED_COPPER_WITCHES_OVEN)), true); + Block OXIDIZED_COPPER_WITCHES_OVEN = register("oxidized_copper_witches_oven", new CopperWitchesOvenBlock(AbstractBlock.Settings.copy(Blocks.OXIDIZED_COPPER).luminance(state -> state.get(WitchesOvenBlock.LIT) ? 13 : 0), Oxidizable.OxidationLevel.OXIDIZED), true); + Block WAXED_OXIDIZED_COPPER_WITCHES_OVEN = register("waxed_oxidized_copper_witches_oven", new WitchesOvenBlock(AbstractBlock.Settings.copy(OXIDIZED_COPPER_WITCHES_OVEN)), true); + Block GLYPH = register("glyph", new GlyphBlock(AbstractBlock.Settings.copy(Blocks.FLOWER_POT).noCollision().dropsNothing().strength(1, 0)), false); + Block ENCHANTED_GLYPH = register("enchanted_glyph", new GlyphBlock(AbstractBlock.Settings.copy(GLYPH)), false); + Block IRON_WITCHES_CAULDRON = register("iron_witches_cauldron", new WitchesCauldronBlock(AbstractBlock.Settings.copy(Blocks.CAULDRON).luminance(state -> state.get(WitchesCauldronBlock.LIT) ? 13 : 0)), true); Block OAK_BREWING_BARREL = registerBarrel("oak_brewing_barrel"); Block SPRUCE_BREWING_BARREL = registerBarrel("spruce_brewing_barrel"); Block BIRCH_BREWING_BARREL = registerBarrel("birch_brewing_barrel"); @@ -154,108 +152,112 @@ public interface WKBlocks { Block SUMAC_SAPLING = registerSapling("sumac_sapling", WKConfiguredFeatures.SUMAC_TREE); Block POTTED_SUMAC_SAPLING = registerPottedSapling("potted_sumac_sapling", SUMAC_SAPLING); //Crops - WKTallCropBlock AMARANTH = registerWithType("amaranth", new AmaranthCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); - WKTallCropBlock AMARANTH_SWEETBERRY = registerWithType("amaranth_sweetberry", new AmaranthCropBlock(QuiltBlockSettings.copyOf(AMARANTH), AmaranthTypes.SWEETBERRY)); - WKTallCropBlock AMARANTH_TORCH = registerWithType("amaranth_torch", new AmaranthCropBlock(QuiltBlockSettings.copyOf(AMARANTH), AmaranthTypes.TORCH)); - WKTallCropBlock AMARANTH_SUNDEW = registerWithType("amaranth_sundew", new AmaranthCropBlock(QuiltBlockSettings.copyOf(AMARANTH), AmaranthTypes.SUNDEW)); - WKTallCropBlock AMARANTH_CREEPER = registerWithType("amaranth_creeper", new AmaranthCropBlock(QuiltBlockSettings.copyOf(AMARANTH), AmaranthTypes.CREEPER)); - WKTallCropBlock AMARANTH_VIRIDIAN = registerWithType("amaranth_viridian", new AmaranthCropBlock(QuiltBlockSettings.copyOf(AMARANTH), AmaranthTypes.VIRIDIAN)); - WKTallCropBlock AMARANTH_GRISELIN = registerWithType("amaranth_griselin", new AmaranthCropBlock(QuiltBlockSettings.copyOf(AMARANTH), AmaranthTypes.GRISELIN)); - WKTallCropBlock AMARANTH_CERISE = registerWithType("amaranth_cerise", new AmaranthCropBlock(QuiltBlockSettings.copyOf(AMARANTH), AmaranthTypes.CERISE)); - WKTallCropBlock AMARANTH_DARK_PASSION = registerWithType("amaranth_dark_passion", new AmaranthCropBlock(QuiltBlockSettings.copyOf(AMARANTH), AmaranthTypes.DARK_PASSION)); - WKTallCropBlock AMARANTH_FIREBIRD = registerWithType("amaranth_firebird", new AmaranthCropBlock(QuiltBlockSettings.copyOf(AMARANTH), AmaranthTypes.FIREBIRD)); + WKTallCropBlock AMARANTH = registerWithType("amaranth", new AmaranthCropBlock(AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); + WKTallCropBlock AMARANTH_SWEETBERRY = registerWithType("amaranth_sweetberry", new AmaranthCropBlock(AbstractBlock.Settings.copy(AMARANTH), AmaranthTypes.SWEETBERRY)); + WKTallCropBlock AMARANTH_TORCH = registerWithType("amaranth_torch", new AmaranthCropBlock(AbstractBlock.Settings.copy(AMARANTH), AmaranthTypes.TORCH)); + WKTallCropBlock AMARANTH_SUNDEW = registerWithType("amaranth_sundew", new AmaranthCropBlock(AbstractBlock.Settings.copy(AMARANTH), AmaranthTypes.SUNDEW)); + WKTallCropBlock AMARANTH_CREEPER = registerWithType("amaranth_creeper", new AmaranthCropBlock(AbstractBlock.Settings.copy(AMARANTH), AmaranthTypes.CREEPER)); + WKTallCropBlock AMARANTH_VIRIDIAN = registerWithType("amaranth_viridian", new AmaranthCropBlock(AbstractBlock.Settings.copy(AMARANTH), AmaranthTypes.VIRIDIAN)); + WKTallCropBlock AMARANTH_GRISELIN = registerWithType("amaranth_griselin", new AmaranthCropBlock(AbstractBlock.Settings.copy(AMARANTH), AmaranthTypes.GRISELIN)); + WKTallCropBlock AMARANTH_CERISE = registerWithType("amaranth_cerise", new AmaranthCropBlock(AbstractBlock.Settings.copy(AMARANTH), AmaranthTypes.CERISE)); + WKTallCropBlock AMARANTH_DARK_PASSION = registerWithType("amaranth_dark_passion", new AmaranthCropBlock(AbstractBlock.Settings.copy(AMARANTH), AmaranthTypes.DARK_PASSION)); + WKTallCropBlock AMARANTH_FIREBIRD = registerWithType("amaranth_firebird", new AmaranthCropBlock(AbstractBlock.Settings.copy(AMARANTH), AmaranthTypes.FIREBIRD)); //Plants Block AMARANTH_PLANT = register("amaranth_plant", new WildTallPlantCropBlock(getCropSettings(), AMARANTH, 0), false); - WKTallCropBlock BELLADONNA = registerWithType("belladonna", new BelladonnaCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); - WKTallCropBlock BELLADONNA_GLOW = registerWithType("belladonna_glow", new BelladonnaCropBlock(QuiltBlockSettings.copyOf(BELLADONNA), BelladonnaTypes.GLOW)); - WKTallCropBlock BELLADONNA_NOCTURNAL = registerWithType("belladonna_nocturnal", new BelladonnaCropBlock(QuiltBlockSettings.copyOf(BELLADONNA), BelladonnaTypes.NOCTURNAL)); + WKTallCropBlock BELLADONNA = registerWithType("belladonna", new BelladonnaCropBlock(AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); + WKTallCropBlock BELLADONNA_GLOW = registerWithType("belladonna_glow", new BelladonnaCropBlock(AbstractBlock.Settings.copy(BELLADONNA), BelladonnaTypes.GLOW)); + WKTallCropBlock BELLADONNA_NOCTURNAL = registerWithType("belladonna_nocturnal", new BelladonnaCropBlock(AbstractBlock.Settings.copy(BELLADONNA), BelladonnaTypes.NOCTURNAL)); Block BELLADONNA_PLANT = register("belladonna_plant", new WildTallPlantCropBlock(getCropSettings(), BELLADONNA, 0), false); - WKTallCropBlock CAMELLIA = registerWithType("camellia", new CamelliaCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); - WKTallCropBlock CAMELLIA_BUTTERCREAM = registerWithType("camellia_buttercream", new CamelliaCropBlock(QuiltBlockSettings.copyOf(CAMELLIA), CamelliaTypes.BUTTERCREAM)); - WKTallCropBlock CAMELLIA_BISQUE = registerWithType("camellia_bisque", new CamelliaCropBlock(QuiltBlockSettings.copyOf(CAMELLIA), CamelliaTypes.BISQUE)); - WKTallCropBlock CAMELLIA_FLINT = registerWithType("camellia_flint", new CamelliaCropBlock(QuiltBlockSettings.copyOf(CAMELLIA), CamelliaTypes.FLINT)); - WKTallCropBlock CAMELLIA_DEEP_LOVE = registerWithType("camellia_deep_love", new CamelliaCropBlock(QuiltBlockSettings.copyOf(CAMELLIA), CamelliaTypes.DEEP_LOVE)); - WKCropBlock CHAMOMILE = registerWithType("chamomile", new ChamomileCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); - WKCropBlock CHAMOMILE_VIRESCENT = registerWithType("chamomile_virescent", new ChamomileCropBlock(QuiltBlockSettings.copyOf(CHAMOMILE), ChamomileTypes.VIRESCENT)); - WKCropBlock CHAMOMILE_STARLETT = registerWithType("chamomile_starlett", new ChamomileCropBlock(QuiltBlockSettings.copyOf(CHAMOMILE), ChamomileTypes.STARLETT)); - WKCropBlock CHAMOMILE_DYEWORKS = registerWithType("chamomile_dyeworks", new ChamomileCropBlock(QuiltBlockSettings.copyOf(CHAMOMILE), ChamomileTypes.DYEWORKS)); + WKTallCropBlock CAMELLIA = registerWithType("camellia", new CamelliaCropBlock(AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); + WKTallCropBlock CAMELLIA_BUTTERCREAM = registerWithType("camellia_buttercream", new CamelliaCropBlock(AbstractBlock.Settings.copy(CAMELLIA), CamelliaTypes.BUTTERCREAM)); + WKTallCropBlock CAMELLIA_BISQUE = registerWithType("camellia_bisque", new CamelliaCropBlock(AbstractBlock.Settings.copy(CAMELLIA), CamelliaTypes.BISQUE)); + WKTallCropBlock CAMELLIA_FLINT = registerWithType("camellia_flint", new CamelliaCropBlock(AbstractBlock.Settings.copy(CAMELLIA), CamelliaTypes.FLINT)); + WKTallCropBlock CAMELLIA_DEEP_LOVE = registerWithType("camellia_deep_love", new CamelliaCropBlock(AbstractBlock.Settings.copy(CAMELLIA), CamelliaTypes.DEEP_LOVE)); + WKCropBlock CHAMOMILE = registerWithType("chamomile", new ChamomileCropBlock(AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); + WKCropBlock CHAMOMILE_VIRESCENT = registerWithType("chamomile_virescent", new ChamomileCropBlock(AbstractBlock.Settings.copy(CHAMOMILE), ChamomileTypes.VIRESCENT)); + WKCropBlock CHAMOMILE_STARLETT = registerWithType("chamomile_starlett", new ChamomileCropBlock(AbstractBlock.Settings.copy(CHAMOMILE), ChamomileTypes.STARLETT)); + WKCropBlock CHAMOMILE_DYEWORKS = registerWithType("chamomile_dyeworks", new ChamomileCropBlock(AbstractBlock.Settings.copy(CHAMOMILE), ChamomileTypes.DYEWORKS)); Block CHAMOMILE_PLANT = register("chamomile_plant", new WildPlantCropBlock(getCropSettings(), CHAMOMILE), false); - WKTallCropBlock CONEFLOWER = registerWithType("coneflower", new ConeflowerCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); - WKTallCropBlock CONEFLOWER_DANCING_LADIES = registerWithType("coneflower_dancing_ladies", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.DANCING_LADIES)); - WKTallCropBlock CONEFLOWER_VIOLET = registerWithType("coneflower_violet", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.VIOLET)); - WKTallCropBlock CONEFLOWER_QUEENS_DESIRE = registerWithType("coneflower_queens_desire", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.QUEENS_DESIRE)); - WKTallCropBlock CONEFLOWER_ROSE_DRESS = registerWithType("coneflower_rose_dress", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.ROSE_DRESS)); - WKTallCropBlock CONEFLOWER_SUITOR = registerWithType("coneflower_suitor", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.SUITOR)); - WKTallCropBlock CONEFLOWER_NETHER = registerWithType("coneflower_nether", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.NETHER)); - WKTallCropBlock CONEFLOWER_LADYS_WISH = registerWithType("coneflower_ladys_wish", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.LADYS_WISH)); - WKTallCropBlock CONEFLOWER_SUNGLOW = registerWithType("coneflower_sunglow", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.SUNGLOW)); - WKTallCropBlock CONEFLOWER_FLAME = registerWithType("coneflower_flame", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.FLAME)); - WKTallCropBlock CONEFLOWER_GILDED = registerWithType("coneflower_gilded", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.GILDED)); - WKTallCropBlock CONEFLOWER_MORNING_MIST = registerWithType("coneflower_morning_mist", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.MORNING_MIST)); - WKTallCropBlock CONEFLOWER_FLEECE = registerWithType("coneflower_fleece", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.FLEECE)); - WKTallCropBlock CONEFLOWER_COMPANY = registerWithType("coneflower_company", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.COMPANY)); - WKTallCropBlock CONEFLOWER_MASQUERADE = registerWithType("coneflower_masquerade", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.MASQUERADE)); - WKTallCropBlock CONEFLOWER_PARTY_BLEND = registerWithType("coneflower_party_blend", new ConeflowerCropBlock(QuiltBlockSettings.copyOf(CONEFLOWER), ConeflowerTypes.PARTY_BLEND)); + WKTallCropBlock CONEFLOWER = registerWithType("coneflower", new ConeflowerCropBlock(AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); + WKTallCropBlock CONEFLOWER_DANCING_LADIES = registerWithType("coneflower_dancing_ladies", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.DANCING_LADIES)); + WKTallCropBlock CONEFLOWER_VIOLET = registerWithType("coneflower_violet", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.VIOLET)); + WKTallCropBlock CONEFLOWER_QUEENS_DESIRE = registerWithType("coneflower_queens_desire", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.QUEENS_DESIRE)); + WKTallCropBlock CONEFLOWER_ROSE_DRESS = registerWithType("coneflower_rose_dress", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.ROSE_DRESS)); + WKTallCropBlock CONEFLOWER_SUITOR = registerWithType("coneflower_suitor", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.SUITOR)); + WKTallCropBlock CONEFLOWER_NETHER = registerWithType("coneflower_nether", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.NETHER)); + WKTallCropBlock CONEFLOWER_LADYS_WISH = registerWithType("coneflower_ladys_wish", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.LADYS_WISH)); + WKTallCropBlock CONEFLOWER_SUNGLOW = registerWithType("coneflower_sunglow", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.SUNGLOW)); + WKTallCropBlock CONEFLOWER_FLAME = registerWithType("coneflower_flame", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.FLAME)); + WKTallCropBlock CONEFLOWER_GILDED = registerWithType("coneflower_gilded", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.GILDED)); + WKTallCropBlock CONEFLOWER_MORNING_MIST = registerWithType("coneflower_morning_mist", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.MORNING_MIST)); + WKTallCropBlock CONEFLOWER_FLEECE = registerWithType("coneflower_fleece", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.FLEECE)); + WKTallCropBlock CONEFLOWER_COMPANY = registerWithType("coneflower_company", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.COMPANY)); + WKTallCropBlock CONEFLOWER_MASQUERADE = registerWithType("coneflower_masquerade", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.MASQUERADE)); + WKTallCropBlock CONEFLOWER_PARTY_BLEND = registerWithType("coneflower_party_blend", new ConeflowerCropBlock(AbstractBlock.Settings.copy(CONEFLOWER), ConeflowerTypes.PARTY_BLEND)); Block CONEFLOWER_PLANT = register("coneflower_plant", new WildTallPlantCropBlock(getCropSettings(), CONEFLOWER, 3), false); - WKTallCropBlock FOXGLOVE = registerWithType("foxglove", new FoxgloveCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); - WKTallCropBlock FOXGLOVE_SMALT = registerWithType("foxglove_smalt", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.SMALT)); - WKTallCropBlock FOXGLOVE_TRANQUIL_EVENING = registerWithType("foxglove_tranquil_evening", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.TRANQUIL_EVENING)); - WKTallCropBlock FOXGLOVE_PURPUREA = registerWithType("foxglove_purpurea", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.PURPUREA)); - WKTallCropBlock FOXGLOVE_LOVELY_MORNING = registerWithType("foxglove_lovely_morning", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.LOVELY_MORNING)); - WKTallCropBlock FOXGLOVE_IANTHINE = registerWithType("foxglove_ianthine", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.IANTHINE)); - WKTallCropBlock FOXGLOVE_QUEENS_HAT = registerWithType("foxglove_queens_hat", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.QUEENS_HAT)); - WKTallCropBlock FOXGLOVE_BLUSH = registerWithType("foxglove_blush", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.BLUSH)); - WKTallCropBlock FOXGLOVE_ROYAL_BLANKET = registerWithType("foxglove_royal_blanket", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.ROYAL_BLANKET)); - WKTallCropBlock FOXGLOVE_LOVE = registerWithType("foxglove_love", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.LOVE)); - WKTallCropBlock FOXGLOVE_BABYS_DRESS = registerWithType("foxglove_babys_dress", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.BABYS_DRESS)); - WKTallCropBlock FOXGLOVE_STROLL = registerWithType("foxglove_stroll", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.STROLL)); - WKTallCropBlock FOXGLOVE_MAIDENS_PINK = registerWithType("foxglove_maidens_pink", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.MAIDENS)); - WKTallCropBlock FOXGLOVE_MORNING_FIELD = registerWithType("foxglove_morning_field", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.MORNING_FIELD)); - WKTallCropBlock FOXGLOVE_SIGHE_GOWN = registerWithType("foxglove_sighe_gown", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.SIGHE_GOWN)); - WKTallCropBlock FOXGLOVE_CALAMINE = registerWithType("foxglove_calamine", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.CALAMINE)); - WKTallCropBlock FOXGLOVE_NETHERINE = registerWithType("foxglove_netherine", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.NETHERINE)); - WKTallCropBlock FOXGLOVE_SUNGLOW = registerWithType("foxglove_sunglow", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.SUNGLOW)); - WKTallCropBlock FOXGLOVE_SANDSTONE_TEMPLE = registerWithType("foxglove_sandstone_temple", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.SANDSTONE_TEMPLE)); - WKTallCropBlock FOXGLOVE_FIERY_FIELD = registerWithType("foxglove_fiery_field", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.FIERY_FIELD)); - WKTallCropBlock FOXGLOVE_PASSION = registerWithType("foxglove_passion", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.PASSION)); - WKTallCropBlock FOXGLOVE_BASTARD_AMBER = registerWithType("foxglove_bastard_amber", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.BASTARD_AMBER)); - WKTallCropBlock FOXGLOVE_SUNDROP = registerWithType("foxglove_sundrop", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.SUNDROP)); - WKTallCropBlock FOXGLOVE_AURULENT = registerWithType("foxglove_aurulent", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.AURULENT)); - WKTallCropBlock FOXGLOVE_IVORY = registerWithType("foxglove_ivory", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.IVORY)); - WKTallCropBlock FOXGLOVE_NIVEOUS = registerWithType("foxglove_niveous", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.NIVEOUS)); - WKTallCropBlock FOXGLOVE_COWS_CREAM = registerWithType("foxglove_cows_cream", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.COWS_CREAM)); - WKTallCropBlock FOXGLOVE_SIGHE_MIST = registerWithType("foxglove_sighe_mist", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.SIGHE_MIST)); - WKTallCropBlock FOXGLOVE_PURITY = registerWithType("foxglove_purity", new FoxgloveCropBlock(QuiltBlockSettings.copyOf(FOXGLOVE), FoxgloveTypes.PURITY)); + WKTallCropBlock FOXGLOVE = registerWithType("foxglove", new FoxgloveCropBlock(AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); + WKTallCropBlock FOXGLOVE_SMALT = registerWithType("foxglove_smalt", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.SMALT)); + WKTallCropBlock FOXGLOVE_TRANQUIL_EVENING = registerWithType("foxglove_tranquil_evening", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.TRANQUIL_EVENING)); + WKTallCropBlock FOXGLOVE_PURPUREA = registerWithType("foxglove_purpurea", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.PURPUREA)); + WKTallCropBlock FOXGLOVE_LOVELY_MORNING = registerWithType("foxglove_lovely_morning", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.LOVELY_MORNING)); + WKTallCropBlock FOXGLOVE_IANTHINE = registerWithType("foxglove_ianthine", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.IANTHINE)); + WKTallCropBlock FOXGLOVE_QUEENS_HAT = registerWithType("foxglove_queens_hat", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.QUEENS_HAT)); + WKTallCropBlock FOXGLOVE_BLUSH = registerWithType("foxglove_blush", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.BLUSH)); + WKTallCropBlock FOXGLOVE_ROYAL_BLANKET = registerWithType("foxglove_royal_blanket", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.ROYAL_BLANKET)); + WKTallCropBlock FOXGLOVE_LOVE = registerWithType("foxglove_love", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.LOVE)); + WKTallCropBlock FOXGLOVE_BABYS_DRESS = registerWithType("foxglove_babys_dress", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.BABYS_DRESS)); + WKTallCropBlock FOXGLOVE_STROLL = registerWithType("foxglove_stroll", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.STROLL)); + WKTallCropBlock FOXGLOVE_MAIDENS_PINK = registerWithType("foxglove_maidens_pink", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.MAIDENS)); + WKTallCropBlock FOXGLOVE_MORNING_FIELD = registerWithType("foxglove_morning_field", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.MORNING_FIELD)); + WKTallCropBlock FOXGLOVE_SIGHE_GOWN = registerWithType("foxglove_sighe_gown", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.SIGHE_GOWN)); + WKTallCropBlock FOXGLOVE_CALAMINE = registerWithType("foxglove_calamine", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.CALAMINE)); + WKTallCropBlock FOXGLOVE_NETHERINE = registerWithType("foxglove_netherine", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.NETHERINE)); + WKTallCropBlock FOXGLOVE_SUNGLOW = registerWithType("foxglove_sunglow", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.SUNGLOW)); + WKTallCropBlock FOXGLOVE_SANDSTONE_TEMPLE = registerWithType("foxglove_sandstone_temple", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.SANDSTONE_TEMPLE)); + WKTallCropBlock FOXGLOVE_FIERY_FIELD = registerWithType("foxglove_fiery_field", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.FIERY_FIELD)); + WKTallCropBlock FOXGLOVE_PASSION = registerWithType("foxglove_passion", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.PASSION)); + WKTallCropBlock FOXGLOVE_BASTARD_AMBER = registerWithType("foxglove_bastard_amber", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.BASTARD_AMBER)); + WKTallCropBlock FOXGLOVE_SUNDROP = registerWithType("foxglove_sundrop", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.SUNDROP)); + WKTallCropBlock FOXGLOVE_AURULENT = registerWithType("foxglove_aurulent", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.AURULENT)); + WKTallCropBlock FOXGLOVE_IVORY = registerWithType("foxglove_ivory", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.IVORY)); + WKTallCropBlock FOXGLOVE_NIVEOUS = registerWithType("foxglove_niveous", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.NIVEOUS)); + WKTallCropBlock FOXGLOVE_COWS_CREAM = registerWithType("foxglove_cows_cream", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.COWS_CREAM)); + WKTallCropBlock FOXGLOVE_SIGHE_MIST = registerWithType("foxglove_sighe_mist", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.SIGHE_MIST)); + WKTallCropBlock FOXGLOVE_PURITY = registerWithType("foxglove_purity", new FoxgloveCropBlock(AbstractBlock.Settings.copy(FOXGLOVE), FoxgloveTypes.PURITY)); Block FOXGLOVE_PLANT = register("foxglove_plant", new WildTallPlantCropBlock(getCropSettings(), FOXGLOVE, 2), false); - WKCropBlock HELLEBORE = registerWithType("hellebore", new HelleboreCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); - WKCropBlock HELLEBORE_MORNING_TEA = registerWithType("hellebore_morning_tea", new HelleboreCropBlock(QuiltBlockSettings.copyOf(HELLEBORE), HelleboreTypes.MORNING_TEA)); - WKCropBlock HELLEBORE_MORNING_CASANOVA = registerWithType("hellebore_casanova", new HelleboreCropBlock(QuiltBlockSettings.copyOf(HELLEBORE), HelleboreTypes.CASANOVA)); - WKCropBlock HELLEBORE_MORNING_BLUSHING = registerWithType("hellebore_blushing", new HelleboreCropBlock(QuiltBlockSettings.copyOf(HELLEBORE), HelleboreTypes.BLUSHING)); - WKCropBlock HELLEBORE_MORNING_CELADON = registerWithType("hellebore_celadon", new HelleboreCropBlock(QuiltBlockSettings.copyOf(HELLEBORE), HelleboreTypes.CELADON)); - WKCropBlock HELLEBORE_MORNING_FURY = registerWithType("hellebore_fury", new HelleboreCropBlock(QuiltBlockSettings.copyOf(HELLEBORE), HelleboreTypes.FURY)); - WKCropBlock HELLEBORE_MORNING_ANGEL = registerWithType("hellebore_angel", new HelleboreCropBlock(QuiltBlockSettings.copyOf(HELLEBORE), HelleboreTypes.ANGEL)); - WKCropBlock HELLEBORE_MORNING_TWILIGHT = registerWithType("hellebore_twilight", new HelleboreCropBlock(QuiltBlockSettings.copyOf(HELLEBORE), HelleboreTypes.TWILIGHT)); - WKCropBlock HELLEBORE_MORNING_GRIMM = registerWithType("hellebore_grimm", new HelleboreCropBlock(QuiltBlockSettings.copyOf(HELLEBORE), HelleboreTypes.GRIMM)); - WKCropBlock HELLEBORE_MORNING_NOCTURNE = registerWithType("hellebore_nocturne", new HelleboreCropBlock(QuiltBlockSettings.copyOf(HELLEBORE), HelleboreTypes.NOCTURNE)); + WKCropBlock HELLEBORE = registerWithType("hellebore", new HelleboreCropBlock(AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); + WKCropBlock HELLEBORE_MORNING_TEA = registerWithType("hellebore_morning_tea", new HelleboreCropBlock(AbstractBlock.Settings.copy(HELLEBORE), HelleboreTypes.MORNING_TEA)); + WKCropBlock HELLEBORE_MORNING_CASANOVA = registerWithType("hellebore_casanova", new HelleboreCropBlock(AbstractBlock.Settings.copy(HELLEBORE), HelleboreTypes.CASANOVA)); + WKCropBlock HELLEBORE_MORNING_BLUSHING = registerWithType("hellebore_blushing", new HelleboreCropBlock(AbstractBlock.Settings.copy(HELLEBORE), HelleboreTypes.BLUSHING)); + WKCropBlock HELLEBORE_MORNING_CELADON = registerWithType("hellebore_celadon", new HelleboreCropBlock(AbstractBlock.Settings.copy(HELLEBORE), HelleboreTypes.CELADON)); + WKCropBlock HELLEBORE_MORNING_FURY = registerWithType("hellebore_fury", new HelleboreCropBlock(AbstractBlock.Settings.copy(HELLEBORE), HelleboreTypes.FURY)); + WKCropBlock HELLEBORE_MORNING_ANGEL = registerWithType("hellebore_angel", new HelleboreCropBlock(AbstractBlock.Settings.copy(HELLEBORE), HelleboreTypes.ANGEL)); + WKCropBlock HELLEBORE_MORNING_TWILIGHT = registerWithType("hellebore_twilight", new HelleboreCropBlock(AbstractBlock.Settings.copy(HELLEBORE), HelleboreTypes.TWILIGHT)); + WKCropBlock HELLEBORE_MORNING_GRIMM = registerWithType("hellebore_grimm", new HelleboreCropBlock(AbstractBlock.Settings.copy(HELLEBORE), HelleboreTypes.GRIMM)); + WKCropBlock HELLEBORE_MORNING_NOCTURNE = registerWithType("hellebore_nocturne", new HelleboreCropBlock(AbstractBlock.Settings.copy(HELLEBORE), HelleboreTypes.NOCTURNE)); Block HELLEBORE_PLANT = register("hellebore_plant", new WildPlantCropBlock(getCropSettings(), HELLEBORE), false); - WKTallCropBlock IRIS = registerWithType("iris", new IrisCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); - WKTallCropBlock IRIS_OCEAN = registerWithType("iris_ocean", new IrisCropBlock(QuiltBlockSettings.copyOf(IRIS), IrisTypes.OCEAN)); - WKTallCropBlock IRIS_DEEP_SEA = registerWithType("iris_deep_sea", new IrisCropBlock(QuiltBlockSettings.copyOf(IRIS), IrisTypes.DEEP_SEA)); - WKTallCropBlock IRIS_BLEEDING_HEART = registerWithType("iris_bleeding_heart", new IrisCropBlock(QuiltBlockSettings.copyOf(IRIS), IrisTypes.BLEEDING_HEART)); + WKTallCropBlock IRIS = registerWithType("iris", new IrisCropBlock(AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); + WKTallCropBlock IRIS_OCEAN = registerWithType("iris_ocean", new IrisCropBlock(AbstractBlock.Settings.copy(IRIS), IrisTypes.OCEAN)); + WKTallCropBlock IRIS_DEEP_SEA = registerWithType("iris_deep_sea", new IrisCropBlock(AbstractBlock.Settings.copy(IRIS), IrisTypes.DEEP_SEA)); + WKTallCropBlock IRIS_BLEEDING_HEART = registerWithType("iris_bleeding_heart", new IrisCropBlock(AbstractBlock.Settings.copy(IRIS), IrisTypes.BLEEDING_HEART)); Block IRIS_PLANT = register("iris_plant", new WildTallPlantCropBlock(getCropSettings(), IRIS, 2), false); - WKCropBlock SANGUINARY = registerWithType("sanguinary", new SanguinaryCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); - WKCropBlock SANGUINARY_MEADOW = registerWithType("sanguinary_meadow", new SanguinaryCropBlock(QuiltBlockSettings.copyOf(SANGUINARY), SanguinaryTypes.MEADOW)); - WKCropBlock SANGUINARY_BLUSHING = registerWithType("sanguinary_blushing", new SanguinaryCropBlock(QuiltBlockSettings.copyOf(SANGUINARY), SanguinaryTypes.BLUSHING)); - WKCropBlock SANGUINARY_SUNSET = registerWithType("sanguinary_sunset", new SanguinaryCropBlock(QuiltBlockSettings.copyOf(SANGUINARY), SanguinaryTypes.SUNSET)); - WKCropBlock SANGUINARY_MADDER = registerWithType("sanguinary_madder", new SanguinaryCropBlock(QuiltBlockSettings.copyOf(SANGUINARY), SanguinaryTypes.MADDER)); - WKCropBlock SANGUINARY_AUREOLIN = registerWithType("sanguinary_aureolin", new SanguinaryCropBlock(QuiltBlockSettings.copyOf(SANGUINARY), SanguinaryTypes.AUREOLIN)); + WKCropBlock SANGUINARY = registerWithType("sanguinary", new SanguinaryCropBlock(AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP))); + WKCropBlock SANGUINARY_MEADOW = registerWithType("sanguinary_meadow", new SanguinaryCropBlock(AbstractBlock.Settings.copy(SANGUINARY), SanguinaryTypes.MEADOW)); + WKCropBlock SANGUINARY_BLUSHING = registerWithType("sanguinary_blushing", new SanguinaryCropBlock(AbstractBlock.Settings.copy(SANGUINARY), SanguinaryTypes.BLUSHING)); + WKCropBlock SANGUINARY_SUNSET = registerWithType("sanguinary_sunset", new SanguinaryCropBlock(AbstractBlock.Settings.copy(SANGUINARY), SanguinaryTypes.SUNSET)); + WKCropBlock SANGUINARY_MADDER = registerWithType("sanguinary_madder", new SanguinaryCropBlock(AbstractBlock.Settings.copy(SANGUINARY), SanguinaryTypes.MADDER)); + WKCropBlock SANGUINARY_AUREOLIN = registerWithType("sanguinary_aureolin", new SanguinaryCropBlock(AbstractBlock.Settings.copy(SANGUINARY), SanguinaryTypes.AUREOLIN)); Block SANGUINARY_PLANT = register("sanguinary_plant", new WildPlantCropBlock(getCropSettings(), SANGUINARY), false); - Block MINT = register("mint", new MintCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP)), false); - Block WORMWOOD = register("wormwood", new WormwoodCropBlock(QuiltBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP)), false); - Block SALT_BLOCK = register("salt", new SaltBlock(QuiltBlockSettings.of(Material.DECORATION).noCollision().breakInstantly()), true); + Block MINT = register("mint", new MintCropBlock(AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP)), false); + Block WORMWOOD = register("wormwood", new WormwoodCropBlock(AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP)), false); + Block SALT_BLOCK = register("salt", new SaltBlock(AbstractBlock.Settings.copy(Material.DECORATION).noCollision().breakInstantly()), true); - static QuiltBlockSettings getCropSettings() { - return QuiltBlockSettings.of(Material.PLANT).noCollision().breakInstantly().sounds(BlockSoundGroup.CROP); + static AbstractBlock.Settings getCropSettings() { + return AbstractBlock.Settings.copy(Blocks.CORNFLOWER).noCollision().breakInstantly().sounds(BlockSoundGroup.CROP); + } + + static DoorBlock createDoorBlock(AbstractBlock.Settings settings) { + return new DoorBlock(BlockSetType.OAK, settings); } /** @@ -276,8 +278,8 @@ static Map getTypeBlocks() { return TYPE_BLOCKS; } - static QuiltBlockSettings leavesSettings() { - return QuiltBlockSettings.of(Material.LEAVES) + static AbstractBlock.Settings leavesSettings() { + return AbstractBlock.Settings.copy(Blocks.OAK_LEAVES) .strength(0.2F) .ticksRandomly() .sounds(BlockSoundGroup.GRASS) @@ -287,27 +289,27 @@ static QuiltBlockSettings leavesSettings() { .blockVision(Blocks::never); } - static QuiltBlockSettings plankSettings() { - return QuiltBlockSettings.copyOf(Blocks.OAK_PLANKS).strength(2.0f); + static AbstractBlock.Settings plankSettings() { + return AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).strength(2.0f); } - static QuiltBlockSettings logSettings() { - return QuiltBlockSettings.copyOf(Blocks.OAK_LOG).strength(2.0f); + static AbstractBlock.Settings logSettings() { + return AbstractBlock.Settings.copy(Blocks.OAK_LOG).strength(2.0f); } private static Block registerBarrel(String path) { - return register(path, new BrewingBarrelBlock(QuiltBlockSettings.of(Material.WOOD).nonOpaque().strength(2.5F)), true); + return register(path, new BrewingBarrelBlock(AbstractBlock.Settings.copy(Blocks.BARREL).nonOpaque().strength(2.5F)), true); } private static Block registerPottedSapling(String path, Block block) { - final Block pottedSapling = new FlowerPotBlock(block, QuiltBlockSettings.of(Material.DECORATION).breakInstantly().nonOpaque()); + final Block pottedSapling = new FlowerPotBlock(block, AbstractBlock.Settings.copy(Blocks.POTTED_OAK_SAPLING).breakInstantly().nonOpaque()); BLOCKS.add(new ObjectDefinition<>(WitchesKitchen.id(path), pottedSapling)); return pottedSapling; } private static Block registerSapling(String path, ConfiguredFeature feature) { final Block sapling = new WKSaplingBlock(new WKSaplingGenerator(feature), - QuiltBlockSettings.of(Material.PLANT) + AbstractBlock.Settings.copy(Blocks.OAK_SAPLING) .noCollision() .ticksRandomly() .breakInstantly() @@ -320,7 +322,7 @@ private static Block registerLeaf(String path) { } private static Block registerWood(String path, MapColor color) { - final PillarBlock wood = new PillarBlock(QuiltBlockSettings.of(Material.WOOD, color).strength(2.0f).sounds(BlockSoundGroup.WOOD)); + final PillarBlock wood = new PillarBlock(AbstractBlock.Settings.copy(Blocks.OAK_WOOD).mapColor(color).strength(2.0f).sounds(BlockSoundGroup.WOOD)); return register(path, wood, true); } @@ -329,11 +331,11 @@ private static PillarBlock registerLog(String path) { } private static Block registerSlab(String path) { - return register(path, new SlabBlock(QuiltBlockSettings.of(Material.WOOD)), true); + return register(path, new SlabBlock(AbstractBlock.Settings.copy(Blocks.OAK_SLAB)), true); } private static Block registerWoodenStair(String path, Block block) { - return register(path, new StairsBlock(block.getDefaultState(), QuiltBlockSettings.of(Material.WOOD)), true); + return register(path, new StairsBlock(block.getDefaultState(), AbstractBlock.Settings.copy(Blocks.OAK_STAIRS)), true); } static T registerWithType(String name, T block) { diff --git a/src/main/java/cf/witcheskitchen/common/registry/WKDamageSources.java b/src/main/java/cf/witcheskitchen/common/registry/WKDamageSources.java index 9d504686..cf822211 100644 --- a/src/main/java/cf/witcheskitchen/common/registry/WKDamageSources.java +++ b/src/main/java/cf/witcheskitchen/common/registry/WKDamageSources.java @@ -14,6 +14,7 @@ static void init() { } + // TODO: how do we do this? class WKFireDamageSource extends DamageSource { protected WKFireDamageSource(String name) { diff --git a/src/main/java/cf/witcheskitchen/common/registry/WKTags.java b/src/main/java/cf/witcheskitchen/common/registry/WKTags.java index ee1d4146..f7a8e47c 100644 --- a/src/main/java/cf/witcheskitchen/common/registry/WKTags.java +++ b/src/main/java/cf/witcheskitchen/common/registry/WKTags.java @@ -26,6 +26,8 @@ public interface WKTags { TagKey> SILVER_IMMUNE = register(RegistryKeys.ENTITY_TYPE, "silver_immune"); TagKey> RIGHT_HAND_WITCH_SUMMON = register(RegistryKeys.ENTITY_TYPE, "right_hand_witch_summon"); TagKey> LEFT_HAND_WITCH_SUMMON = register(RegistryKeys.ENTITY_TYPE, "left_hand_witch_summon"); + TagKey> DEMONIC = register(RegistryKeys.ENTITY_TYPE, "demonic"); + TagKey> CONSTRUCT = register(RegistryKeys.ENTITY_TYPE, "construct"); // Block TagKey HEATS_CAULDRON = register(RegistryKeys.BLOCK, "heats_cauldron"); diff --git a/src/main/java/cf/witcheskitchen/data/WKLanguageProvider.java b/src/main/java/cf/witcheskitchen/data/WKLanguageProvider.java index 8cf07e49..dafa7e65 100644 --- a/src/main/java/cf/witcheskitchen/data/WKLanguageProvider.java +++ b/src/main/java/cf/witcheskitchen/data/WKLanguageProvider.java @@ -7,14 +7,17 @@ import cf.witcheskitchen.common.registry.WKStatusEffects; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider; +import net.minecraft.registry.RegistryWrapper; + +import java.util.concurrent.CompletableFuture; public class WKLanguageProvider extends FabricLanguageProvider { - protected WKLanguageProvider(FabricDataOutput output) { - super(output); + protected WKLanguageProvider(FabricDataOutput output, CompletableFuture future) { + super(output, future); } @Override - public void generateTranslations(TranslationBuilder builder) { + public void generateTranslations(RegistryWrapper.WrapperLookup lookup, TranslationBuilder builder) { //GROUPS builder.add(WKItemGroupEvents.GENERAL_TAB, "Witches' Kitchen General"); builder.add(WKItemGroupEvents.FOOD_TAB, "Witches' Kitchen Food"); @@ -282,7 +285,7 @@ public void generateTranslations(TranslationBuilder builder) { builder.add("item.minecraft.lingering_potion.effect.rum", "Rum Lingering Potion"); //STATUS EFFECTS - builder.add(WKStatusEffects.DRUNK, "Drunk"); + builder.add(WKStatusEffects.DRUNK.value(), "Drunk"); //DEATH MESSAGE builder.add("death.attack.on_oven", "%s cooked themselves to a crisp... they do not taste great"); diff --git a/src/main/java/cf/witcheskitchen/data/WKTagProvider.java b/src/main/java/cf/witcheskitchen/data/WKTagProvider.java index f988702b..0e7499e7 100644 --- a/src/main/java/cf/witcheskitchen/data/WKTagProvider.java +++ b/src/main/java/cf/witcheskitchen/data/WKTagProvider.java @@ -1,16 +1,17 @@ package cf.witcheskitchen.data; -import cf.witcheskitchen.common.registry.WKBlocks; -import cf.witcheskitchen.common.registry.WKEntityTypes; -import cf.witcheskitchen.common.registry.WKItems; -import cf.witcheskitchen.common.registry.WKTags; +import cf.witcheskitchen.common.registry.*; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; import net.minecraft.block.Blocks; import net.minecraft.entity.EntityType; +import net.minecraft.entity.damage.DamageType; import net.minecraft.item.Items; +import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.DamageTypeTags; +import net.minecraft.registry.tag.EntityTypeTags; import net.minecraft.registry.tag.ItemTags; import java.util.concurrent.CompletableFuture; @@ -75,8 +76,22 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { getOrCreateTagBuilder(WKTags.LESSER_DEMON); getOrCreateTagBuilder(WKTags.RIGHT_HAND_WITCH_SUMMON); getOrCreateTagBuilder(WKTags.TAGLOCK_BLACKLIST).add(EntityType.ENDER_DRAGON, EntityType.WITHER); + getOrCreateTagBuilder(WKTags.DEMONIC).add(WKEntityTypes.ROGGENWOLF); //VANILLA + getOrCreateTagBuilder(EntityTypeTags.UNDEAD).add(WKEntityTypes.CUSITH, WKEntityTypes.CHURCH_GRIM); + getOrCreateTagBuilder(EntityTypeTags.CAN_BREATHE_UNDER_WATER).add(WKEntityTypes.CUSITH, WKEntityTypes.ROGGENWOLF, WKEntityTypes.CHURCH_GRIM); + } + } + + public static class WKDamageTypeTags extends FabricTagProvider { + public WKDamageTypeTags(FabricDataOutput output, CompletableFuture registriesFuture) { + super(output, RegistryKeys.DAMAGE_TYPE, registriesFuture); + } + + @Override + protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) { + getOrCreateTagBuilder(DamageTypeTags.BURN_FROM_STEPPING).add(WKDamageSources.ON_OVEN.getType()); } } } diff --git a/src/main/resources/wk.accesswidener b/src/main/resources/wk.accesswidener index 77c2cea7..42b41c63 100644 --- a/src/main/resources/wk.accesswidener +++ b/src/main/resources/wk.accesswidener @@ -1,4 +1,5 @@ accessWidener v2 named accessible method net/minecraft/world/gen/foliage/FoliagePlacerType register (Ljava/lang/String;Lcom/mojang/serialization/Codec;)Lnet/minecraft/world/gen/foliage/FoliagePlacerType; accessible method net/minecraft/block/Blocks canSpawnOnLeaves (Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/EntityType;)Ljava/lang/Boolean; -accessible method net/minecraft/block/Blocks never (Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Z \ No newline at end of file +accessible method net/minecraft/block/Blocks never (Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Z +accessible method net/minecraft/block/CropBlock isMature (Lnet/minecraft/block/BlockState;)Z \ No newline at end of file