本文整理汇总了Java中net.minecraft.init.Items.BOW属性的典型用法代码示例。如果您正苦于以下问题:Java Items.BOW属性的具体用法?Java Items.BOW怎么用?Java Items.BOW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.init.Items
的用法示例。
在下文中一共展示了Items.BOW属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setLivingAnimations
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
{
this.rightArmPose = ModelBiped.ArmPose.EMPTY;
this.leftArmPose = ModelBiped.ArmPose.EMPTY;
ItemStack itemstack = entitylivingbaseIn.getHeldItem(EnumHand.MAIN_HAND);
if (itemstack.getItem() == Items.BOW && ((AbstractSkeleton)entitylivingbaseIn).isSwingingArms())
{
if (entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT)
{
this.rightArmPose = ModelBiped.ArmPose.BOW_AND_ARROW;
}
else
{
this.leftArmPose = ModelBiped.ArmPose.BOW_AND_ARROW;
}
}
super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime);
}
示例2: setRotationAngles
/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
{
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
ItemStack itemstack = ((EntityLivingBase)entityIn).getHeldItemMainhand();
AbstractSkeleton abstractskeleton = (AbstractSkeleton)entityIn;
if (abstractskeleton.isSwingingArms() && (itemstack.func_190926_b() || itemstack.getItem() != Items.BOW))
{
float f = MathHelper.sin(this.swingProgress * (float)Math.PI);
float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI);
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = -(0.1F - f * 0.6F);
this.bipedLeftArm.rotateAngleY = 0.1F - f * 0.6F;
this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F);
this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F);
this.bipedRightArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
this.bipedLeftArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
}
}
示例3: setLivingAnimations
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
{
this.rightArmPose = ModelBiped.ArmPose.EMPTY;
this.leftArmPose = ModelBiped.ArmPose.EMPTY;
ItemStack itemstack = entitylivingbaseIn.getHeldItem(EnumHand.MAIN_HAND);
if (itemstack != null && itemstack.getItem() == Items.BOW && ((EntitySkeleton)entitylivingbaseIn).isSwingingArms())
{
if (entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT)
{
this.rightArmPose = ModelBiped.ArmPose.BOW_AND_ARROW;
}
else
{
this.leftArmPose = ModelBiped.ArmPose.BOW_AND_ARROW;
}
}
super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime);
}
示例4: setRotationAngles
/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
{
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
ItemStack itemstack = ((EntityLivingBase)entityIn).getHeldItemMainhand();
EntitySkeleton entityskeleton = (EntitySkeleton)entityIn;
if (entityskeleton.isSwingingArms() && (itemstack == null || itemstack.getItem() != Items.BOW))
{
float f = MathHelper.sin(this.swingProgress * (float)Math.PI);
float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI);
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = -(0.1F - f * 0.6F);
this.bipedLeftArm.rotateAngleY = 0.1F - f * 0.6F;
this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F);
this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F);
this.bipedRightArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
this.bipedLeftArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
}
}
示例5: testBurnTimeWithNbt
@Test
public void testBurnTimeWithNbt()
{
Fuel fuel = gson.fromJson("{ \"item\": {\"item\" : \"minecraft:bow\", \"nbt\":\"{AInt:1}\" }, \"burnTime\":1337 }", Fuel.class);
fuel.init(InitPhase.PRE_INIT, new TestContentHelper("{}", TestContent.class));
ItemStack stack = new ItemStack(Items.BOW);
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setInteger("AInt", 1);
assertFalse(fuel.appliesToStack(new ItemStack(Items.BOW)));
assertTrue(fuel.appliesToStack(stack));
}
示例6: testBurnTimeWithWrongNbt
@Test
public void testBurnTimeWithWrongNbt()
{
Fuel fuel = gson.fromJson("{ \"item\": {\"item\" : \"minecraft:bow\", \"nbt\":\"{AInt:1}\" }, \"burnTime\":1337 }", Fuel.class);
fuel.init(InitPhase.PRE_INIT, new TestContentHelper("{}", TestContent.class));
ItemStack stack = new ItemStack(Items.BOW);
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setInteger("AInt", 2);
assertFalse(fuel.appliesToStack(stack));
}
示例7: setCombatTask
/**
* sets this entity's combat AI.
*/
public void setCombatTask()
{
if (this.world != null && !this.world.isRemote)
{
this.tasks.removeTask(this.aiAttackOnCollide);
this.tasks.removeTask(this.aiArrowAttack);
ItemStack itemstack = this.getHeldItemMainhand();
if (itemstack.getItem() == Items.BOW)
{
int i = 20;
if (this.world.getDifficulty() != EnumDifficulty.HARD)
{
i = 40;
}
this.aiArrowAttack.setAttackCooldown(i);
this.tasks.addTask(4, this.aiArrowAttack);
}
else
{
this.tasks.addTask(4, this.aiAttackOnCollide);
}
}
}
示例8: getFovModifier
public float getFovModifier()
{
float f = 1.0F;
if (this.capabilities.isFlying)
{
f *= 1.1F;
}
IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
f = (float)((double)f * ((iattributeinstance.getAttributeValue() / (double)this.capabilities.getWalkSpeed() + 1.0D) / 2.0D));
if (this.capabilities.getWalkSpeed() == 0.0F || Float.isNaN(f) || Float.isInfinite(f))
{
f = 1.0F;
}
if (this.isHandActive() && this.getActiveItemStack().getItem() == Items.BOW)
{
int i = this.getItemInUseMaxCount();
float f1 = (float)i / 20.0F;
if (f1 > 1.0F)
{
f1 = 1.0F;
}
else
{
f1 = f1 * f1;
}
f *= 1.0F - f1 * 0.15F;
}
return Reflector.ForgeHooksClient_getOffsetFOV.exists() ? Reflector.callFloat(Reflector.ForgeHooksClient_getOffsetFOV, new Object[] {this, Float.valueOf(f)}): f;
}
示例9: getItemBurnTime
/**
* Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
* fuel
*/
public static int getItemBurnTime(ItemStack stack)
{
if (stack.func_190926_b())
{
return 0;
}
else
{
Item item = stack.getItem();
return item == Item.getItemFromBlock(Blocks.WOODEN_SLAB) ? 150 : (item == Item.getItemFromBlock(Blocks.WOOL) ? 100 : (item == Item.getItemFromBlock(Blocks.CARPET) ? 67 : (item == Item.getItemFromBlock(Blocks.LADDER) ? 300 : (item == Item.getItemFromBlock(Blocks.WOODEN_BUTTON) ? 100 : (Block.getBlockFromItem(item).getDefaultState().getMaterial() == Material.WOOD ? 300 : (item == Item.getItemFromBlock(Blocks.COAL_BLOCK) ? 16000 : (item instanceof ItemTool && "WOOD".equals(((ItemTool)item).getToolMaterialName()) ? 200 : (item instanceof ItemSword && "WOOD".equals(((ItemSword)item).getToolMaterialName()) ? 200 : (item instanceof ItemHoe && "WOOD".equals(((ItemHoe)item).getMaterialName()) ? 200 : (item == Items.STICK ? 100 : (item != Items.BOW && item != Items.FISHING_ROD ? (item == Items.SIGN ? 200 : (item == Items.COAL ? 1600 : (item == Items.LAVA_BUCKET ? 20000 : (item != Item.getItemFromBlock(Blocks.SAPLING) && item != Items.BOWL ? (item == Items.BLAZE_ROD ? 2400 : (item instanceof ItemDoor && item != Items.IRON_DOOR ? 200 : (item instanceof ItemBoat ? 400 : 0))) : 100)))) : 300)))))))))));
}
}
示例10: setCombatTask
/**
* sets this entity's combat AI.
*/
public void setCombatTask()
{
if (this.worldObj != null && !this.worldObj.isRemote)
{
this.tasks.removeTask(this.aiAttackOnCollide);
this.tasks.removeTask(this.aiArrowAttack);
ItemStack itemstack = this.getHeldItemMainhand();
if (itemstack != null && itemstack.getItem() == Items.BOW)
{
int i = 20;
if (this.worldObj.getDifficulty() != EnumDifficulty.HARD)
{
i = 40;
}
this.aiArrowAttack.setAttackCooldown(i);
this.tasks.addTask(4, this.aiArrowAttack);
}
else
{
this.tasks.addTask(4, this.aiAttackOnCollide);
}
}
}
示例11: getFovModifier
public float getFovModifier()
{
float f = 1.0F;
if (this.capabilities.isFlying)
{
f *= 1.1F;
}
IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
f = (float)((double)f * ((iattributeinstance.getAttributeValue() / (double)this.capabilities.getWalkSpeed() + 1.0D) / 2.0D));
if (this.capabilities.getWalkSpeed() == 0.0F || Float.isNaN(f) || Float.isInfinite(f))
{
f = 1.0F;
}
if (this.isHandActive() && this.getActiveItemStack() != null && this.getActiveItemStack().getItem() == Items.BOW)
{
int i = this.getItemInUseMaxCount();
float f1 = (float)i / 20.0F;
if (f1 > 1.0F)
{
f1 = 1.0F;
}
else
{
f1 = f1 * f1;
}
f *= 1.0F - f1 * 0.15F;
}
return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f);
}
示例12: isBowInMainhand
protected boolean isBowInMainhand()
{
return !this.entity.getHeldItemMainhand().func_190926_b() && this.entity.getHeldItemMainhand().getItem() == Items.BOW;
}
示例13: doRenderLayer
public void doRenderLayer(EntityWitch entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
ItemStack itemstack = entitylivingbaseIn.getHeldItemMainhand();
if (!itemstack.func_190926_b())
{
GlStateManager.color(1.0F, 1.0F, 1.0F);
GlStateManager.pushMatrix();
if (this.witchRenderer.getMainModel().isChild)
{
GlStateManager.translate(0.0F, 0.625F, 0.0F);
GlStateManager.rotate(-20.0F, -1.0F, 0.0F, 0.0F);
float f = 0.5F;
GlStateManager.scale(0.5F, 0.5F, 0.5F);
}
this.witchRenderer.getMainModel().villagerNose.postRender(0.0625F);
GlStateManager.translate(-0.0625F, 0.53125F, 0.21875F);
Item item = itemstack.getItem();
Minecraft minecraft = Minecraft.getMinecraft();
if (Block.getBlockFromItem(item).getDefaultState().getRenderType() == EnumBlockRenderType.ENTITYBLOCK_ANIMATED)
{
GlStateManager.translate(0.0F, 0.0625F, -0.25F);
GlStateManager.rotate(30.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(-5.0F, 0.0F, 1.0F, 0.0F);
float f1 = 0.375F;
GlStateManager.scale(0.375F, -0.375F, 0.375F);
}
else if (item == Items.BOW)
{
GlStateManager.translate(0.0F, 0.125F, -0.125F);
GlStateManager.rotate(-45.0F, 0.0F, 1.0F, 0.0F);
float f2 = 0.625F;
GlStateManager.scale(0.625F, -0.625F, 0.625F);
GlStateManager.rotate(-100.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(-20.0F, 0.0F, 1.0F, 0.0F);
}
else if (item.isFull3D())
{
if (item.shouldRotateAroundWhenRendering())
{
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.0F, -0.0625F, 0.0F);
}
this.witchRenderer.transformHeldFull3DItemLayer();
GlStateManager.translate(0.0625F, -0.125F, 0.0F);
float f3 = 0.625F;
GlStateManager.scale(0.625F, -0.625F, 0.625F);
GlStateManager.rotate(0.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(0.0F, 0.0F, 1.0F, 0.0F);
}
else
{
GlStateManager.translate(0.1875F, 0.1875F, 0.0F);
float f4 = 0.875F;
GlStateManager.scale(0.875F, 0.875F, 0.875F);
GlStateManager.rotate(-20.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(-60.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(-30.0F, 0.0F, 0.0F, 1.0F);
}
GlStateManager.rotate(-15.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(40.0F, 0.0F, 0.0F, 1.0F);
minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND);
GlStateManager.popMatrix();
}
}
示例14: renderItemInFirstPerson
/**
* Renders the active item in the player's hand when in first person mode.
*/
public void renderItemInFirstPerson(float partialTicks)
{
AbstractClientPlayer abstractclientplayer = this.mc.player;
float f = abstractclientplayer.getSwingProgress(partialTicks);
EnumHand enumhand = (EnumHand)Objects.firstNonNull(abstractclientplayer.swingingHand, EnumHand.MAIN_HAND);
float f1 = abstractclientplayer.prevRotationPitch + (abstractclientplayer.rotationPitch - abstractclientplayer.prevRotationPitch) * partialTicks;
float f2 = abstractclientplayer.prevRotationYaw + (abstractclientplayer.rotationYaw - abstractclientplayer.prevRotationYaw) * partialTicks;
boolean flag = true;
boolean flag1 = true;
if (abstractclientplayer.isHandActive())
{
ItemStack itemstack = abstractclientplayer.getActiveItemStack();
if (itemstack != null && itemstack.getItem() == Items.BOW)
{
EnumHand enumhand1 = abstractclientplayer.getActiveHand();
flag = enumhand1 == EnumHand.MAIN_HAND;
flag1 = !flag;
}
}
this.rotateArroundXAndY(f1, f2);
this.setLightmap();
this.rotateArm(partialTicks);
GlStateManager.enableRescaleNormal();
if (flag)
{
float f3 = enumhand == EnumHand.MAIN_HAND ? f : 0.0F;
float f5 = 1.0F - (this.prevEquippedProgressMainHand + (this.equippedProgressMainHand - this.prevEquippedProgressMainHand) * partialTicks);
if (!Reflector.ForgeHooksClient_renderSpecificFirstPersonHand.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_renderSpecificFirstPersonHand, new Object[] {EnumHand.MAIN_HAND, Float.valueOf(partialTicks), Float.valueOf(f1), Float.valueOf(f3), Float.valueOf(f5), this.itemStackMainHand}))
{
this.renderItemInFirstPerson(abstractclientplayer, partialTicks, f1, EnumHand.MAIN_HAND, f3, this.itemStackMainHand, f5);
}
}
if (flag1)
{
float f4 = enumhand == EnumHand.OFF_HAND ? f : 0.0F;
float f6 = 1.0F - (this.prevEquippedProgressOffHand + (this.equippedProgressOffHand - this.prevEquippedProgressOffHand) * partialTicks);
if (!Reflector.ForgeHooksClient_renderSpecificFirstPersonHand.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_renderSpecificFirstPersonHand, new Object[] {EnumHand.OFF_HAND, Float.valueOf(partialTicks), Float.valueOf(f1), Float.valueOf(f4), Float.valueOf(f6), this.itemStackOffHand}))
{
this.renderItemInFirstPerson(abstractclientplayer, partialTicks, f1, EnumHand.OFF_HAND, f4, this.itemStackOffHand, f6);
}
}
GlStateManager.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
}
示例15: isBowInMainhand
protected boolean isBowInMainhand()
{
return this.entity.getHeldItemMainhand() != null && this.entity.getHeldItemMainhand().getItem() == Items.BOW;
}