More descriptive way of getting armor slots
This commit is contained in:
parent
dc0fd04672
commit
a84b51f562
@ -11,6 +11,7 @@ import net.minecraft.client.renderer.texture.TextureManager;
|
|||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
@ -82,7 +83,7 @@ public class SoundEventsManager {
|
|||||||
|
|
||||||
public static boolean isEntityWearingGlasses(Entity e) {
|
public static boolean isEntityWearingGlasses(Entity e) {
|
||||||
if (e instanceof EntityPlayer) {
|
if (e instanceof EntityPlayer) {
|
||||||
ItemStack helmet = ((EntityPlayer)e).inventory.armorInventory[3];
|
ItemStack helmet = ((EntityPlayer)e).getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||||
return helmet != null
|
return helmet != null
|
||||||
&& helmet.getItem() instanceof ItemSonicGlasses;
|
&& helmet.getItem() instanceof ItemSonicGlasses;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package openblocks.common.tileentity;
|
|||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@ -144,7 +145,7 @@ public class TileEntityImaginary extends OpenTileEntity implements ICustomPickIt
|
|||||||
if (what == Property.VISIBLE && player.isSpectator()) return true;
|
if (what == Property.VISIBLE && player.isSpectator()) return true;
|
||||||
if (what == Property.SOLID && isPencil()) return true;
|
if (what == Property.SOLID && isPencil()) return true;
|
||||||
|
|
||||||
ItemStack helmet = player.inventory.armorInventory[3];
|
final ItemStack helmet = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||||
|
|
||||||
if (helmet == null) return isInverted();
|
if (helmet == null) return isInverted();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user