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

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

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

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

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

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

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