Fixed fake players being able to equip baubles via right click.

This commit is contained in:
Lizbeth Rika committed 2015-02-21 15:41:10 +00:00
1 parent dd5ae937d5
commit f4f383d30a
2 files changed
+7 -6

No files matched your search

@@ -243,17 +243,14 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
@Override
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
if((par1DamageSource.damageType.equals("player") || par1DamageSource.getEntity() instanceof EntityPixie) && par1DamageSource.getEntity() != null && !isTruePlayer(par1DamageSource.getEntity()) && getInvulTime() == 0)
if((par1DamageSource.damageType.equals("player") || par1DamageSource.getEntity() instanceof EntityPixie) && par1DamageSource.getEntity() != null && isTruePlayer(par1DamageSource.getEntity()) && getInvulTime() == 0)
return super.attackEntityFrom(par1DamageSource, par2 * (isHardMode() ? 0.6F : 1F));
return false;
}
public boolean isTruePlayer(Entity e) {
if(e instanceof EntityPlayer)
public static boolean isTruePlayer(Entity e) {
if(!(e instanceof EntityPlayer))
return false;
if(worldObj.isRemote)
return true;
EntityPlayer player = (EntityPlayer) e;
@@ -20,6 +20,7 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import vazkii.botania.common.achievement.ModAchievements;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.entity.EntityDoppleganger;
import vazkii.botania.common.item.ItemMod;
import baubles.api.BaubleType;
import baubles.api.IBauble;
@@ -40,6 +41,9 @@ public abstract class ItemBauble extends ItemMod implements IBauble {
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if(!EntityDoppleganger.isTruePlayer(par3EntityPlayer))
return par1ItemStack;
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer);
for(int i = 0; i < baubles.getSizeInventory(); i++) {
if(baubles.isItemValidForSlot(i, par1ItemStack)) {