fix: disallow zombie picking up egg, rotten flesh, string, bone, arrow and wheat seeds
This commit is contained in:
2 files changed
+35
-11
No files matched your search
@@ -0,0 +1,24 @@
|
||||
package io.ib67.sfcraft.mixin.common;
|
||||
|
||||
import net.minecraft.world.entity.monster.zombie.Zombie;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
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(Zombie.class)
|
||||
public abstract class ZombieMixin {
|
||||
@Inject(method = "canHoldItem", at = @At("HEAD"), cancellable = true)
|
||||
public void canHoldItem(final ItemStack itemStack, final CallbackInfoReturnable<Boolean> cir) {
|
||||
cir.setReturnValue(!(itemStack.is(Items.EGG)
|
||||
|| itemStack.is(Items.ROTTEN_FLESH)
|
||||
|| itemStack.is(Items.STRING))
|
||||
|| itemStack.is(Items.BONE)
|
||||
|| itemStack.is(Items.ARROW)
|
||||
|| itemStack.is(Items.WHEAT_SEEDS)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,21 +4,21 @@
|
||||
"package": "io.ib67.sfcraft.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"common.bridge.EntityBridge",
|
||||
"common.bridge.ItemBridge",
|
||||
"common.bridge.ServerPlayerBridge",
|
||||
"common.bridge.ServerWorldBridge",
|
||||
"common.bridge.ServerChunkManagerBridge",
|
||||
"common.fixes.EndermanEntityMixin",
|
||||
"common.fixes.ProjectileEntityMixin",
|
||||
"common.fixes.LivingEntityMixin",
|
||||
"common.EntityMixin",
|
||||
"common.MobEntityMixin",
|
||||
"common.PlayerEntityMixin"
|
||||
],
|
||||
"client": [
|
||||
],
|
||||
"server": [
|
||||
"common.EntityMixin",
|
||||
"common.MobEntityMixin",
|
||||
"common.PlayerEntityMixin",
|
||||
"common.ZombieMixin",
|
||||
"common.bridge.EntityBridge",
|
||||
"common.bridge.ItemBridge",
|
||||
"common.bridge.ServerChunkManagerBridge",
|
||||
"common.bridge.ServerPlayerBridge",
|
||||
"common.bridge.ServerWorldBridge",
|
||||
"common.fixes.EndermanEntityMixin",
|
||||
"common.fixes.LivingEntityMixin",
|
||||
"server.AbstractFurnaceBlockMixin",
|
||||
"server.LegacyQueryHandlerMixin",
|
||||
"server.MinecraftServerMixin",
|
||||
|
||||
Reference in new issue
Block a user