diff --git a/src/main/java/com/teamabnormals/atmospheric/core/mixin/PandaBreedGoalMixin.java b/src/main/java/com/teamabnormals/atmospheric/core/mixin/PandaBreedGoalMixin.java new file mode 100644 index 00000000..a713d041 --- /dev/null +++ b/src/main/java/com/teamabnormals/atmospheric/core/mixin/PandaBreedGoalMixin.java @@ -0,0 +1,26 @@ +package com.teamabnormals.atmospheric.core.mixin; + +import com.teamabnormals.atmospheric.core.registry.AtmosphericBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.ai.goal.BreedGoal; +import net.minecraft.world.entity.animal.Animal; +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 org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin(targets = "net.minecraft.world.entity.animal.Panda$PandaBreedGoal") +public abstract class PandaBreedGoalMixin extends BreedGoal { + + private PandaBreedGoalMixin(Animal animal, double speed) { + super(animal, speed); + } + + @Inject(method = "canFindBamboo", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/BlockPos$MutableBlockPos;setWithOffset(Lnet/minecraft/core/Vec3i;III)Lnet/minecraft/core/BlockPos$MutableBlockPos;", shift = At.Shift.AFTER), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) + private void canFindBamboo(CallbackInfoReturnable cir, BlockPos blockPos, BlockPos.MutableBlockPos blockpos$mutableblockpos, int i, int j, int k, int l) { + if (this.level.getBlockState(blockpos$mutableblockpos).is(AtmosphericBlocks.SNOWY_BAMBOO.get())) { + cir.setReturnValue(true); + } + } +} \ No newline at end of file diff --git a/src/main/resources/atmospheric.mixins.json b/src/main/resources/atmospheric.mixins.json index f259b835..cc6bb0d8 100644 --- a/src/main/resources/atmospheric.mixins.json +++ b/src/main/resources/atmospheric.mixins.json @@ -9,6 +9,7 @@ "BlockMixin", "CamelMixin", "EntityMixin", + "PandaBreedGoalMixin", "PistonBaseBlockMixin", "ServerLevelMixin", "ShearsItemMixin",