Just block right clicks for mushroom cows if protected

This commit is contained in:
fullwall 2020-05-10 13:38:02 +08:00
parent 10cea99af1
commit 9d6a9f7a14
7 changed files with 7 additions and 49 deletions

View File

@ -20,7 +20,6 @@ import net.minecraft.server.v1_10_R1.EntityMushroomCow;
import net.minecraft.server.v1_10_R1.EnumHand;
import net.minecraft.server.v1_10_R1.IBlockData;
import net.minecraft.server.v1_10_R1.ItemStack;
import net.minecraft.server.v1_10_R1.Items;
import net.minecraft.server.v1_10_R1.NBTTagCompound;
import net.minecraft.server.v1_10_R1.SoundEffect;
import net.minecraft.server.v1_10_R1.World;
@ -73,11 +72,7 @@ public class MushroomCowController extends MobEntityController {
public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
if (npc == null || !npc.isProtected())
return super.a(entityhuman, enumhand, itemstack);
if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild
&& !this.isBaby()) {
return false;
}
return super.a(entityhuman, enumhand, itemstack);
return false;
}
@Override

View File

@ -19,8 +19,6 @@ import net.minecraft.server.v1_11_R1.EntityHuman;
import net.minecraft.server.v1_11_R1.EntityMushroomCow;
import net.minecraft.server.v1_11_R1.EnumHand;
import net.minecraft.server.v1_11_R1.IBlockData;
import net.minecraft.server.v1_11_R1.ItemStack;
import net.minecraft.server.v1_11_R1.Items;
import net.minecraft.server.v1_11_R1.NBTTagCompound;
import net.minecraft.server.v1_11_R1.SoundEffect;
import net.minecraft.server.v1_11_R1.World;
@ -73,11 +71,7 @@ public class MushroomCowController extends MobEntityController {
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc == null || !npc.isProtected())
return super.a(entityhuman, enumhand);
ItemStack itemstack = entityhuman.b(enumhand);
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
return false;
}
return super.a(entityhuman, enumhand);
return false;
}
@Override

View File

@ -20,8 +20,6 @@ import net.minecraft.server.v1_12_R1.EntityHuman;
import net.minecraft.server.v1_12_R1.EntityMushroomCow;
import net.minecraft.server.v1_12_R1.EnumHand;
import net.minecraft.server.v1_12_R1.IBlockData;
import net.minecraft.server.v1_12_R1.ItemStack;
import net.minecraft.server.v1_12_R1.Items;
import net.minecraft.server.v1_12_R1.NBTTagCompound;
import net.minecraft.server.v1_12_R1.SoundEffect;
import net.minecraft.server.v1_12_R1.World;
@ -74,11 +72,7 @@ public class MushroomCowController extends MobEntityController {
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc == null || !npc.isProtected())
return super.a(entityhuman, enumhand);
ItemStack itemstack = entityhuman.b(enumhand);
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
return false;
}
return super.a(entityhuman, enumhand);
return false;
}
@Override

View File

@ -20,8 +20,6 @@ import net.minecraft.server.v1_13_R2.EntityHuman;
import net.minecraft.server.v1_13_R2.EntityMushroomCow;
import net.minecraft.server.v1_13_R2.EnumHand;
import net.minecraft.server.v1_13_R2.IBlockData;
import net.minecraft.server.v1_13_R2.ItemStack;
import net.minecraft.server.v1_13_R2.Items;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.SoundEffect;
import net.minecraft.server.v1_13_R2.World;
@ -74,11 +72,7 @@ public class MushroomCowController extends MobEntityController {
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc == null || !npc.isProtected())
return super.a(entityhuman, enumhand);
ItemStack itemstack = entityhuman.b(enumhand);
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
return false;
}
return super.a(entityhuman, enumhand);
return false;
}
@Override

View File

@ -22,8 +22,6 @@ import net.minecraft.server.v1_14_R1.EntityMushroomCow;
import net.minecraft.server.v1_14_R1.EntityTypes;
import net.minecraft.server.v1_14_R1.EnumHand;
import net.minecraft.server.v1_14_R1.IBlockData;
import net.minecraft.server.v1_14_R1.ItemStack;
import net.minecraft.server.v1_14_R1.Items;
import net.minecraft.server.v1_14_R1.NBTTagCompound;
import net.minecraft.server.v1_14_R1.SoundEffect;
import net.minecraft.server.v1_14_R1.Vec3D;
@ -78,11 +76,7 @@ public class MushroomCowController extends MobEntityController {
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc == null || !npc.isProtected())
return super.a(entityhuman, enumhand);
ItemStack itemstack = entityhuman.b(enumhand);
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
return false;
}
return super.a(entityhuman, enumhand);
return false;
}
@Override

View File

@ -22,8 +22,6 @@ import net.minecraft.server.v1_15_R1.EntityMushroomCow;
import net.minecraft.server.v1_15_R1.EntityTypes;
import net.minecraft.server.v1_15_R1.EnumHand;
import net.minecraft.server.v1_15_R1.IBlockData;
import net.minecraft.server.v1_15_R1.ItemStack;
import net.minecraft.server.v1_15_R1.Items;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_15_R1.SoundEffect;
import net.minecraft.server.v1_15_R1.Vec3D;
@ -78,11 +76,7 @@ public class MushroomCowController extends MobEntityController {
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc == null || !npc.isProtected())
return super.a(entityhuman, enumhand);
ItemStack itemstack = entityhuman.b(enumhand);
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
return false;
}
return super.a(entityhuman, enumhand);
return false;
}
@Override

View File

@ -18,8 +18,6 @@ import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityMushroomCow;
import net.minecraft.server.v1_8_R3.ItemStack;
import net.minecraft.server.v1_8_R3.Items;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
@ -71,12 +69,7 @@ public class MushroomCowController extends MobEntityController {
public boolean a(EntityHuman entityhuman) {
if (npc == null || !npc.isProtected())
return super.a(entityhuman);
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild
&& !this.isBaby()) {
return false;
}
return super.a(entityhuman);
return false;
}
@Override