From 7e33b8c5ec6fb244e45272d87a1e86b62cbbfe07 Mon Sep 17 00:00:00 2001 From: gnembon <41132274+gnembon@users.noreply.github.com> Date: Mon, 12 Dec 2022 10:25:29 +0100 Subject: [PATCH] 1.4.91 on 1.19.3 --- gradle.properties | 14 ++++---- .../CarpetExtraDispenserBehaviors.java | 6 ++-- .../FeedMooshroomDispenserBehavior.java | 4 +-- .../PlaceBoatOnIceDispenserBehavior.java | 4 +-- ...AbstractButtonBlock_variableWoodMixin.java | 36 +++++++++++++------ .../mixins/CactusBlock_fertilizerMixin.java | 3 +- .../mixins/DropperBlock_craftingMixin.java | 2 +- .../mixins/FallingBlockEntityMixin.java | 2 +- .../FarmerVillagerTask_wartFarmMixin.java | 4 +-- ...rtEntity_transferItemsOutFeatureMixin.java | 2 +- .../mixins/LilyPadBlock_fertilizerMixin.java | 3 +- .../carpetextra/mixins/LivingEntityMixin.java | 2 +- .../carpetextra/mixins/StrayEntityMixin.java | 4 +-- .../SugarCaneBlock_fertilizerMixin.java | 3 +- .../VillagerProfession_wartFarmMixin.java | 4 +-- .../java/carpetextra/utils/VoidContainer.java | 2 +- 16 files changed, 57 insertions(+), 38 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0f793e7c..0db8f600 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop - minecraft_version=1.19.2 - yarn_mappings=1.19.2+build.28 - loader_version=0.14.9 + minecraft_version=1.19.3 + yarn_mappings=1.19.3+build.3 + loader_version=0.14.11 # check available versions on maven (https://masa.dy.fi/maven/carpet/fabric-carpet/) for the given minecraft version you are using - carpet_core_version=1.4.84+v221018 + carpet_core_version=1.4.91+v221207 # Mod Properties - mod_version = 1.4.84 + mod_version = 1.4.91 maven_group = carpet-extra archives_base_name = carpet-extra @@ -21,7 +21,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.19:1.19.2 + release-curse-versions = Minecraft 1.19:1.19.3 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release @@ -29,4 +29,4 @@ org.gradle.jvmargs=-Xmx1G # The "name" or id of the Curseforge version for the secondary branch # This is needed because CF uses too vague names for snapshots # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-extra-curse-version = Minecraft 1.19:1.19.2 + release-extra-curse-version = Minecraft 1.19:1.19.3 diff --git a/src/main/java/carpetextra/dispenser/CarpetExtraDispenserBehaviors.java b/src/main/java/carpetextra/dispenser/CarpetExtraDispenserBehaviors.java index 83438437..ba7e3261 100644 --- a/src/main/java/carpetextra/dispenser/CarpetExtraDispenserBehaviors.java +++ b/src/main/java/carpetextra/dispenser/CarpetExtraDispenserBehaviors.java @@ -47,8 +47,8 @@ import net.minecraft.item.ShearsItem; import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.server.world.ServerWorld; -import net.minecraft.tag.BlockTags; -import net.minecraft.tag.ItemTags; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; import net.minecraft.util.math.BlockPointer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; @@ -141,7 +141,7 @@ public static DispenserBehavior getCustomDispenserBehavior(ServerWorld world, Bl // get brown mooshrooms in front of dispenser boolean hasFeedableMooshrooms = !world.getEntitiesByType(EntityType.MOOSHROOM, frontBlockBox, EntityPredicates.VALID_LIVING_ENTITY.and((mooshroomEntity) -> { - return ((MooshroomEntity) mooshroomEntity).getMooshroomType() == MooshroomEntity.Type.BROWN; + return ((MooshroomEntity) mooshroomEntity).getVariant() == MooshroomEntity.Type.BROWN; })).isEmpty(); // check if item is a small flower diff --git a/src/main/java/carpetextra/dispenser/behaviors/FeedMooshroomDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/FeedMooshroomDispenserBehavior.java index ae20338d..7c1a348d 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/FeedMooshroomDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/FeedMooshroomDispenserBehavior.java @@ -3,6 +3,7 @@ import java.util.List; import java.util.Optional; +import net.minecraft.registry.tag.ItemTags; import org.apache.commons.lang3.tuple.Pair; import carpetextra.mixins.MooshroomEntity_StatusEffectAccessorMixin; @@ -17,7 +18,6 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; -import net.minecraft.tag.ItemTags; import net.minecraft.util.math.BlockPointer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; @@ -34,7 +34,7 @@ protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { { // get brown mooshrooms in front of dispenser List mooshrooms = world.getEntitiesByType(EntityType.MOOSHROOM, new Box(frontBlockPos), EntityPredicates.VALID_LIVING_ENTITY.and((mooshroomEntity) -> { - return ((MooshroomEntity) mooshroomEntity).getMooshroomType() == MooshroomEntity.Type.BROWN; + return ((MooshroomEntity) mooshroomEntity).getVariant() == MooshroomEntity.Type.BROWN; })); // check all mooshrooms diff --git a/src/main/java/carpetextra/dispenser/behaviors/PlaceBoatOnIceDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/PlaceBoatOnIceDispenserBehavior.java index f8cbf709..b2344aad 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/PlaceBoatOnIceDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/PlaceBoatOnIceDispenserBehavior.java @@ -10,7 +10,7 @@ import net.minecraft.entity.vehicle.ChestBoatEntity; import net.minecraft.item.ItemStack; import net.minecraft.server.world.ServerWorld; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.math.BlockPointer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -40,7 +40,7 @@ public ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { } else { boatEntity = new BoatEntity(world, boatXPos, boatYPos, boatZPos); } - boatEntity.setBoatType(boatInfo.getType()); + boatEntity.setVariant(boatInfo.getType()); boatEntity.setYaw(dispenserFacing.asRotation()); world.spawnEntity(boatEntity); stack.decrement(1); diff --git a/src/main/java/carpetextra/mixins/AbstractButtonBlock_variableWoodMixin.java b/src/main/java/carpetextra/mixins/AbstractButtonBlock_variableWoodMixin.java index 8d0bf2ca..aec6de57 100644 --- a/src/main/java/carpetextra/mixins/AbstractButtonBlock_variableWoodMixin.java +++ b/src/main/java/carpetextra/mixins/AbstractButtonBlock_variableWoodMixin.java @@ -2,31 +2,47 @@ import carpetextra.CarpetExtraSettings; import carpetextra.utils.WoodDelayMultipliers; -import net.minecraft.block.AbstractButtonBlock; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.ButtonBlock; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(AbstractButtonBlock.class) +@Mixin(ButtonBlock.class) public abstract class AbstractButtonBlock_variableWoodMixin { - @Shadow protected abstract int getPressTicks(); - @Redirect(method = "powerOn", at = @At( value = "INVOKE", - target = "Lnet/minecraft/block/AbstractButtonBlock;getPressTicks()I" // getTickRate + target = "Lnet/minecraft/world/World;scheduleBlockTick(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;I)V" )) - private int getCustomTickRate(AbstractButtonBlock abstractButtonBlock, - BlockState blockState_1, World world_1, BlockPos blockPos_1) + private void getCustomTickRate(World instance, BlockPos blockPos, Block block, int i, + BlockState state, World world, BlockPos pos) { if (!CarpetExtraSettings.variableWoodDelays) { - return getPressTicks(); + instance.scheduleBlockTick(blockPos, block, i); + return; } - return WoodDelayMultipliers.getForDelay(blockState_1.getBlock(), getPressTicks()); + instance.scheduleBlockTick(blockPos, block, WoodDelayMultipliers.getForDelay(state.getBlock(), i)); } + + @Redirect(method = "tryPowerWithProjectiles", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/World;scheduleBlockTick(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;I)V" + )) + private void getCustomTickRateProjectiles(World instance, BlockPos blockPos, Block block, int i, + BlockState state, World world, BlockPos pos) + { + if (!CarpetExtraSettings.variableWoodDelays) + { + instance.scheduleBlockTick(blockPos, block, i); + return; + } + instance.scheduleBlockTick(blockPos, block, WoodDelayMultipliers.getForDelay(state.getBlock(), i)); + } + + } diff --git a/src/main/java/carpetextra/mixins/CactusBlock_fertilizerMixin.java b/src/main/java/carpetextra/mixins/CactusBlock_fertilizerMixin.java index d31a106e..ae64203e 100644 --- a/src/main/java/carpetextra/mixins/CactusBlock_fertilizerMixin.java +++ b/src/main/java/carpetextra/mixins/CactusBlock_fertilizerMixin.java @@ -10,13 +10,14 @@ import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockView; import net.minecraft.world.World; +import net.minecraft.world.WorldView; import org.spongepowered.asm.mixin.Mixin; @Mixin(CactusBlock.class) public abstract class CactusBlock_fertilizerMixin implements Fertilizable { @Override - public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) + public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { int i = this.countCactusAbove(world, pos); int j = this.countCactusBelow(world, pos); diff --git a/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java b/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java index acee210e..64992df0 100644 --- a/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java +++ b/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java @@ -102,7 +102,7 @@ private void tryCraft(ServerWorld world, BlockPos pos, CallbackInfo ci) if (!itemStack_3.isEmpty()) { if (itemStack_2.isEmpty()) { dispenserBlockEntity_1.setStack(int_1, itemStack_3); - } else if (ItemStack.areItemsEqualIgnoreDamage(itemStack_2, itemStack_3) && ItemStack.areNbtEqual(itemStack_2, itemStack_3)) { + } else if (itemStack_2.isItemEqual(itemStack_3) && ItemStack.areNbtEqual(itemStack_2, itemStack_3)) { itemStack_3.increment(itemStack_2.getCount()); dispenserBlockEntity_1.setStack(int_1, itemStack_3); } else { diff --git a/src/main/java/carpetextra/mixins/FallingBlockEntityMixin.java b/src/main/java/carpetextra/mixins/FallingBlockEntityMixin.java index 5207d2c0..b14390a4 100644 --- a/src/main/java/carpetextra/mixins/FallingBlockEntityMixin.java +++ b/src/main/java/carpetextra/mixins/FallingBlockEntityMixin.java @@ -8,7 +8,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.FallingBlockEntity; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/carpetextra/mixins/FarmerVillagerTask_wartFarmMixin.java b/src/main/java/carpetextra/mixins/FarmerVillagerTask_wartFarmMixin.java index 1e653437..99bdb71e 100644 --- a/src/main/java/carpetextra/mixins/FarmerVillagerTask_wartFarmMixin.java +++ b/src/main/java/carpetextra/mixins/FarmerVillagerTask_wartFarmMixin.java @@ -9,7 +9,7 @@ import net.minecraft.entity.ai.brain.MemoryModuleState; import net.minecraft.entity.ai.brain.MemoryModuleType; import net.minecraft.entity.ai.brain.task.FarmerVillagerTask; -import net.minecraft.entity.ai.brain.task.Task; +import net.minecraft.entity.ai.brain.task.MultiTickTask; import net.minecraft.entity.passive.VillagerEntity; import net.minecraft.inventory.SimpleInventory; import net.minecraft.item.ItemStack; @@ -30,7 +30,7 @@ import java.util.Map; @Mixin(FarmerVillagerTask.class) -public abstract class FarmerVillagerTask_wartFarmMixin extends Task +public abstract class FarmerVillagerTask_wartFarmMixin extends MultiTickTask { //@Shadow private boolean ableToPlant; @Shadow /*@Nullable*/ private BlockPos currentTarget; diff --git a/src/main/java/carpetextra/mixins/HopperMinecartEntity_transferItemsOutFeatureMixin.java b/src/main/java/carpetextra/mixins/HopperMinecartEntity_transferItemsOutFeatureMixin.java index 016678ec..897715db 100644 --- a/src/main/java/carpetextra/mixins/HopperMinecartEntity_transferItemsOutFeatureMixin.java +++ b/src/main/java/carpetextra/mixins/HopperMinecartEntity_transferItemsOutFeatureMixin.java @@ -13,7 +13,7 @@ import net.minecraft.inventory.Inventory; import net.minecraft.inventory.SidedInventory; import net.minecraft.item.ItemStack; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; diff --git a/src/main/java/carpetextra/mixins/LilyPadBlock_fertilizerMixin.java b/src/main/java/carpetextra/mixins/LilyPadBlock_fertilizerMixin.java index 105f197f..3ac0ea7e 100644 --- a/src/main/java/carpetextra/mixins/LilyPadBlock_fertilizerMixin.java +++ b/src/main/java/carpetextra/mixins/LilyPadBlock_fertilizerMixin.java @@ -10,6 +10,7 @@ import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockView; import net.minecraft.world.World; +import net.minecraft.world.WorldView; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -18,7 +19,7 @@ public abstract class LilyPadBlock_fertilizerMixin implements Fertilizable { @Shadow protected abstract boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos); @Override - public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) { + public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { return CarpetExtraSettings.betterBonemeal; } diff --git a/src/main/java/carpetextra/mixins/LivingEntityMixin.java b/src/main/java/carpetextra/mixins/LivingEntityMixin.java index c30965d0..c389130a 100644 --- a/src/main/java/carpetextra/mixins/LivingEntityMixin.java +++ b/src/main/java/carpetextra/mixins/LivingEntityMixin.java @@ -10,7 +10,7 @@ import net.minecraft.entity.mob.SpiderEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/carpetextra/mixins/StrayEntityMixin.java b/src/main/java/carpetextra/mixins/StrayEntityMixin.java index 80ad35c0..df2e86f3 100644 --- a/src/main/java/carpetextra/mixins/StrayEntityMixin.java +++ b/src/main/java/carpetextra/mixins/StrayEntityMixin.java @@ -2,9 +2,9 @@ import carpetextra.CarpetExtraSettings; import net.minecraft.entity.mob.StrayEntity; +import net.minecraft.registry.RegistryKeys; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.Registry; import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.gen.structure.Structure; import net.minecraft.world.gen.structure.StructureKeys; @@ -22,7 +22,7 @@ private static boolean isSkylightOrIglooVisible(ServerWorldAccess serverWorldAcc if (!CarpetExtraSettings.straySpawningInIgloos) { return serverWorldAccess.isSkyVisible(pos); } - Structure structure = serverWorldAccess.getRegistryManager().get(Registry.STRUCTURE_KEY).get(StructureKeys.IGLOO); + Structure structure = serverWorldAccess.getRegistryManager().get(RegistryKeys.STRUCTURE).get(StructureKeys.IGLOO); return serverWorldAccess.isSkyVisible(pos) || ((ServerWorld)serverWorldAccess).getStructureAccessor().getStructureAt(pos,structure).hasChildren(); } diff --git a/src/main/java/carpetextra/mixins/SugarCaneBlock_fertilizerMixin.java b/src/main/java/carpetextra/mixins/SugarCaneBlock_fertilizerMixin.java index b1cdc419..d4ded1f7 100644 --- a/src/main/java/carpetextra/mixins/SugarCaneBlock_fertilizerMixin.java +++ b/src/main/java/carpetextra/mixins/SugarCaneBlock_fertilizerMixin.java @@ -7,13 +7,14 @@ import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockView; import net.minecraft.world.World; +import net.minecraft.world.WorldView; import org.spongepowered.asm.mixin.Mixin; @Mixin(SugarCaneBlock.class) public abstract class SugarCaneBlock_fertilizerMixin implements Fertilizable { @Override - public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) + public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { int i = this.countSugarCaneAbove(world, pos); int j = this.countSugarCaneBelow(world, pos); diff --git a/src/main/java/carpetextra/mixins/VillagerProfession_wartFarmMixin.java b/src/main/java/carpetextra/mixins/VillagerProfession_wartFarmMixin.java index bc64876c..dff187df 100644 --- a/src/main/java/carpetextra/mixins/VillagerProfession_wartFarmMixin.java +++ b/src/main/java/carpetextra/mixins/VillagerProfession_wartFarmMixin.java @@ -5,8 +5,8 @@ import net.minecraft.block.Blocks; import net.minecraft.item.Item; import net.minecraft.item.Items; +import net.minecraft.registry.RegistryKey; import net.minecraft.sound.SoundEvent; -import net.minecraft.util.registry.RegistryKey; import net.minecraft.village.VillagerProfession; import net.minecraft.world.poi.PointOfInterestType; import org.spongepowered.asm.mixin.Mixin; @@ -20,7 +20,7 @@ public abstract class VillagerProfession_wartFarmMixin { @Shadow static VillagerProfession register(String string, RegistryKey pointOfInterestType, ImmutableSet immutableSet, ImmutableSet immutableSet2, /*@Nullable*/ SoundEvent soundEvent) {return null;}; - @Inject(method = "Lnet/minecraft/village/VillagerProfession;register(Ljava/lang/String;Lnet/minecraft/util/registry/RegistryKey;Lnet/minecraft/sound/SoundEvent;)Lnet/minecraft/village/VillagerProfession;", cancellable = true, at = @At("HEAD")) + @Inject(method = "register(Ljava/lang/String;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/sound/SoundEvent;)Lnet/minecraft/village/VillagerProfession;", cancellable = true, at = @At("HEAD")) private static void registerCleric(String key, RegistryKey pointOfInterestType, SoundEvent soundEvent, CallbackInfoReturnable cir) { if (key.equals("cleric")) diff --git a/src/main/java/carpetextra/utils/VoidContainer.java b/src/main/java/carpetextra/utils/VoidContainer.java index 675d42a6..a02e4f22 100644 --- a/src/main/java/carpetextra/utils/VoidContainer.java +++ b/src/main/java/carpetextra/utils/VoidContainer.java @@ -14,7 +14,7 @@ public class VoidContainer extends ScreenHandler public void onContentChanged(Inventory inventory_1) { } @Override - public ItemStack transferSlot(PlayerEntity player, int index) { + public ItemStack quickMove(PlayerEntity player, int index) { throw new IllegalStateException("Didn't expect transferSlot to be called in fake container"); } } \ No newline at end of file