本文整理汇总了Java中net.minecraft.client.entity.EntityPlayerSP.getHeldItemOffhand方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayerSP.getHeldItemOffhand方法的具体用法?Java EntityPlayerSP.getHeldItemOffhand怎么用?Java EntityPlayerSP.getHeldItemOffhand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.entity.EntityPlayerSP
的用法示例。
在下文中一共展示了EntityPlayerSP.getHeldItemOffhand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderGhostAngstrom
import net.minecraft.client.entity.EntityPlayerSP; //导入方法依赖的package包/类
@SubscribeEvent
public static void renderGhostAngstrom(RenderWorldLastEvent event) {
EntityPlayerSP player = Minecraft.getMinecraft().player;
ItemStack stack = player.getHeldItemMainhand();
if(stack.isEmpty() || stack.getItem() != ModItems.ANGSTROM) {
stack = player.getHeldItemOffhand();
}
if(!stack.isEmpty() && stack.getItem() == ModItems.ANGSTROM) {
RayTraceResult result = RayTraceHelper.tracePlayerHighlight(player);
if(result.typeOfHit != RayTraceResult.Type.BLOCK) {
Vector3 vec = Vector3.create(player.posX, player.posY + player.getEyeHeight(), player.posZ);
vec.add(Vector3.create(player.getLookVec()).multiply(2.5D));
BlockPos pos = new BlockPos(vec.toVec3d());
IBlockState replaced = player.world.getBlockState(pos);
if(player.world.isAirBlock(pos) || replaced.getBlock().isReplaceable(player.world, pos)) {
RenderHelper.renderGhostBlock(pos, ModBlocks.ANGSTROM.getDefaultState());
}
}
}
}
示例2: updateEquippedItem
import net.minecraft.client.entity.EntityPlayerSP; //导入方法依赖的package包/类
public void updateEquippedItem()
{
this.prevEquippedProgressMainHand = this.equippedProgressMainHand;
this.prevEquippedProgressOffHand = this.equippedProgressOffHand;
EntityPlayerSP entityplayersp = this.mc.thePlayer;
ItemStack itemstack = entityplayersp.getHeldItemMainhand();
ItemStack itemstack1 = entityplayersp.getHeldItemOffhand();
if (entityplayersp.isRowingBoat())
{
this.equippedProgressMainHand = MathHelper.clamp_float(this.equippedProgressMainHand - 0.4F, 0.0F, 1.0F);
this.equippedProgressOffHand = MathHelper.clamp_float(this.equippedProgressOffHand - 0.4F, 0.0F, 1.0F);
}
else
{
float f = entityplayersp.getCooledAttackStrength(1.0F);
this.equippedProgressMainHand += MathHelper.clamp_float((!net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.itemStackMainHand, itemstack, entityplayersp.inventory.currentItem) ? f * f * f : 0.0F) - this.equippedProgressMainHand, -0.4F, 0.4F);
this.equippedProgressOffHand += MathHelper.clamp_float((float)(!net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.itemStackOffHand, itemstack1, -1) ? 1 : 0) - this.equippedProgressOffHand, -0.4F, 0.4F);
}
if (this.equippedProgressMainHand < 0.1F)
{
this.itemStackMainHand = itemstack;
}
if (this.equippedProgressOffHand < 0.1F)
{
this.itemStackOffHand = itemstack1;
}
}
示例3: updateEquippedItem
import net.minecraft.client.entity.EntityPlayerSP; //导入方法依赖的package包/类
public void updateEquippedItem()
{
this.prevEquippedProgressMainHand = this.equippedProgressMainHand;
this.prevEquippedProgressOffHand = this.equippedProgressOffHand;
EntityPlayerSP entityplayersp = this.mc.player;
ItemStack itemstack = entityplayersp.getHeldItemMainhand();
ItemStack itemstack1 = entityplayersp.getHeldItemOffhand();
if (entityplayersp.isRowingBoat())
{
this.equippedProgressMainHand = MathHelper.clamp(this.equippedProgressMainHand - 0.4F, 0.0F, 1.0F);
this.equippedProgressOffHand = MathHelper.clamp(this.equippedProgressOffHand - 0.4F, 0.0F, 1.0F);
}
else
{
float f = entityplayersp.getCooledAttackStrength(1.0F);
if (Reflector.ForgeHooksClient_shouldCauseReequipAnimation.exists())
{
boolean flag = Reflector.callBoolean(Reflector.ForgeHooksClient_shouldCauseReequipAnimation, new Object[] {this.itemStackMainHand, itemstack, Integer.valueOf(entityplayersp.inventory.currentItem)});
this.equippedProgressMainHand += MathHelper.clamp((!flag ? f * f * f : 0.0F) - this.equippedProgressMainHand, -0.4F, 0.4F);
boolean flag1 = Reflector.callBoolean(Reflector.ForgeHooksClient_shouldCauseReequipAnimation, new Object[] {this.itemStackOffHand, itemstack1, Integer.valueOf(-1)});
this.equippedProgressOffHand += MathHelper.clamp((float)(!flag1 ? 1 : 0) - this.equippedProgressOffHand, -0.4F, 0.4F);
}
else
{
this.equippedProgressMainHand += MathHelper.clamp((Objects.equal(this.itemStackMainHand, itemstack) ? f * f * f : 0.0F) - this.equippedProgressMainHand, -0.4F, 0.4F);
this.equippedProgressOffHand += MathHelper.clamp((float)(Objects.equal(this.itemStackOffHand, itemstack1) ? 1 : 0) - this.equippedProgressOffHand, -0.4F, 0.4F);
}
}
if (this.equippedProgressMainHand < 0.1F)
{
this.itemStackMainHand = itemstack;
if (Config.isShaders())
{
Shaders.setItemToRenderMain(this.itemStackMainHand);
}
}
if (this.equippedProgressOffHand < 0.1F)
{
this.itemStackOffHand = itemstack1;
if (Config.isShaders())
{
Shaders.setItemToRenderOff(this.itemStackOffHand);
}
}
}