當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityPlayerSP.getHeldItemOffhand方法代碼示例

本文整理匯總了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());
			}
		}
	}
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:21,代碼來源:Events.java

示例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;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:31,代碼來源:ItemRenderer.java

示例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);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:52,代碼來源:ItemRenderer.java


注:本文中的net.minecraft.client.entity.EntityPlayerSP.getHeldItemOffhand方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。