net.minecraft.entity.player.EnumPlayerModelParts Java Examples

The following examples show how to use net.minecraft.entity.player.EnumPlayerModelParts. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlipHandler.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void transform(EntityLivingBase bat) {
    String s = EnumChatFormatting.getTextWithoutFormattingCodes(bat.getName());
    Integer state = rotateState.get(bat.getUniqueID());
    if (CosmeticsUtil.shouldHide(EnumPurchaseType.FLIP_COSMETIC)) return;
    if ((state != null && state == 2) || s != null && (s.equals("Dinnerbone") ||
        s.equals("Grumm")) && (!(bat instanceof EntityPlayer) || ((EntityPlayer) bat).isWearing(EnumPlayerModelParts.CAPE))) {
        float y = bat.height + 0.1F;
        GlStateManager.translate(0.0F, y / 2, 0.0F);
        double l = System.currentTimeMillis() % (360 * 1.75) / 1.75;
        GlStateManager.rotate((float) l, .1F, 0.0F, 0.0F);
        GlStateManager.translate(0.0F, -y / 2, 0.0F);
    } else if ((state != null && state == 1) || s != null && (s.equals("Dinnerbone") ||
        s.equals("Grumm")) && (!(bat instanceof EntityPlayer) || ((EntityPlayer) bat).isWearing(EnumPlayerModelParts.CAPE))) {
        {
            GlStateManager.translate(0.0F, bat.height + 0.1F, 0.0F);
            GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
        }
    }
}
 
Example #2
Source File: ProxyClient.java    From WearableBackpacks with MIT License 5 votes vote down vote up
/** Sets whether the player is currently wearing the specified model part.
 *  This is the opposite of the {@link EntityPlayer#isWearing} method. */
private static void setWearing(EntityPlayer player, EnumPlayerModelParts part, boolean value) {
	byte current = player.getDataManager().get(PLAYER_MODEL_FLAG).byteValue();
	if (value) current |= part.getPartMask();
	else current &= ~part.getPartMask();
	player.getDataManager().set(PLAYER_MODEL_FLAG, current);
}
 
Example #3
Source File: ProxyClient.java    From WearableBackpacks with MIT License 5 votes vote down vote up
@SubscribeEvent(priority=EventPriority.LOWEST)
public void onRenderPlayerPre(RenderPlayerEvent.Pre event) {
	EntityPlayer player = event.getEntityPlayer();
	if ((BackpackHelper.getBackpack(player) == null) ||
	    !player.isWearing(EnumPlayerModelParts.CAPE)) return;
	// Disable player rendering for players with equipped backpacks
	// by temporarily setting whether they are wearing it to false.
	setWearing(player, EnumPlayerModelParts.CAPE, false);
	_disabledCape = true;
}
 
Example #4
Source File: ProxyClient.java    From WearableBackpacks with MIT License 5 votes vote down vote up
@SubscribeEvent(priority=EventPriority.HIGHEST)
public void onRenderPlayerPost(RenderPlayerEvent.Post event) {
	if (!_disabledCape) return;
	// Reenable cape rendering if it was disabled.
	EntityPlayer player = event.getEntityPlayer();
	setWearing(player, EnumPlayerModelParts.CAPE, true);
	_disabledCape = false;
}
 
Example #5
Source File: RendererLivingEntityHook.java    From SkyblockAddons with MIT License 4 votes vote down vote up
public static boolean isWearing(EntityPlayer entityPlayer, EnumPlayerModelParts p_175148_1_) {
    return (!isCoolPerson && entityPlayer.isWearing(p_175148_1_)) ||
            (isCoolPerson && !entityPlayer.isWearing(p_175148_1_));
}
 
Example #6
Source File: LevelheadGui.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void doTab(Levelhead instance) {
    EntityPlayerSP player = mc.thePlayer;
    NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(player.getUniqueID());
    LevelheadDisplay tab = instance.getDisplayManager().getTab();

    if (tab != null) {
        String formattedText = player.getDisplayName().getFormattedText();
        int totalTabWidth = 9 + fontRendererObj.getStringWidth(formattedText) + getLevelheadWidth(playerInfo) + 15;
        int fakeTabTop = height - 200;
        int centerOn = width / 3;
        int leftStart = centerOn - totalTabWidth / 2;
        drawRect(leftStart, fakeTabTop, centerOn + totalTabWidth / 2, fakeTabTop + 8, Integer.MIN_VALUE);
        drawRect(leftStart, fakeTabTop, centerOn + totalTabWidth / 2, fakeTabTop + 8, 553648127);
        fontRendererObj.drawString(formattedText, leftStart + 9, fakeTabTop, -1, true);

        mc.getTextureManager().bindTexture(player.getLocationSkin());
        int l2 = 8;
        int i3 = 8;
        Gui.drawScaledCustomSizeModalRect(leftStart, fakeTabTop, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F);

        if (player.isWearing(EnumPlayerModelParts.HAT)) {
            int j3 = 8;
            int k3 = 8;
            Gui.drawScaledCustomSizeModalRect(leftStart, fakeTabTop, 40.0F, (float) j3, 8, k3, 8, 8, 64.0F, 64.0F);
        }

        drawPing(leftStart + totalTabWidth, fakeTabTop, playerInfo);
        drawPingHook(0, leftStart + totalTabWidth, fakeTabTop, playerInfo);
        LevelheadPurchaseStates purchaseStates = instance.getLevelheadPurchaseStates();

        if (!purchaseStates.isTab()) {
            String text = "Levelhead tab display not purchased!\nPlease purchase to activate and configure.";
            int i = 1;

            for (String s : text.split("\n")) {
                int offset = i * 10;
                int stringWidth = fontRendererObj.getStringWidth(s);
                int tmpLeft = width / 3 - stringWidth / 2;
                fakeTabTop = height - 180;
                drawRect(tmpLeft, fakeTabTop + offset, tmpLeft + stringWidth, fakeTabTop + offset + 8, Integer.MIN_VALUE);
                fontRendererObj.drawString(s, tmpLeft, fakeTabTop + offset, Color.YELLOW.getRGB(), true);
                i++;
            }

            reg(new GuiButton(++currentID, centerOn - 60, height - 140, 120, 20, YELLOW + "Purchase Tab Display"),
                button -> attemptPurchase("tab"));
        }
    }
}
 
Example #7
Source File: BloodRenderLayer.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void setModelVisibilities(AbstractClientPlayer clientPlayer) {
	ModelPlayer modelplayer = render.getMainModel();

	if (clientPlayer.isSpectator()) {
		modelplayer.setVisible(true);
		modelplayer.bipedHead.showModel = true;
		modelplayer.bipedHeadwear.showModel = true;
	} else {
		ItemStack stackMain = clientPlayer.getHeldItemMainhand();
		ItemStack stackOff = clientPlayer.getHeldItemOffhand();
		modelplayer.setVisible(false);
		modelplayer.bipedHeadwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.HAT);
		modelplayer.bipedBodyWear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.JACKET);
		modelplayer.bipedLeftLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG);
		modelplayer.bipedRightLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG);
		modelplayer.bipedLeftArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE);
		modelplayer.bipedRightArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE);
		modelplayer.isSneak = clientPlayer.isSneaking();
		ArmPose poseMain = ArmPose.EMPTY;

		if (!stackMain.isEmpty()) {
			poseMain = ArmPose.ITEM;

			if (clientPlayer.getItemInUseCount() > 0) {
				EnumAction enumaction = stackMain.getItemUseAction();

				if (enumaction == EnumAction.BLOCK) {
					poseMain = ArmPose.BLOCK;
				} else if (enumaction == EnumAction.BOW) {
					poseMain = ArmPose.BOW_AND_ARROW;
				}
			}
		}

		ArmPose poseOff = ArmPose.EMPTY;
		if (!stackOff.isEmpty()) {
			poseOff = ArmPose.ITEM;

			if (clientPlayer.getItemInUseCount() > 0) {
				EnumAction enumaction1 = stackOff.getItemUseAction();

				if (enumaction1 == EnumAction.BLOCK) {
					poseOff = ArmPose.BLOCK;
				}
			}
		}

		if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT) {
			modelplayer.rightArmPose = poseMain;
			modelplayer.leftArmPose = poseOff;
		} else {
			modelplayer.rightArmPose = poseOff;
			modelplayer.leftArmPose = poseMain;
		}
	}
}
 
Example #8
Source File: RenderPlayerCyberware.java    From Cyberware with MIT License 4 votes vote down vote up
private void setModelVisibilities(AbstractClientPlayer clientPlayer)
{
	ModelPlayer modelplayer = this.getMainModel();

	if (clientPlayer.isSpectator())
	{
		modelplayer.setInvisible(false);
		modelplayer.bipedHead.showModel = true;
		modelplayer.bipedHeadwear.showModel = true;
	}
	else
	{
		ItemStack itemstack = clientPlayer.getHeldItemMainhand();
		ItemStack itemstack1 = clientPlayer.getHeldItemOffhand();
		modelplayer.setInvisible(true);
		modelplayer.bipedHeadwear.showModel = modelplayer.bipedHead.isHidden ? false : clientPlayer.isWearing(EnumPlayerModelParts.HAT);
		modelplayer.bipedBodyWear.showModel = modelplayer.bipedBody.isHidden ? false : clientPlayer.isWearing(EnumPlayerModelParts.JACKET);
		modelplayer.bipedLeftLegwear.showModel = modelplayer.bipedLeftLeg.isHidden ? false : clientPlayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG);
		modelplayer.bipedRightLegwear.showModel = modelplayer.bipedRightLeg.isHidden ? false : clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG);
		modelplayer.bipedLeftArmwear.showModel = modelplayer.bipedLeftArm.isHidden ? false : clientPlayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE);
		modelplayer.bipedRightArmwear.showModel = modelplayer.bipedRightArm.isHidden ? false :clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE);
		modelplayer.isSneak = clientPlayer.isSneaking();
		ModelBiped.ArmPose modelbiped$armpose = ModelBiped.ArmPose.EMPTY;
		ModelBiped.ArmPose modelbiped$armpose1 = ModelBiped.ArmPose.EMPTY;

		if (itemstack != null)
		{
			modelbiped$armpose = ModelBiped.ArmPose.ITEM;

			if (clientPlayer.getItemInUseCount() > 0)
			{
				EnumAction enumaction = itemstack.getItemUseAction();

				if (enumaction == EnumAction.BLOCK)
				{
					modelbiped$armpose = ModelBiped.ArmPose.BLOCK;
				}
				else if (enumaction == EnumAction.BOW)
				{
					modelbiped$armpose = ModelBiped.ArmPose.BOW_AND_ARROW;
				}
			}
		}

		if (itemstack1 != null)
		{
			modelbiped$armpose1 = ModelBiped.ArmPose.ITEM;

			if (clientPlayer.getItemInUseCount() > 0)
			{
				EnumAction enumaction1 = itemstack1.getItemUseAction();

				if (enumaction1 == EnumAction.BLOCK)
				{
					modelbiped$armpose1 = ModelBiped.ArmPose.BLOCK;
				}
			}
		}

		if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT)
		{
			modelplayer.rightArmPose = modelbiped$armpose;
			modelplayer.leftArmPose = modelbiped$armpose1;
		}
		else
		{
			modelplayer.rightArmPose = modelbiped$armpose1;
			modelplayer.leftArmPose = modelbiped$armpose;
		}
	}
}