本文整理汇总了Java中net.minecraft.inventory.EntityEquipmentSlot.HEAD属性的典型用法代码示例。如果您正苦于以下问题:Java EntityEquipmentSlot.HEAD属性的具体用法?Java EntityEquipmentSlot.HEAD怎么用?Java EntityEquipmentSlot.HEAD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.inventory.EntityEquipmentSlot
的用法示例。
在下文中一共展示了EntityEquipmentSlot.HEAD属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
public static void init(){
emptytincan = new ItemEmptytincan();
tincan = new ItemTincan();
toothbrush = new ItemToothbrush();
brokentoothbrush = new ItemBrokentoothbrush();
toothbrushshiv = new ItemToothbrushshiv();
tinfoil = new ItemTinfoil();
emptysurstrommingcan = new ItemEmptysurstrommingcan();
ducttape = new ItemDucttape();
brokenstick = new ItemBrokenstick();
woodenchunk = new ItemWoodenchunk();
crackeddiamond = new ItemCrackeddiamond();
tiningot = new ItemTiningot();
copperingot = new ItemCopperingot();
pyriteingot = new ItemPyriteingot();
rottingfish = new ItemRottingfish();
surstromming = new ItemSurstromming();
applecore = new ItemApplecore();
appleseeds = new ItemAppleseeds();
tinfoilhelmet = new ArmorTinfoil("tinfoilhelmet", "ItemTinfoilhelmet", 1, EntityEquipmentSlot.HEAD);
Potion.REGISTRY.register(30, new ResourceLocation("sick"), new PotionSick(true, 16262179));
}
示例2: onArmorTick
@Optional.Method(modid = Compats.IC2)
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
{
boolean shouldUpdate = false;
// If we wear some air mask on head.
if (this.isAirMask && this.armorType == EntityEquipmentSlot.HEAD)
{
// Default max value is 300
if ((player.getAir() <= minAirToStartRefil) && (player.inventory.hasItemStack(ItemsCG.ic2AirCell)))
{
consumeItemFromInventory(player, ItemsCG.ic2AirCell);
player.inventory.addItemStackToInventory(new ItemStack(ItemsCG.ic2EmptyCell.getItem()));
player.setAir(300);
shouldUpdate = true;
}
}
// If we have changed inventory contents then we should sync it on client.
if (shouldUpdate) {
player.inventoryContainer.detectAndSendChanges();
}
}
示例3: ItemGlassesHelmet
public ItemGlassesHelmet()
{
super(GALSSES_ARMOR, GALSSES_ARMOR.ordinal(), EntityEquipmentSlot.HEAD);
this.setUnlocalizedName("glasses_helmet");
this.setCreativeTab(CreativeTabsLoader.tabMineCamera);
this.setMaxDamage(500);
}
示例4: getArmorModel
/**
* Override this method to have an item handle its own armor rendering.
*
* @param entityLiving The entity wearing the armor
* @param itemStack The itemStack to render the model of
* @param armorSlot 0=head, 1=torso, 2=legs, 3=feet
* @return A ModelBiped to render instead of the default
*/
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) {
if (armorSlot == EntityEquipmentSlot.HEAD && (ConfigHandler.client.useHelmetModel || DateEventHandler.isIronManEvent())) {
/*RenderItemPneumaticHelmet.INSTANCE.render(entityLiving);
RenderPlayer render = (RenderPlayer)Minecraft.getMinecraft().getRenderManager().entityRenderMap.get(EntityPlayer.class);
ModelBiped model = armorSlot == 2 ? render.modelArmor : render.modelArmorChestplate;
model.bipedHead.showModel = false;
return model;*///TODO 1.8 fix
}
return null;
}
示例5: ItemSkullBase
public ItemSkullBase(String name, BlockSkullBase block) {
super(ModMaterials.SKULL_MATERIAL, 0, EntityEquipmentSlot.HEAD);
setRegistryName(name);
setUnlocalizedName(name);
setMaxStackSize(64);
setMaxDamage(0);
skullBlock = block;
}
示例6: getModel
public static ModelBiped getModel(EntityLivingBase entity, ItemStack stack) {
if (stack.isEmpty() || !(stack.getItem() instanceof ItemArmor)) {
return null;
}
EntityEquipmentSlot slot = ((ItemArmor) stack.getItem()).armorType;
HazmatSuitModel armor;
if (slot == EntityEquipmentSlot.HEAD && modelHelm != null) {
return modelHelm;
}
armor = new HazmatSuitModel();
armor.bipedBody.isHidden = true;
armor.bipedLeftArm.isHidden = true;
armor.bipedRightArm.isHidden = true;
armor.bipedHead.isHidden = true;
armor.bipedLeftLeg.isHidden = true;
armor.bipedRightLeg.isHidden = true;
switch (slot) {
case HEAD:
armor.bipedHead.isHidden = false;
modelHelm = armor;
break;
}
return armor;
}
示例7: getModel
public static ModelBiped getModel(EntityLivingBase entity, ItemStack stack) {
if (stack.isEmpty() || !(stack.getItem() instanceof ItemArmor)) {
return null;
}
EntityEquipmentSlot slot = ((ItemArmor) stack.getItem()).armorType;
ProtectiveHelmetModel2 armor;
if (slot == EntityEquipmentSlot.HEAD && modelHelm2 != null) {
return modelHelm2;
}
armor = new ProtectiveHelmetModel2();
armor.bipedBody.isHidden = true;
armor.bipedLeftArm.isHidden = true;
armor.bipedRightArm.isHidden = true;
armor.bipedHead.isHidden = true;
armor.bipedLeftLeg.isHidden = true;
armor.bipedRightLeg.isHidden = true;
switch (slot) {
case HEAD:
armor.bipedHead.isHidden = false;
modelHelm2 = armor;
break;
}
return armor;
}
示例8: registerEnchantments
/**
* Registers all of the vanilla enchantments.
*/
public static void registerEnchantments()
{
EntityEquipmentSlot[] aentityequipmentslot = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
REGISTRY.register(0, new ResourceLocation("protection"), new EnchantmentProtection(Enchantment.Rarity.COMMON, EnchantmentProtection.Type.ALL, aentityequipmentslot));
REGISTRY.register(1, new ResourceLocation("fire_protection"), new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.FIRE, aentityequipmentslot));
REGISTRY.register(2, new ResourceLocation("feather_falling"), new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.FALL, aentityequipmentslot));
REGISTRY.register(3, new ResourceLocation("blast_protection"), new EnchantmentProtection(Enchantment.Rarity.RARE, EnchantmentProtection.Type.EXPLOSION, aentityequipmentslot));
REGISTRY.register(4, new ResourceLocation("projectile_protection"), new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.PROJECTILE, aentityequipmentslot));
REGISTRY.register(5, new ResourceLocation("respiration"), new EnchantmentOxygen(Enchantment.Rarity.RARE, aentityequipmentslot));
REGISTRY.register(6, new ResourceLocation("aqua_affinity"), new EnchantmentWaterWorker(Enchantment.Rarity.RARE, aentityequipmentslot));
REGISTRY.register(7, new ResourceLocation("thorns"), new EnchantmentThorns(Enchantment.Rarity.VERY_RARE, aentityequipmentslot));
REGISTRY.register(8, new ResourceLocation("depth_strider"), new EnchantmentWaterWalker(Enchantment.Rarity.RARE, aentityequipmentslot));
REGISTRY.register(9, new ResourceLocation("frost_walker"), new EnchantmentFrostWalker(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.FEET}));
REGISTRY.register(10, new ResourceLocation("binding_curse"), new EnchantmentBindingCurse(Enchantment.Rarity.VERY_RARE, aentityequipmentslot));
REGISTRY.register(16, new ResourceLocation("sharpness"), new EnchantmentDamage(Enchantment.Rarity.COMMON, 0, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(17, new ResourceLocation("smite"), new EnchantmentDamage(Enchantment.Rarity.UNCOMMON, 1, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(18, new ResourceLocation("bane_of_arthropods"), new EnchantmentDamage(Enchantment.Rarity.UNCOMMON, 2, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(19, new ResourceLocation("knockback"), new EnchantmentKnockback(Enchantment.Rarity.UNCOMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(20, new ResourceLocation("fire_aspect"), new EnchantmentFireAspect(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(21, new ResourceLocation("looting"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.WEAPON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(22, new ResourceLocation("sweeping"), new EnchantmentSweepingEdge(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(32, new ResourceLocation("efficiency"), new EnchantmentDigging(Enchantment.Rarity.COMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(33, new ResourceLocation("silk_touch"), new EnchantmentUntouching(Enchantment.Rarity.VERY_RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(34, new ResourceLocation("unbreaking"), new EnchantmentDurability(Enchantment.Rarity.UNCOMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(35, new ResourceLocation("fortune"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.DIGGER, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(48, new ResourceLocation("power"), new EnchantmentArrowDamage(Enchantment.Rarity.COMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(49, new ResourceLocation("punch"), new EnchantmentArrowKnockback(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(50, new ResourceLocation("flame"), new EnchantmentArrowFire(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(51, new ResourceLocation("infinity"), new EnchantmentArrowInfinite(Enchantment.Rarity.VERY_RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(61, new ResourceLocation("luck_of_the_sea"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.FISHING_ROD, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(62, new ResourceLocation("lure"), new EnchantmentFishingSpeed(Enchantment.Rarity.RARE, EnumEnchantmentType.FISHING_ROD, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(70, new ResourceLocation("mending"), new EnchantmentMending(Enchantment.Rarity.RARE, EntityEquipmentSlot.values()));
REGISTRY.register(71, new ResourceLocation("vanishing_curse"), new EnchantmentVanishingCurse(Enchantment.Rarity.VERY_RARE, EntityEquipmentSlot.values()));
}
示例9: takeDamage
public static void takeDamage(EntityPlayer player, DamageSource source, float amount)
{
final float baseAmount = amount;
IExPPlayer data = IExPPlayer.of(player);
List<DamageMapping> mappings = ExPDamageMappings.provide(source);
BodyPart part = WeightedRandom.getRandomItem(player.world.rand, mappings).getPart();
EntityEquipmentSlot armorCheck = part == BodyPart.HEAD ? EntityEquipmentSlot.HEAD : part == BodyPart.ARM_LEFT || part == BodyPart.ARM_RIGHT || part == BodyPart.BODY ? EntityEquipmentSlot.CHEST : player.world.rand.nextBoolean() ? EntityEquipmentSlot.LEGS : EntityEquipmentSlot.FEET;
ItemStack armorStack = player.getItemStackFromSlot(armorCheck);
if (!armorStack.isEmpty())
{
amount = handleArmorProtection(player, source, amount, armorStack, part, armorCheck);
}
float partDamage = player.world.rand.nextFloat();
// No damage reduction was applied, player has no armor
if (baseAmount == amount)
{
partDamage *= 10;
}
data.setState(part, Math.max(0, data.getState(part) - partDamage));
// TODO bleeding, bones breaking
float actualDamage = amount * (200 + player.world.rand.nextFloat() * 50 - player.world.rand.nextFloat() * 50);
data.setHealth(data.getCurrentHealth() - actualDamage, true, true);
// Player died
if (data.getCurrentHealth() <= 0)
{
player.sendMessage(source.getDeathMessage(player));
}
}
示例10: onPlayerTick
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event)
{
if (event.phase == Phase.START && !event.player.getEntityWorld().isRemote)
{
if (ticks % 10 == 0)
{
PlayerInformation playerInfo = (PlayerInformation) event.player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
if (playerInfo != null)
{
if (event.player.inventory.getCurrentItem() != mainhand && playerInfo.getPlayerLevel() >= NBTHelper.loadStackNBT(event.player.inventory.getCurrentItem()).getInteger("Level"))
{
updateStats(event.player, playerInfo);
mainhand = event.player.inventory.getCurrentItem();
}
for (ItemStack stack : event.player.inventory.armorInventory)
{
if (stack.getItem() instanceof ItemArmor && playerInfo.getPlayerLevel() >= NBTHelper.loadStackNBT(stack).getInteger("Level"))
{
if (((ItemArmor) stack.getItem()).getEquipmentSlot() == EntityEquipmentSlot.HEAD && stack != helmet)
{
updateStats(event.player, playerInfo);
helmet = stack;
}
else if (((ItemArmor) stack.getItem()).getEquipmentSlot() == EntityEquipmentSlot.CHEST && stack != chestplate)
{
updateStats(event.player, playerInfo);
chestplate = stack;
}
else if (((ItemArmor) stack.getItem()).getEquipmentSlot() == EntityEquipmentSlot.LEGS && stack != leggings)
{
updateStats(event.player, playerInfo);
leggings = stack;
}
else if (((ItemArmor) stack.getItem()).getEquipmentSlot() == EntityEquipmentSlot.FEET && stack != boots)
{
updateStats(event.player, playerInfo);
boots = stack;
}
}
}
}
ticks = 0;
}
if (regenTicks % 100 == 0)
{
Stats statsCap = (Stats) event.player.getCapability(CapabilityPlayerStats.STATS, null);
if (statsCap != null)
{
if (statsCap.getMana() < statsCap.getMaxMana())
{
statsCap.increaseMana(statsCap.getManaPerSecond());
}
if (event.player.getHealth() < event.player.getMaxHealth())
{
event.player.heal(statsCap.getHealthPerSecond());
}
LootSlashConquer.network.sendTo(new PacketUpdateStats(statsCap), (EntityPlayerMP) event.player);
}
regenTicks = 0;
}
ticks++;
regenTicks++;
}
}
示例11: getSlotForItemStack
public static EntityEquipmentSlot getSlotForItemStack(ItemStack stack)
{
return stack.getItem() != Item.getItemFromBlock(Blocks.PUMPKIN) && stack.getItem() != Items.SKULL ? (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType : (stack.getItem() == Items.ELYTRA ? EntityEquipmentSlot.CHEST : (stack.getItem() == Items.SHIELD ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND))) : EntityEquipmentSlot.HEAD;
}
示例12: isValidArmor
@Override
public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) {
return armorType==EntityEquipmentSlot.HEAD;
}
示例13: ProtectiveHelmet2
public ProtectiveHelmet2() {
super(ArmorMaterial.LEATHER, 0, EntityEquipmentSlot.HEAD);
setRegistryName("protectivehelmet");
setUnlocalizedName(NeedToBreathe.MODID + ".protectivehelmet");
setCreativeTab(NeedToBreathe.creativeTab);
}
示例14: doRenderLayer
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (itemstack != null && itemstack.getItem() != null)
{
Item item = itemstack.getItem();
Minecraft minecraft = Minecraft.getMinecraft();
GlStateManager.pushMatrix();
if (entitylivingbaseIn.isSneaking())
{
GlStateManager.translate(0.0F, 0.2F, 0.0F);
}
boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombie && ((EntityZombie)entitylivingbaseIn).isVillager();
if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager))
{
float f = 2.0F;
float f1 = 1.4F;
GlStateManager.translate(0.0F, 0.5F * scale, 0.0F);
GlStateManager.scale(0.7F, 0.7F, 0.7F);
GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
}
this.modelRenderer.postRender(0.0625F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (item == Items.SKULL)
{
float f2 = 1.1875F;
GlStateManager.scale(1.1875F, -1.1875F, -1.1875F);
if (flag)
{
GlStateManager.translate(0.0F, 0.0625F, 0.0F);
}
GameProfile gameprofile = null;
if (itemstack.hasTagCompound())
{
NBTTagCompound nbttagcompound = itemstack.getTagCompound();
if (nbttagcompound.hasKey("SkullOwner", 10))
{
gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
}
else if (nbttagcompound.hasKey("SkullOwner", 8))
{
String s = nbttagcompound.getString("SkullOwner");
if (!StringUtils.isNullOrEmpty(s))
{
gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
}
}
}
TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1, limbSwing);
}
else if (!(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD)
{
float f3 = 0.625F;
GlStateManager.translate(0.0F, -0.25F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(0.625F, -0.625F, -0.625F);
if (flag)
{
GlStateManager.translate(0.0F, 0.1875F, 0.0F);
}
minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD);
}
GlStateManager.popMatrix();
}
}
示例15: replaceItemInInventory
public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn)
{
EntityEquipmentSlot entityequipmentslot;
if (inventorySlot == 98)
{
entityequipmentslot = EntityEquipmentSlot.MAINHAND;
}
else if (inventorySlot == 99)
{
entityequipmentslot = EntityEquipmentSlot.OFFHAND;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.HEAD.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.HEAD;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.CHEST.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.CHEST;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.LEGS.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.LEGS;
}
else
{
if (inventorySlot != 100 + EntityEquipmentSlot.FEET.getIndex())
{
return false;
}
entityequipmentslot = EntityEquipmentSlot.FEET;
}
if (!itemStackIn.func_190926_b() && !EntityLiving.isItemStackInSlot(entityequipmentslot, itemStackIn) && entityequipmentslot != EntityEquipmentSlot.HEAD)
{
return false;
}
else
{
this.setItemStackToSlot(entityequipmentslot, itemStackIn);
return true;
}
}