diff --git a/src/main/java/carpetextra/dispenser/behaviors/BlazePowderDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/BlazePowderDispenserBehavior.java index 9a0c768b..f53b7120 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/BlazePowderDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/BlazePowderDispenserBehavior.java @@ -1,11 +1,16 @@ package carpetextra.dispenser.behaviors; -import net.minecraft.block.*; -import net.minecraft.block.dispenser.*; -import net.minecraft.item.*; -import net.minecraft.server.world.*; -import net.minecraft.util.math.*; -import net.minecraft.world.*; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.DispenserBlock; +import net.minecraft.block.NetherWartBlock; +import net.minecraft.block.dispenser.FallibleItemDispenserBehavior; +import net.minecraft.item.ItemStack; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.math.BlockPointer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.WorldEvents; public class BlazePowderDispenserBehavior extends FallibleItemDispenserBehavior { @Override diff --git a/src/main/java/carpetextra/dispenser/behaviors/CarvePumpkinDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/CarvePumpkinDispenserBehavior.java index 7ccf783f..3cc782ef 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/CarvePumpkinDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/CarvePumpkinDispenserBehavior.java @@ -1,12 +1,20 @@ package carpetextra.dispenser.behaviors; -import net.minecraft.block.*; -import net.minecraft.block.dispenser.*; -import net.minecraft.item.*; -import net.minecraft.server.world.*; -import net.minecraft.sound.*; -import net.minecraft.util.math.*; -import net.minecraft.world.event.*; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.CarvedPumpkinBlock; +import net.minecraft.block.DispenserBlock; +import net.minecraft.block.dispenser.FallibleItemDispenserBehavior; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvents; +import net.minecraft.util.math.BlockPointer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.event.GameEvent; public class CarvePumpkinDispenserBehavior extends FallibleItemDispenserBehavior { @Override diff --git a/src/main/java/carpetextra/dispenser/behaviors/CauldronWaterDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/CauldronWaterDispenserBehavior.java index 8649120d..63d74156 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/CauldronWaterDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/CauldronWaterDispenserBehavior.java @@ -1,17 +1,30 @@ package carpetextra.dispenser.behaviors; -import carpetextra.dispenser.*; -import net.minecraft.block.*; -import net.minecraft.component.*; -import net.minecraft.component.type.*; -import net.minecraft.item.*; -import net.minecraft.potion.*; -import net.minecraft.registry.entry.*; -import net.minecraft.registry.tag.*; -import net.minecraft.server.world.*; -import net.minecraft.sound.*; -import net.minecraft.util.math.*; -import net.minecraft.world.event.*; +import carpetextra.dispenser.DispenserBehaviorHelper; +import net.minecraft.block.AbstractCauldronBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.DispenserBlock; +import net.minecraft.block.LeveledCauldronBlock; +import net.minecraft.block.ShulkerBoxBlock; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.BannerPatternsComponent; +import net.minecraft.component.type.PotionContentsComponent; +import net.minecraft.item.BannerItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.potion.Potions; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.minecraft.sound.SoundEvents; +import net.minecraft.util.math.BlockPointer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.event.GameEvent; public class CauldronWaterDispenserBehavior extends DispenserBehaviorHelper { @Override @@ -23,13 +36,13 @@ protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { BlockState frontBlockState = world.getBlockState(frontBlockPos); Block frontBlock = frontBlockState.getBlock(); - if(frontBlock == Blocks.WATER_CAULDRON) { - if(item == Items.POTION) { + if (frontBlock == Blocks.WATER_CAULDRON) { + if (item == Items.POTION) { // check if it's a water bottle (https://minecraft.wiki/w/Potion#Base_potions) - var potionContentsComponent = stack.get(DataComponentTypes.POTION_CONTENTS); + PotionContentsComponent potionContentsComponent = stack.get(DataComponentTypes.POTION_CONTENTS); if (potionContentsComponent != null && potionContentsComponent.matches(Potions.WATER)) { // check if cauldron is not full - if(!((AbstractCauldronBlock) frontBlock).isFull(frontBlockState)) { + if (!((AbstractCauldronBlock) frontBlock).isFull(frontBlockState)) { // increase cauldron level int level = frontBlockState.get(LeveledCauldronBlock.LEVEL); BlockState cauldronState = frontBlockState.with(LeveledCauldronBlock.LEVEL, level + 1); @@ -40,15 +53,15 @@ protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { } } } - else if(item == Items.GLASS_BOTTLE) { + else if (item == Items.GLASS_BOTTLE) { // decrease cauldron level LeveledCauldronBlock.decrementFluidLevel(frontBlockState, world, frontBlockPos); // return water bottle return this.addOrDispense(pointer, stack, PotionContentsComponent.createStack(Items.POTION, Potions.WATER)); } - else if(Block.getBlockFromItem(item) instanceof ShulkerBoxBlock) { + else if (Block.getBlockFromItem(item) instanceof ShulkerBoxBlock) { // make sure item isn't plain shulker box - if(item != Items.SHULKER_BOX) { + if (item != Items.SHULKER_BOX) { // decrease cauldron level LeveledCauldronBlock.decrementFluidLevel(frontBlockState, world, frontBlockPos); // turn dyed shulker box into undyed shulker box @@ -58,9 +71,9 @@ else if(Block.getBlockFromItem(item) instanceof ShulkerBoxBlock) { return this.addOrDispense(pointer, stack, undyedShulkerBox); } } - if(stack.isIn(ItemTags.DYEABLE)) { + if (stack.isIn(ItemTags.DYEABLE)) { // check if dyeable item has color - if(stack.contains(DataComponentTypes.DYED_COLOR)) { + if (stack.contains(DataComponentTypes.DYED_COLOR)) { // decrease cauldron level LeveledCauldronBlock.decrementFluidLevel(frontBlockState, world, frontBlockPos); // remove color @@ -69,7 +82,7 @@ else if(Block.getBlockFromItem(item) instanceof ShulkerBoxBlock) { return stack; } } - else if(item instanceof BannerItem) { + else if (item instanceof BannerItem) { // check if banner has layers (https://minecraft.wiki/w/Banner#Patterns) BannerPatternsComponent bannerPatternsComponent = stack.getOrDefault(DataComponentTypes.BANNER_PATTERNS, BannerPatternsComponent.DEFAULT); if (!bannerPatternsComponent.layers().isEmpty()) { @@ -87,7 +100,7 @@ else if(item instanceof BannerItem) { } else if(frontBlock == Blocks.CAULDRON && item == Items.POTION) { // check if it's a water bottle (https://minecraft.wiki/w/Potion#Base_potions) - var potionContentsComponent = stack.get(DataComponentTypes.POTION_CONTENTS); + PotionContentsComponent potionContentsComponent = stack.get(DataComponentTypes.POTION_CONTENTS); if (potionContentsComponent != null && potionContentsComponent.matches(Potions.WATER)) { // increase cauldron level BlockState cauldronState = Blocks.WATER_CAULDRON.getDefaultState(); @@ -116,7 +129,7 @@ public static boolean isWaterCauldronItem(ItemStack stack) { if (item == Items.GLASS_BOTTLE || item instanceof BannerItem) return true; if (item == Items.POTION) { - var potionContentsComponent = stack.getComponents().get(DataComponentTypes.POTION_CONTENTS); + PotionContentsComponent potionContentsComponent = stack.getComponents().get(DataComponentTypes.POTION_CONTENTS); return potionContentsComponent != null && potionContentsComponent.matches(Potions.WATER); } if (Block.getBlockFromItem(item) instanceof ShulkerBoxBlock) { diff --git a/src/main/java/carpetextra/dispenser/behaviors/FeedMooshroomDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/FeedMooshroomDispenserBehavior.java index cf10b75f..68bc1ac2 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/FeedMooshroomDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/FeedMooshroomDispenserBehavior.java @@ -1,14 +1,19 @@ package carpetextra.dispenser.behaviors; +import java.util.List; +import java.util.Optional; + +import net.minecraft.registry.tag.ItemTags; + import carpetextra.mixins.MooshroomEntity_StatusEffectAccessorMixin; import net.minecraft.block.DispenserBlock; import net.minecraft.block.dispenser.FallibleItemDispenserBehavior; +import net.minecraft.component.type.SuspiciousStewEffectsComponent; import net.minecraft.entity.EntityType; import net.minecraft.entity.passive.MooshroomEntity; import net.minecraft.item.ItemStack; import net.minecraft.particle.ParticleTypes; import net.minecraft.predicate.entity.EntityPredicates; -import net.minecraft.registry.tag.ItemTags; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; @@ -16,8 +21,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; -import java.util.List; - public class FeedMooshroomDispenserBehavior extends FallibleItemDispenserBehavior { @Override protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { @@ -40,7 +43,7 @@ protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { // check if mooshroom has no stew effect if (mooshroomAccessor.getStewEffects() == null) { // get stew effect and length for flower - var effect = mooshroomAccessor.invokeGetStewEffectFrom(stack); + Optional effect = mooshroomAccessor.invokeGetStewEffectFrom(stack); // check if effect is present if (effect.isPresent()) { diff --git a/src/main/java/carpetextra/dispenser/behaviors/MilkMooshroomDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/MilkMooshroomDispenserBehavior.java index 085e3179..70c8c8e8 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/MilkMooshroomDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/MilkMooshroomDispenserBehavior.java @@ -1,9 +1,12 @@ package carpetextra.dispenser.behaviors; +import java.util.List; + import carpetextra.dispenser.DispenserBehaviorHelper; import carpetextra.mixins.MooshroomEntity_StatusEffectAccessorMixin; import net.minecraft.block.DispenserBlock; import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.SuspiciousStewEffectsComponent; import net.minecraft.entity.EntityType; import net.minecraft.entity.passive.MooshroomEntity; import net.minecraft.item.ItemStack; @@ -17,8 +20,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; -import java.util.List; - public class MilkMooshroomDispenserBehavior extends DispenserBehaviorHelper { @Override protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { @@ -56,7 +57,7 @@ private static ItemStack getStewType(List mooshrooms) { for (MooshroomEntity mooshroom : mooshrooms) { // from MooshroomEntity#interact MooshroomEntity_StatusEffectAccessorMixin mooshroomAccessor = (MooshroomEntity_StatusEffectAccessorMixin) mooshroom; - var stewEffects = mooshroomAccessor.getStewEffects(); + SuspiciousStewEffectsComponent stewEffects = mooshroomAccessor.getStewEffects(); if (stewEffects != null) { // create suspicious stew and add mooshroom's stew effect to it ItemStack stewStack = new ItemStack(Items.SUSPICIOUS_STEW); diff --git a/src/main/java/carpetextra/dispenser/behaviors/ShearChickenDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/ShearChickenDispenserBehavior.java index 2220ea0f..df9bfc06 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/ShearChickenDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/ShearChickenDispenserBehavior.java @@ -1,5 +1,7 @@ package carpetextra.dispenser.behaviors; +import java.util.List; + import net.minecraft.block.DispenserBlock; import net.minecraft.block.dispenser.FallibleItemDispenserBehavior; import net.minecraft.entity.EntityType; @@ -13,8 +15,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; -import java.util.List; - public class ShearChickenDispenserBehavior extends FallibleItemDispenserBehavior { @Override protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { diff --git a/src/main/java/carpetextra/dispenser/behaviors/StripBlocksDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/StripBlocksDispenserBehavior.java index 4083022e..2408a5dd 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/StripBlocksDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/StripBlocksDispenserBehavior.java @@ -1,5 +1,8 @@ package carpetextra.dispenser.behaviors; +import java.util.Collection; +import java.util.Set; + import carpetextra.dispenser.DispenserItemUsageContext; import carpetextra.mixins.AxeItem_StrippedBlocksAccessorMixin; import net.minecraft.block.Block; @@ -17,9 +20,6 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import java.util.Collection; -import java.util.Set; - public class StripBlocksDispenserBehavior extends FallibleItemDispenserBehavior { // stripable blocks public static final Set STRIPPED_BLOCKS = AxeItem_StrippedBlocksAccessorMixin.getStrippedBlocks().keySet(); diff --git a/src/main/java/carpetextra/dispenser/behaviors/TillSoilDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/TillSoilDispenserBehavior.java index e97dd0af..6c27ce51 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/TillSoilDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/TillSoilDispenserBehavior.java @@ -1,5 +1,7 @@ package carpetextra.dispenser.behaviors; +import java.util.Set; + import carpetextra.dispenser.DispenserItemUsageContext; import carpetextra.mixins.HoeItem_TilledBlocksAccessorMixin; import net.minecraft.block.Block; @@ -15,8 +17,6 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import java.util.Set; - public class TillSoilDispenserBehavior extends FallibleItemDispenserBehavior { public static final Set TILLED_BLOCKS = HoeItem_TilledBlocksAccessorMixin.getTilledBlocks().keySet(); diff --git a/src/main/java/carpetextra/dispenser/behaviors/ToggleBlockDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/ToggleBlockDispenserBehavior.java index 0a243915..d4ad42c5 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/ToggleBlockDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/ToggleBlockDispenserBehavior.java @@ -50,11 +50,11 @@ protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { BlockState frontBlockState = world.getBlockState(frontBlockPos); // check if block can be toggled - if(TOGGLEABLE_BLOCKS.contains(frontBlockState.getBlock())) { + if (TOGGLEABLE_BLOCKS.contains(frontBlockState.getBlock())) { BlockHitResult hitResult = new BlockHitResult(Vec3d.of(frontBlockPos), dispenserFacing.getOpposite(), frontBlockPos, false); // use on block, test if successful - if(frontBlockState.onUse(world, null, hitResult).isAccepted()) { + if (frontBlockState.onUse(world, null, hitResult).isAccepted()) { return stack; } } diff --git a/src/main/java/carpetextra/mixins/DispenserBehaviorCarvedPumpkinMixin.java b/src/main/java/carpetextra/mixins/DispenserBehaviorCarvedPumpkinMixin.java index b2d6988b..fcccdd92 100644 --- a/src/main/java/carpetextra/mixins/DispenserBehaviorCarvedPumpkinMixin.java +++ b/src/main/java/carpetextra/mixins/DispenserBehaviorCarvedPumpkinMixin.java @@ -1,14 +1,15 @@ package carpetextra.mixins; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + import carpetextra.utils.PlaceBlockDispenserBehavior; import net.minecraft.block.dispenser.FallibleItemDispenserBehavior; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPointer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(targets = "net/minecraft/block/dispenser/DispenserBehavior$5") public abstract class DispenserBehaviorCarvedPumpkinMixin extends FallibleItemDispenserBehavior { diff --git a/src/main/java/carpetextra/mixins/DispenserBehaviorMobHeadMixin.java b/src/main/java/carpetextra/mixins/DispenserBehaviorMobHeadMixin.java index e4f061ad..fae54b0d 100644 --- a/src/main/java/carpetextra/mixins/DispenserBehaviorMobHeadMixin.java +++ b/src/main/java/carpetextra/mixins/DispenserBehaviorMobHeadMixin.java @@ -1,14 +1,15 @@ package carpetextra.mixins; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + import carpetextra.utils.PlaceBlockDispenserBehavior; import net.minecraft.block.dispenser.FallibleItemDispenserBehavior; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPointer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(targets = { /* mob & player heads */ diff --git a/src/main/java/carpetextra/mixins/DispenserBlock_GetCustomBehaviorMixin.java b/src/main/java/carpetextra/mixins/DispenserBlock_GetCustomBehaviorMixin.java index 7d43a191..d13b8ac2 100644 --- a/src/main/java/carpetextra/mixins/DispenserBlock_GetCustomBehaviorMixin.java +++ b/src/main/java/carpetextra/mixins/DispenserBlock_GetCustomBehaviorMixin.java @@ -1,5 +1,15 @@ package carpetextra.mixins; +import java.util.Map; + +import org.spongepowered.asm.mixin.Final; +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.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + import carpet.script.value.Value; import carpet.script.value.ValueConversions; import carpetextra.dispenser.CarpetExtraDispenserBehaviors; @@ -13,15 +23,6 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPointer; import net.minecraft.util.math.BlockPos; -import org.spongepowered.asm.mixin.Final; -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.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -import java.util.Map; @Mixin(DispenserBlock.class) public abstract class DispenserBlock_GetCustomBehaviorMixin { diff --git a/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java b/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java index 1e0d288e..7e328c86 100644 --- a/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java +++ b/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java @@ -1,5 +1,7 @@ package carpetextra.mixins; +import java.util.Random; + import carpetextra.CarpetExtraSettings; import carpetextra.fakes.DispenserBlockEntityInterface; import carpetextra.utils.VoidContainer; @@ -26,8 +28,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.Random; - @Mixin(DropperBlock.class) public class DropperBlock_craftingMixin extends DispenserBlock { diff --git a/src/main/java/carpetextra/mixins/FallingBlockEntityMixin.java b/src/main/java/carpetextra/mixins/FallingBlockEntityMixin.java index 9f7b672f..6a19dcce 100644 --- a/src/main/java/carpetextra/mixins/FallingBlockEntityMixin.java +++ b/src/main/java/carpetextra/mixins/FallingBlockEntityMixin.java @@ -7,6 +7,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.FallingBlockEntity; + import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -31,18 +32,18 @@ public abstract class FallingBlockEntityMixin extends Entity Blocks.ICE, Blocks.PACKED_ICE, Blocks.PACKED_ICE, Blocks.BLUE_ICE ); - + public FallingBlockEntityMixin(EntityType type, World world) { super(type, world); } - + @Inject(method = "(Lnet/minecraft/world/World;DDDLnet/minecraft/block/BlockState;)V", at = @At("RETURN")) private void onCtor(World world, double x, double y, double z, BlockState state, CallbackInfo ci) { this.iceCount = 0; } - + @Inject(method = "tick", cancellable = true, at = @At( value = "FIELD", target = "Lnet/minecraft/entity/FallingBlockEntity;destroyedOnLanding:Z", diff --git a/src/main/java/carpetextra/mixins/FlowerPotBlockMixin.java b/src/main/java/carpetextra/mixins/FlowerPotBlockMixin.java index 301834b4..4f2aa8a9 100644 --- a/src/main/java/carpetextra/mixins/FlowerPotBlockMixin.java +++ b/src/main/java/carpetextra/mixins/FlowerPotBlockMixin.java @@ -1,24 +1,24 @@ package carpetextra.mixins; +import org.spongepowered.asm.mixin.Final; +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.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + import carpetextra.helpers.FlowerPotHelper; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.FlowerPotBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.ItemActionResult; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Final; -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.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(FlowerPotBlock.class) public abstract class FlowerPotBlockMixin extends Block diff --git a/src/main/java/carpetextra/mixins/LivingEntityMixin.java b/src/main/java/carpetextra/mixins/LivingEntityMixin.java index 4f72df0f..30cac82a 100644 --- a/src/main/java/carpetextra/mixins/LivingEntityMixin.java +++ b/src/main/java/carpetextra/mixins/LivingEntityMixin.java @@ -58,4 +58,4 @@ private void onOnDeath(DamageSource source, CallbackInfo ci) this.dropStack(new ItemStack(Items.ENCHANTED_GOLDEN_APPLE)); } } -} +} \ No newline at end of file diff --git a/src/main/java/carpetextra/mixins/MooshroomEntity_StatusEffectAccessorMixin.java b/src/main/java/carpetextra/mixins/MooshroomEntity_StatusEffectAccessorMixin.java index d70613b9..5af5a75f 100644 --- a/src/main/java/carpetextra/mixins/MooshroomEntity_StatusEffectAccessorMixin.java +++ b/src/main/java/carpetextra/mixins/MooshroomEntity_StatusEffectAccessorMixin.java @@ -1,13 +1,15 @@ package carpetextra.mixins; -import net.minecraft.component.type.SuspiciousStewEffectsComponent; -import net.minecraft.entity.passive.MooshroomEntity; -import net.minecraft.item.ItemStack; +import java.util.Optional; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; -import java.util.Optional; +import net.minecraft.component.type.SuspiciousStewEffectsComponent; +import net.minecraft.entity.passive.MooshroomEntity; +import net.minecraft.item.ItemStack; + @Mixin(MooshroomEntity.class) public interface MooshroomEntity_StatusEffectAccessorMixin { diff --git a/src/main/resources/carpet-extra.mixins.json b/src/main/resources/carpet-extra.mixins.json index 4a146075..d17f9cab 100644 --- a/src/main/resources/carpet-extra.mixins.json +++ b/src/main/resources/carpet-extra.mixins.json @@ -3,69 +3,72 @@ "package": "carpetextra.mixins", "compatibilityLevel": "JAVA_17", "mixins": [ - "AbstractButtonBlock_variableWoodMixin", - "AbstractPressurePlateBlock_variableWoodMixin", - "AbstractRedstoneGateBlockMixin", - "AnimalEntity_dispenserMixin", - "AxeItem_StrippedBlocksAccessorMixin", - "BlockItemMixin_accurateBlockPlacement", - "BoatItemAccessorMixin", - "CactusBlock_fertilizerMixin", - "CactusBlock_syncMixin", - "ChickenEntityMixin", - "ChunkGeneratorMixin", - "ComparatorBlock_comparatorBetterItemFramesMixin", - "ComparatorBlock_playerAbilityMixin", - "DaylightDetectorBlockMixin", - "DispenserBehaviorCarpetsMixin", - "DispenserBehaviorCarvedPumpkinMixin", - "DispenserBehaviorChestMixin", - "DispenserBehaviorGlowstoneMixin", - "DispenserBehaviorMobHeadMixin", - "DispenserBlock_fallingBlockMixin", - "DispenserBlock_GetCustomBehaviorMixin", - "DispenserBlockEntity_craftingMixin", - "DispenserBlockMixin", - "DropperBlock_craftingMixin", - "EntityMixin", - "FallingBlockEntityAccessor", - "FallingBlockEntityMixin", - "FallingBlockMixin", - "FarmerVillagerTask_wartFarmMixin", - "FlowerPotBlock_ContentAccessorMixin", - "FlowerPotBlockMixin", - "FoxMateGoalMixin", - "HoeItem_TilledBlocksAccessorMixin", - "HopperMinecartEntity_transferItemsOutFeatureMixin", - "ItemFrameEntity_comparatorReadsClockMixin", - "ItemStackMixin", - "LilyPadBlock_fertilizerMixin", - "LivingEntityMixin", - "MooshroomEntity_StatusEffectAccessorMixin", - "NetherWartBlock_fertilizerMixin", - "NoteBlockMixin", - "PistonBlockMixin", - "PlayerEntityMixin", - "RedstoneWireBlockMixin", - "RedstoneWireBlockMixin_pistonRedirectsRedstone", - "RepeaterBlockMixin", - "SaplingBlock_syncMixin", - "ScaffoldingBlock_scaffoldingDistanceMixin", - "ScaffoldingItem_scaffoldingDistanceMixin", - "SculkCatalystMixin", - "SecondaryPointOfInterestSensor_wartFarmMixin", - "ServerPlayNetworkHandlerMixin", - "SkeletonEntityMixin", - "SpiderEntityMixin", - "SpongeBlockMixin", - "StrayEntityMixin", - "SugarCaneBlock_fertilizerMixin", - "SugarCaneBlock_syncMixin", - "ThrownEntityMixin", - "TurtleMateGoalMixin", - "VillagerEntity_wartFarmMixin", - "VillagerProfession_wartFarmMixin", - "VillagerTaskListProvider_wartFarmMixin" + "DispenserBlockMixin", + "FallingBlockEntityMixin", + "RepeaterBlockMixin", + "ComparatorBlock_comparatorBetterItemFramesMixin", + "ComparatorBlock_playerAbilityMixin", + "DaylightDetectorBlockMixin", + "AnimalEntity_dispenserMixin", + "FoxMateGoalMixin", + "TurtleMateGoalMixin", + "AbstractPressurePlateBlock_variableWoodMixin", + "AbstractButtonBlock_variableWoodMixin", + "ItemFrameEntity_comparatorReadsClockMixin", + "ItemStackMixin", + "ServerPlayNetworkHandlerMixin", + "ThrownEntityMixin", + "BlockItemMixin_accurateBlockPlacement", + "HopperMinecartEntity_transferItemsOutFeatureMixin", + "SpongeBlockMixin", + "DropperBlock_craftingMixin", + "DispenserBlockEntity_craftingMixin", + + "DispenserBlock_GetCustomBehaviorMixin", + "DispenserBehaviorCarpetsMixin", + "DispenserBehaviorChestMixin", + "DispenserBehaviorGlowstoneMixin", + "DispenserBehaviorCarvedPumpkinMixin", + "DispenserBehaviorMobHeadMixin", + "MooshroomEntity_StatusEffectAccessorMixin", + "HoeItem_TilledBlocksAccessorMixin", + "AxeItem_StrippedBlocksAccessorMixin", + "FlowerPotBlock_ContentAccessorMixin", + "BoatItemAccessorMixin", + "SculkCatalystMixin", + + "VillagerEntity_wartFarmMixin", + "FarmerVillagerTask_wartFarmMixin", + "VillagerTaskListProvider_wartFarmMixin", + "VillagerProfession_wartFarmMixin", + "SecondaryPointOfInterestSensor_wartFarmMixin", + "NoteBlockMixin", + "RedstoneWireBlockMixin", + "NetherWartBlock_fertilizerMixin", + "RedstoneWireBlockMixin_pistonRedirectsRedstone", + + "PlayerEntityMixin", + "PistonBlockMixin", + "CactusBlock_syncMixin", + "SaplingBlock_syncMixin", + "SugarCaneBlock_syncMixin", + "ChunkGeneratorMixin", + "FallingBlockMixin", + "ChickenEntityMixin", + "LivingEntityMixin", + "FlowerPotBlockMixin", + "EntityMixin", + "AbstractRedstoneGateBlockMixin", + "StrayEntityMixin", + "SkeletonEntityMixin", + "SpiderEntityMixin", + "ScaffoldingBlock_scaffoldingDistanceMixin", + "ScaffoldingItem_scaffoldingDistanceMixin", + "SugarCaneBlock_fertilizerMixin", + "CactusBlock_fertilizerMixin", + "LilyPadBlock_fertilizerMixin", + "DispenserBlock_fallingBlockMixin", + "FallingBlockEntityAccessor" ], "injectors": { "defaultRequire": 1 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 37d22d98..a2b00270 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,7 +29,7 @@ "depends": { "fabricloader": ">=0.15.11", "carpet": ">=1.4.141", - "minecraft": ["1.20.6"], + "minecraft": ["1.20.5", "1.20.6"], "java": ">=21" }, "custom": {