Java Code Examples for net.minecraft.entity.player.EntityPlayer.getHeldItemOffhand()

The following are Jave code examples for showing how to use getHeldItemOffhand() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: BetterThanWeagles   File: EventHandlerShears.java   View Source Code Vote up 6 votes
private static boolean isUsingShears(EntityPlayer player)
{
	ItemStack stack = player.getHeldItemMainhand();
	if (!stack.isEmpty() && stack.getItem() instanceof ItemShears)
	{
		return true;
	}

	stack = player.getHeldItemOffhand();
	if (!stack.isEmpty() && stack.getItem() instanceof ItemShears)
	{
		return true;
	}

	return false;
}
 
Example 2
Project: Never-Enough-Currency   File: GuiHandler.java   View Source Code Vote up 6 votes
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID == 0) {
		return new GuiATM(player);
	} else if (ID == 1) {
		return new GuiWallet(new ContainerItem(player, player.inventory, new InventoryItem(player.getHeldItemMainhand())));
	} else if (ID == 2) {
		return new GuiWallet(new ContainerItem(player, player.inventory, new InventoryItem(player.getHeldItemOffhand())));
	} else if (ID == 3) {
		return new GuiShopController(new BlockPos(x, y, z), world);
	} else if (ID == 4) {
		return new GuiStockCrate(player, new BlockPos(x, y, z), player.inventory, (TileEntityStockCrate) world.getTileEntity(new BlockPos(x, y, z)));
	} else if (ID == 5) {
		return new GuiShoppingList(player);
	}

	return null;
}
 
Example 3
Project: UniversalRemote   File: Util.java   View Source Code Vote up 6 votes
public static ItemStack playerAndHandToItemStack(EntityPlayer player, EnumHand hand)
{
	ItemStack stack = null;

	// okay, find the itemstack
	if (hand == EnumHand.MAIN_HAND) {
		stack = player.getHeldItemMainhand();
	} else if (hand == EnumHand.OFF_HAND) {
		stack = player.getHeldItemOffhand();
	} else {
		// uhh... what?
		Util.logger.error("Found invalid EnumHand value!");
	}

	return stack;
}
 
Example 4
Project: uniquecrops   File: GrowthSteps.java   View Source Code Vote up 6 votes
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {

	if (getTile(world, pos) == null)
		return false;
	
	List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range, range, range)));
	for (EntityPlayer player : players) {
		if (player.getUniqueID().equals(getTile(world, pos).getOwner())) {
			ItemStack hand = player.getHeldItemMainhand();
			ItemStack offhand = player.getHeldItemOffhand();
			if ((hand != null && hand.getItem() == Item.getItemFromBlock(Blocks.TORCH)) || (offhand != null && offhand.getItem() == Item.getItemFromBlock(Blocks.TORCH)))
				return true;
		}
	}
	return false;
}
 
Example 5
Project: Mods   File: ItemCloak.java   View Source Code Vote up 6 votes
public static Tuple<Integer, ItemStack> searchForWatches(EntityLivingBase living) {
	if (living instanceof EntitySpy)
		return new Tuple<>(3, ((EntitySpy)living).loadout.getStackInSlot(3));
	if (living instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer) living;
		if (!player.getHeldItemOffhand().isEmpty() && player.getHeldItemOffhand().getItem() instanceof ItemCloak
				&& player.getHeldItemOffhand().getTagCompound().getBoolean("Active"))
			// System.out.println("Found offhand");
			return new Tuple<>(40,player.getHeldItemOffhand());
		for (int i=0;i<player.inventory.mainInventory.size();i++) {
			ItemStack stack=player.inventory.mainInventory.get(i);
			if (!stack.isEmpty() && stack.getItem() instanceof ItemCloak
					&& stack.getTagCompound().getBoolean("Active"))
				// System.out.println("Found hand");
				return new Tuple<>(i,stack);
		}

	}
	return new Tuple<>(-1, ItemStack.EMPTY);
}
 
Example 6
Project: CustomWorldGen   File: EntityPig.java   View Source Code Vote up 6 votes
/**
 * returns true if all the conditions for steering the entity are met. For pigs, this is true if it is being ridden
 * by a player and the player is holding a carrot-on-a-stick
 */
public boolean canBeSteered()
{
    Entity entity = this.getControllingPassenger();

    if (!(entity instanceof EntityPlayer))
    {
        return false;
    }
    else
    {
        EntityPlayer entityplayer = (EntityPlayer)entity;
        ItemStack itemstack = entityplayer.getHeldItemMainhand();

        if (itemstack != null && itemstack.getItem() == Items.CARROT_ON_A_STICK)
        {
            return true;
        }
        else
        {
            itemstack = entityplayer.getHeldItemOffhand();
            return itemstack != null && itemstack.getItem() == Items.CARROT_ON_A_STICK;
        }
    }
}
 
Example 7
Project: ExPetrum   File: Stab.java   View Source Code Vote up 6 votes
@Override
public void onExecutionTick(EntityPlayer player, int progress)
{
	player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 2F);
	Vec3d look = player.getLookVec().scale(3);
	Vec3d pos = player.getPositionVector();
	List<EntityLivingBase> targets = Helpers.rayTraceEntities(player.world, pos.addVector(0, player.getEyeHeight(), 0), look, Optional.of(e -> e != player), EntityLivingBase.class);
	EntityLivingBase assumedToBeLookedAt = Helpers.getClosest(targets, player);
	if (assumedToBeLookedAt != null)
	{
		assumedToBeLookedAt.hurtResistantTime = 0;
		assumedToBeLookedAt.attackEntityFrom(DamageSource.causePlayerDamage(player), Math.max(1, (float) player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue() / 10));
		player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 0.1F);
		Vec3d targetPos = assumedToBeLookedAt.getPositionVector();
		player.world.spawnParticle(EnumParticleTypes.CRIT, targetPos.x + player.world.rand.nextDouble() / 2 - player.world.rand.nextDouble() / 2, targetPos.y + assumedToBeLookedAt.getEyeHeight() + player.world.rand.nextDouble() / 2 - player.world.rand.nextDouble() / 2, targetPos.z + player.world.rand.nextDouble() / 2 - player.world.rand.nextDouble() / 2, 0, 0, 0);
		if (!player.world.isRemote)
		{
			ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
			is.damageItem(1, player);
		}
	}
}
 
Example 8
Project: ExPetrum   File: DownStrike.java   View Source Code Vote up 6 votes
@Override
public void onExecutionStart(EntityPlayer player)
{
	ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
	EnumWeaponWeight weight = EnumWeaponWeight.getWeaponWeight(is);
	player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 1F);
	Vec3d look = player.getLookVec().scale(5);
	Vec3d pos = player.getPositionVector();
	List<EntityLivingBase> targets = Helpers.rayTraceEntities(player.world, pos.addVector(0, player.getEyeHeight(), 0), look, Optional.of(e -> e != player), EntityLivingBase.class);
	EntityLivingBase assumedToBeLookedAt = Helpers.getClosest(targets, player);
	if (assumedToBeLookedAt != null)
	{
		if (!player.world.isRemote)
		{
			assumedToBeLookedAt.addPotionEffect(new PotionEffect(ExPPotions.stunned, weight == EnumWeaponWeight.NORMAL ? 20 : 30, 0, false, false));
		}
		
		player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK, SoundCategory.PLAYERS, 1, 1F);
		Vec3d targetPos = assumedToBeLookedAt.getPositionVector();
		assumedToBeLookedAt.knockBack(player, 1, pos.x - targetPos.x, pos.z - targetPos.z);
		for (int i = 0; i < 50; ++i)
		{
			player.world.spawnParticle(EnumParticleTypes.CRIT_MAGIC, targetPos.x + player.world.rand.nextDouble() - player.world.rand.nextDouble(), targetPos.z + assumedToBeLookedAt.getEyeHeight() + player.world.rand.nextDouble() - player.world.rand.nextDouble(), targetPos.z + player.world.rand.nextDouble() - player.world.rand.nextDouble(), 0, -0.1, 0);
		}
	}
}
 
Example 9
Project: Bewitchment   File: RitualDrawing.java   View Source Code Vote up 5 votes
@Override
public void onStarted(EntityPlayer player, IRitualHandler tile, World world, BlockPos pos, NBTTagCompound data) {
	ItemStack chalk = player.getHeldItemOffhand();
	data.setInteger("chalkType", chalk.getMetadata());
	if (!player.isCreative()) {
		int usesLeft = chalk.getTagCompound().getInteger("usesLeft") - coords.size();
		chalk.getTagCompound().setInteger("usesLeft", usesLeft);
		if (usesLeft < 1)
			chalk.setCount(0);
	}
	player.setHeldItem(EnumHand.OFF_HAND, chalk);
}
 
Example 10
Project: DankNull   File: DankNullRenderer.java   View Source Code Vote up 5 votes
private boolean isStackInHand(ItemStack itemStackIn) {
	EntityPlayer player = EasyMappings.player();
	if ((player.getHeldItemMainhand() == itemStackIn) || (player.getHeldItemOffhand() == itemStackIn)) {
		return true;
	}
	return false;
}
 
Example 11
Project: Melodium   File: MelodiumGuiHandler.java   View Source Code Vote up 5 votes
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID == GuiLearnSpell.MAIN_ID){
		return new GuiLearnSpell(player, EnumHand.MAIN_HAND, player.getHeldItemMainhand());
	}
	if (ID == GuiLearnSpell.OFF_ID){
		return new GuiLearnSpell(player, EnumHand.OFF_HAND, player.getHeldItemOffhand());
	}
	return null;
}
 
Example 12
Project: Randores2   File: RandoresGuiHandler.java   View Source Code Vote up 5 votes
@Override
@SideOnly(Side.CLIENT)
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    BlockPos pos = new BlockPos(x, y, z);
    if (ID == RandoresGuiType.FORGE.ordinal()) {
        TileEntity entity = world.getTileEntity(pos);
        if (entity instanceof CraftiniumForgeTileEntity) {
            return new CraftiniumForgeGui((CraftiniumForgeTileEntity) entity, player.inventory);
        }
    } else if (ID == RandoresGuiType.TABLE.ordinal()) {
        return new CraftiniumTableGui(player.inventory, world, pos);
    } else if (ID == RandoresGuiType.TOME.ordinal()) {
        ItemStack[] stacks = new ItemStack[] {player.getHeldItemMainhand(), player.getHeldItemOffhand()};
        for(ItemStack stack : stacks) {
            if(stack.getItem() instanceof TomeItem && RandoresItemData.hasData(stack)) {
                RandoresItemData data = new RandoresItemData(stack);
                if(RandoresWorldData.contains(data)) {
                    return new TomeGui(RandoresWorldData.get(data).buildPages());
                }
            }
        }

        return new TomeGui(Arrays.asList(new TomeGui.StringElement("An example text page: \n" + TextFormatting.RED + "This tome has no data associated with it, so it instead displays examples of the different kinds of pages in a tome.", "Example"),
                new TomeGui.CraftingElement("An example crafting recipe page: ", new ItemStack[][]{
                           {new ItemStack(Items.IRON_INGOT), new ItemStack(Items.IRON_INGOT), new ItemStack(Items.IRON_INGOT)},
                           {null, new ItemStack(Items.STICK), null},
                           {null, new ItemStack(Items.STICK), null}
                   }, new ItemStack(Items.IRON_PICKAXE), "Example"),
                new TomeGui.FurnaceElement("An example furnace recipe page: ", new ItemStack(Items.STICK), new ItemStack(Blocks.IRON_ORE), new ItemStack(Items.IRON_INGOT), "Example")));
    } else if (ID == RandoresGuiType.CONVERTER.ordinal()) {
        return new CraftiniumConverterGui(player.inventory, world, pos);
    }
    return null;
}
 
Example 13
Project: Never-Enough-Currency   File: GuiHandler.java   View Source Code Vote up 5 votes
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID == 1) {
		return new ContainerItem(player, player.inventory, new InventoryItem(player.getHeldItemMainhand()));
	} else if (ID == 2) {
		return new ContainerItem(player, player.inventory, new InventoryItem(player.getHeldItemOffhand()));
	} else if (ID == 4) {
		return new ContainerStockCrate(player.inventory, (TileEntityStockCrate) world.getTileEntity(new BlockPos(x, y, z)));
	}

	return null;
}
 
Example 14
Project: ExPetrum   File: ClientCombatHandler.java   View Source Code Vote up 5 votes
public static void processClick(EntityPlayer player, boolean rightClick)
{
	if (!player.getHeldItemMainhand().isEmpty() || (!player.getHeldItemOffhand().isEmpty() && rightClick))
	{
		ItemStack is = !player.getHeldItemMainhand().isEmpty() ? player.getHeldItemMainhand() : player.getHeldItemOffhand();
		for (SpecialAttack attack : SpecialAttack.sortedData)
		{
			if (attack.canExecute(player, WeaponType.getType(is), EnumWeaponWeight.getWeaponWeight(is), rightClick))
			{
				boolean b = true;
				for (IExecuteCondition condition : attack.executeConditions)
				{
					if (!condition.isMet())
					{
						b = false;
						break;
					}
				}
				
				if (!b)
				{
					continue;
				}
				
				NBTTagCompound tag = NBTChain.startChain().withString("uuid", player.getPersistentID().toString()).withString("attackID", attack.id).withBool("rightClick", rightClick).endChain();
				VoidNetwork.sendDataToServer(ExPPackets.SPECIAL_ATTACK, tag);
				return;
			}
		}
	}
}
 
Example 15
Project: ExPetrum   File: Slash.java   View Source Code Vote up 5 votes
@Override
public void onExecutionStart(EntityPlayer player)
{
	ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
	EnumWeaponWeight weight = EnumWeaponWeight.getWeaponWeight(is);
	player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, SoundCategory.PLAYERS, 1, 1F);
	Vec3d playerLook = player.getLookVec();
	Vec3d playerPos = player.getPositionVector();
	player.world.spawnParticle(EnumParticleTypes.SWEEP_ATTACK, playerPos.x + playerLook.x, playerPos.y + player.getEyeHeight() * 0.5F, playerPos.z + playerLook.z, 0, 0, 0);
	AxisAlignedBB aabb = new AxisAlignedBB(playerPos.addVector(-3, -1, -3), playerPos.addVector(3, 3, 3));
	List<EntityLivingBase> lst = player.world.getEntitiesWithinAABB(EntityLivingBase.class, aabb, e -> e != player);
	for (EntityLivingBase ent : lst)
	{
		if (ent instanceof EntityTameable && ((EntityTameable)ent).getOwner() == player)
		{
			continue;
		}
		
		Vec3d ePos = ent.getPositionVector();
		Vec3d player2ent = ePos.subtract(playerPos).normalize();
		float angle = (float) Math.toDegrees(Math.acos(player2ent.dotProduct(playerLook)));
		if (angle > 60)
		{
			continue;
		}
		
		ent.attackEntityFrom(DamageSource.causePlayerDamage(player), (float) (player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue() * 0.85F));
		player.world.playSound(player, ent.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, SoundCategory.PLAYERS, 1, 2F);
		if (!player.world.isRemote && weight == EnumWeaponWeight.HEAVY && player.world.rand.nextBoolean())
		{
			ent.addPotionEffect(new PotionEffect(ExPPotions.stunned, 100, 0, false, false));
		}
	}
}
 
Example 16
Project: ExPetrum   File: PiercingDash.java   View Source Code Vote up 5 votes
@Override
public void onExecutionStart(EntityPlayer player)
{
	ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
	EnumWeaponWeight weight = EnumWeaponWeight.getWeaponWeight(is);
	player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 1F);
	Vec3d look = player.getLookVec().scale(6);
	Vec3d pos = player.getPositionVector();
	List<EntityLivingBase> targets = Helpers.rayTraceEntities(player.world, pos.addVector(0, player.getEyeHeight(), 0), look, Optional.of(e -> e != player), EntityLivingBase.class);
	for (EntityLivingBase target : targets)
	{
		Vec3d targetPos = target.getPositionVector();
		target.knockBack(player, 3, pos.x - targetPos.x, pos.z - targetPos.z);
		double distance = Math.max(0.3, targetPos.distanceTo(pos));
		target.attackEntityFrom(DamageSource.causePlayerDamage(player), (float) (player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue() * (1 - (distance / 6))));
		player.world.playSound(player, target.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK, SoundCategory.PLAYERS, 1, 2F);
		if (!player.world.isRemote && weight == EnumWeaponWeight.HEAVY && player.world.rand.nextDouble() <= 0.25)
		{
			target.addPotionEffect(new PotionEffect(ExPPotions.stunned, 100, 0, false, false));
		}
	}
	
	player.motionX += look.x / 5;
	player.motionZ += look.z / 5;
	for (int i = 0; i < 50; ++i)
	{
		double randomMagnitude = player.world.rand.nextDouble();
		Vec3d at = new Vec3d(pos.x + look.x * randomMagnitude, pos.y + player.getEyeHeight() - 0.25 + look.y * randomMagnitude, pos.z + look.z * randomMagnitude);
		player.world.spawnParticle(EnumParticleTypes.CRIT, at.x, at.y, at.z, 0, 0, 0);
	}
}
 
Example 17
Project: ExPetrum   File: ItemThrow.java   View Source Code Vote up 5 votes
@Override
public void onExecutionStart(EntityPlayer player)
{
	ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
	EntityThrownWeapon etw = new EntityThrownWeapon(player.getEntityWorld(), player, is.copy());
	etw.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
	if (!player.world.isRemote)
	{
		player.world.spawnEntity(etw);
		is.setCount(0);
	}
}
 
Example 18
Project: ExPetrum   File: Behead.java   View Source Code Vote up 5 votes
@Override
public void onExecutionStart(EntityPlayer player)
{
	ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
	player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 1F);
	Vec3d look = player.getLookVec().scale(5);
	Vec3d pos = player.getPositionVector();
	List<EntityLivingBase> targets = Helpers.rayTraceEntities(player.world, pos.addVector(0, player.getEyeHeight(), 0), look, Optional.of(e -> e != player), EntityLivingBase.class);
	EntityLivingBase assumedToBeLookedAt = Helpers.getClosest(targets, player);
	if (assumedToBeLookedAt != null)
	{
		if (!player.world.isRemote)
		{
			is.damageItem(1, player);
		}
		
		assumedToBeLookedAt.attackEntityFrom(DamageSource.causePlayerDamage(player), (float) player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue());
		player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 0.1F);
		Vec3d targetPos = assumedToBeLookedAt.getPositionVector();
		player.world.spawnParticle(EnumParticleTypes.SWEEP_ATTACK, targetPos.x, targetPos.y + assumedToBeLookedAt.getEyeHeight(), targetPos.z, 0, 0, 0);
		float chance = (1 - assumedToBeLookedAt.getHealth() / assumedToBeLookedAt.getMaxHealth());
		if (!player.world.isRemote && player.world.rand.nextFloat() < chance / 10)
		{
			assumedToBeLookedAt.hurtResistantTime = assumedToBeLookedAt.hurtTime = 0;
			assumedToBeLookedAt.attackEntityFrom(DamageSource.causePlayerDamage(player), Float.MAX_VALUE);
		}
	}
}
 
Example 19
Project: ArcaneMagic   File: ArcaneTransfigurationTableTESR.java   View Source Code Vote up 4 votes
@Override
public void render(TileEntityArcaneTransfigurationTable te, double x, double y, double z, float partialTicks,
		int destroyStage, float alpha)
{
	te.frameAge++;
	
	GlStateManager.pushMatrix();
	GlStateManager.translate(x, y, z);
	GlStateManager.disableRescaleNormal();
	IItemHandler cap = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
	for (int i = 0; i < cap.getSlots(); i++)
	{
		renderItem(cap.getStackInSlot(i), i);
	}

	EntityPlayer player = Minecraft.getMinecraft().player;
	World world = Minecraft.getMinecraft().world;

	ItemStack held = player.getHeldItemMainhand();

	if (held.isEmpty() || !(held.getItem() instanceof IArcaneTransfigurationItem))
	{
		held = player.getHeldItemOffhand();
	}

	if (!held.isEmpty() && held.getItem() instanceof IArcaneTransfigurationItem)
	{
		NonNullList<ItemStack> recipeInputs = NonNullList.withSize(9, ItemStack.EMPTY);

		for (int i = 0; i < 9; i++)
		{
			recipeInputs.set(i, cap.getStackInSlot(i));
		}

		IArcaneTransfigurationRecipe foundRecipe = ArcaneMagicAPI.getArcaneTransfigurationRecipe(player, held, recipeInputs, world);

		if (foundRecipe != null)
		{
			GLHelper.renderItemStackFancy(foundRecipe.getRecipeOutput(), new Vec3d(0, 1.5, 0), true, Color.RED,
					te.frameAge / 4, te.getWorld().getSeed());
		}
	}

	GlStateManager.popMatrix();
}
 
Example 20
Project: ExPetrum   File: PlayerHUDRenderer.java   View Source Code Vote up 4 votes
private static void renderHotbar(float partialTicks, ScaledResolution sRes)
{
	if (Minecraft.getMinecraft().getRenderViewEntity() instanceof EntityPlayer)
       {
           GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
           EntityPlayer entityplayer = (EntityPlayer)Minecraft.getMinecraft().getRenderViewEntity();
           ItemStack itemstack = entityplayer.getHeldItemOffhand();
           EnumHandSide enumhandside = entityplayer.getPrimaryHand().opposite();
           int i = sRes.getScaledWidth() / 2;
           GlStateManager.enableRescaleNormal();
           GlStateManager.enableBlend();
           GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
           RenderHelper.enableGUIStandardItemLighting();
           for (int l = 0; l < 9; ++l)
           {
               int i1 = i - 90 + l * 20 + 3;
               int j1 = sRes.getScaledHeight() - 16 - 9;
               renderHotbarItem(i1, j1, partialTicks, entityplayer, entityplayer.inventory.mainInventory.get(l));
           }

           if (!itemstack.isEmpty())
           {
               int l1 = sRes.getScaledHeight() - 16 - 3;

               if (enumhandside == EnumHandSide.LEFT)
               {
                   renderHotbarItem(i - 102 - 26, l1 - 8, partialTicks, entityplayer, itemstack);
               }
               else
               {
                   renderHotbarItem(i + 102 + 10, l1 - 8, partialTicks, entityplayer, itemstack);
               }
           }

           if (Minecraft.getMinecraft().gameSettings.attackIndicator == 2)
           {
               float f1 = Minecraft.getMinecraft().player.getCooledAttackStrength(0.0F);

               if (f1 < 1.0F)
               {
                   Minecraft.getMinecraft().getTextureManager().bindTexture(Gui.ICONS);
                   GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
               }
           }

           RenderHelper.disableStandardItemLighting();
           GlStateManager.disableRescaleNormal();
           GlStateManager.disableBlend();
       }
}