net.minecraft.client.entity.AbstractClientPlayer Java Examples

The following examples show how to use net.minecraft.client.entity.AbstractClientPlayer. 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: FlossDanceHandler.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void modifyPlayer(AbstractClientPlayer entity, IMixinModelBiped player, float heldPercent) {
    if (shouldNotModify(entity, player)) {
        return;
    }

    player.getBipedBody().rotateAngleZ = (float) Math.toRadians((right ? 10f : -10f) * heldPercent);

    player.getBipedRightUpperLeg().rotateAngleZ = (float) Math.toRadians((right ? -10f : 10f) * heldPercent);
    player.getBipedLeftUpperLeg().rotateAngleZ = (float) Math.toRadians((right ? -10f : 10f) * heldPercent);
    player.getBipedRightUpperLeg().offsetX = (right ? -0.17f : 0.17f) * heldPercent;
    player.getBipedLeftUpperLeg().offsetX = (right ? -0.17f : 0.17f) * heldPercent;

    player.getBipedHead().rotateAngleX = (float) Math.toRadians(randomHeadMovement[0] * heldPercent);
    player.getBipedHeadwear().rotateAngleX = (float) Math.toRadians(randomHeadMovement[0] * heldPercent);
    player.getBipedHead().rotateAngleY = (float) Math.toRadians(randomHeadMovement[1] * heldPercent);
    player.getBipedHeadwear().rotateAngleY = (float) Math.toRadians(randomHeadMovement[1] * heldPercent);
    player.getBipedHead().rotateAngleZ = (float) Math.toRadians(randomHeadMovement[2] * heldPercent);
    player.getBipedHeadwear().rotateAngleZ = (float) Math.toRadians(randomHeadMovement[2] * heldPercent);

    player.getBipedRightUpperArm().rotateAngleZ = (float) Math.toRadians((right ? -50f : 50f) * heldPercent);
    player.getBipedRightUpperArm().rotateAngleX = (float) Math.toRadians((armsDirection == ArmsDirection.BACK ? 30.0f : -30.0f) * heldPercent);

    player.getBipedLeftUpperArm().rotateAngleZ = (float) Math.toRadians((right ? -50f : 50f) * heldPercent);
    player.getBipedLeftUpperArm().rotateAngleX = (float) Math.toRadians((armsDirection == ArmsDirection.BACK ? 30.0f : -30.0f) * heldPercent);
}
 
Example #2
Source File: RenderPlayerCyberware.java    From Cyberware with MIT License 6 votes vote down vote up
@Override
public void renderRightArm(AbstractClientPlayer clientPlayer)
{
	Minecraft.getMinecraft().getTextureManager().bindTexture(robo);
	super.renderRightArm(clientPlayer);
	
	if (CyberwareAPI.isCyberwareInstalled(clientPlayer, new ItemStack(CyberwareContent.handUpgrades, 1, 1)) && CyberwareAPI.isCyberwareInstalled(clientPlayer, new ItemStack(CyberwareContent.cyberlimbs, 1, 1)) && Minecraft.getMinecraft().gameSettings.mainHand == EnumHandSide.RIGHT && clientPlayer.getHeldItemMainhand() == null
			&& EnableDisableHelper.isEnabled(CyberwareAPI.getCyberware(clientPlayer, new ItemStack(CyberwareContent.handUpgrades, 1, 1))))
	{
		GL11.glPushMatrix();

		float percent = ((Minecraft.getMinecraft().thePlayer.ticksExisted + Minecraft.getMinecraft().getRenderPartialTicks() - ItemHandUpgrade.clawsTime) / 4F);
		percent = Math.min(1.0F, percent);
		percent = Math.max(0F, percent);
		percent = (float) Math.sin(percent * Math.PI / 2F);
		claws.claw1.rotateAngleY = 0.00F;
		claws.claw1.rotateAngleZ = 0.07F;
		claws.claw1.rotateAngleX = 0.00F;
		claws.claw1.setRotationPoint(-5.0F, -5.0F + (7F * percent), 0.0F);
		claws.claw1.render(0.0625F);
		GL11.glPopMatrix();
	}
}
 
Example #3
Source File: RenderCyberlimbHand.java    From Cyberware with MIT License 6 votes vote down vote up
private RenderPlayer getEntityRenderObject(AbstractClientPlayer p, EnumHandSide side)
{
	if (side == EnumHandSide.RIGHT)
	{
		if (rightRobot)
		{
			return EssentialsMissingHandlerClient.renderF;
		}
	}
	else
	{
		if (leftRobot)
		{
			return EssentialsMissingHandlerClient.renderF;
		}
	}
	
	return (RenderPlayer) this.renderManager.<AbstractClientPlayer>getEntityRenderObject(p);

}
 
Example #4
Source File: RenderCyberlimbHand.java    From Cyberware with MIT License 6 votes vote down vote up
private void renderArm(EnumHandSide p_187455_1_)
{
	this.mc.getTextureManager().bindTexture(this.mc.thePlayer.getLocationSkin());
	Render<AbstractClientPlayer> render = getEntityRenderObject(this.mc.thePlayer, p_187455_1_);
	RenderPlayer renderplayer = (RenderPlayer)render;
	GlStateManager.pushMatrix();
	float f = p_187455_1_ == EnumHandSide.RIGHT ? 1.0F : -1.0F;
	GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F);
	GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
	GlStateManager.rotate(f * -41.0F, 0.0F, 0.0F, 1.0F);
	GlStateManager.translate(f * 0.3F, -1.1F, 0.45F);

	if (p_187455_1_ == EnumHandSide.RIGHT)
	{
		renderplayer.renderRightArm(this.mc.thePlayer);
	}
	else
	{
		renderplayer.renderLeftArm(this.mc.thePlayer);
	}

	GlStateManager.popMatrix();
}
 
Example #5
Source File: RenderPlayerCyberware.java    From Cyberware with MIT License 6 votes vote down vote up
public void doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, float partialTicks)
{
	if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(entity, this, partialTicks, x, y, z))) return;
	if (!entity.isUser() || this.renderManager.renderViewEntity == entity)
	{
		double d0 = y;

		if (entity.isSneaking() && !(entity instanceof EntityPlayerSP))
		{
			d0 = y - 0.125D;
		}

		this.setModelVisibilities(entity);
		GlStateManager.enableBlendProfile(GlStateManager.Profile.PLAYER_SKIN);
		doRenderELB(entity, x, d0, z, entityYaw, partialTicks);
		GlStateManager.disableBlendProfile(GlStateManager.Profile.PLAYER_SKIN);
	}
	net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(entity, this, partialTicks, x, y, z));
}
 
Example #6
Source File: RenderPlayerCyberware.java    From Cyberware with MIT License 6 votes vote down vote up
@Override
public void renderLeftArm(AbstractClientPlayer clientPlayer)
{
	Minecraft.getMinecraft().getTextureManager().bindTexture(robo);
	super.renderLeftArm(clientPlayer);
	
	if (CyberwareAPI.isCyberwareInstalled(clientPlayer, new ItemStack(CyberwareContent.handUpgrades, 1, 1))
		&& CyberwareAPI.isCyberwareInstalled(clientPlayer, new ItemStack(CyberwareContent.cyberlimbs, 1, 0))
		&& Minecraft.getMinecraft().gameSettings.mainHand == EnumHandSide.LEFT && clientPlayer.getHeldItemMainhand() == null
		&& EnableDisableHelper.isEnabled(CyberwareAPI.getCyberware(clientPlayer, new ItemStack(CyberwareContent.handUpgrades, 1, 1))))
	{
		GL11.glPushMatrix();

		float percent = ((Minecraft.getMinecraft().thePlayer.ticksExisted + Minecraft.getMinecraft().getRenderPartialTicks() - ItemHandUpgrade.clawsTime) / 4F);
		percent = Math.min(1.0F, percent);
		percent = Math.max(0F, percent);
		percent = (float) Math.sin(percent * Math.PI / 2F);
		claws.claw1.rotateAngleY = 0.00F;
		claws.claw1.rotateAngleZ = 0.07F;
		claws.claw1.rotateAngleX = 0.00F;
		claws.claw1.setRotationPoint(-5.0F, -5.0F + (7F * percent), 0.0F);
		claws.claw1.render(0.0625F);
		GL11.glPopMatrix();
	}
}
 
Example #7
Source File: RenderEventHandler.java    From DeveloperCapes with MIT License 6 votes vote down vote up
@SubscribeEvent
public void renderPlayer(RenderPlayerEvent.Specials.Pre event) {
    AbstractClientPlayer player = (AbstractClientPlayer) event.entityPlayer;

    UserManager manager = UserManager.getInstance();
    User user = manager.getUser(player.getUniqueID().toString());
    if (user == null) return;

    ICape cape = user.capes.get(0);
    if (cape == null) return;

    boolean flag = cape.isTextureLoaded(player);
    if (!flag) {
        cape.loadTexture(player);
    }
}
 
Example #8
Source File: RenderCodex.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
private static void renderItemInFirstPerson(AbstractClientPlayer player, EnumHand hand, float swingProgress, ItemStack stack, float equipProgress) {
	// Cherry picked from ItemRenderer.renderItemInFirstPerson
	boolean flag = hand == EnumHand.MAIN_HAND;
	EnumHandSide enumhandside = flag ? player.getPrimaryHand() : player.getPrimaryHand().opposite();
	GlStateManager.pushMatrix();
	boolean flag1 = enumhandside == EnumHandSide.RIGHT;
	float f = -0.4F * MathHelper.sin(MathHelper.sqrt(swingProgress) * (float) Math.PI);
	float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt(swingProgress) * ((float) Math.PI * 2F));
	float f2 = -0.2F * MathHelper.sin(swingProgress * (float) Math.PI);
	int i = flag1 ? 1 : -1;
	GlStateManager.translate(i * f, f1, f2);
	transformSideFirstPerson(enumhandside, equipProgress);
	transformFirstPerson(enumhandside, swingProgress);
	RenderCodex.INSTANCE.doRender(enumhandside, stack);
	GlStateManager.popMatrix();
}
 
Example #9
Source File: BloodRenderLayer.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void doRenderLayer(@Nonnull AbstractClientPlayer entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
	if (Minecraft.getMinecraft().player == null || Minecraft.getMinecraft().world == null) return;

	IManaCapability cap = ManaCapabilityProvider.getCap(entity);
	if (cap != null) {
		EnumBloodType type = cap.getBloodType();
		if (type != null && type != EnumBloodType.NONE) {
			render.bindTexture(EnumBloodType.getResourceLocation(type));
			ClientUtilMethods.glColor(type.color);
			setModelVisibilities(entity);
			GlStateManager.enableBlendProfile(Profile.PLAYER_SKIN);

			GlStateManager.disableLighting();
			ShaderHelper.INSTANCE.useShader(Shaders.rawColor);

			render.getMainModel().render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);

			GlStateManager.enableLighting();
			ShaderHelper.INSTANCE.releaseShader();

			GlStateManager.disableBlendProfile(Profile.PLAYER_SKIN);
			GlStateManager.color(1.0F, 1.0F, 1.0F);
		}
	}
}
 
Example #10
Source File: EntityUtils.java    From ForgeHax with MIT License 6 votes vote down vote up
public static MobTypeEnum getRelationship(Entity entity) {
  if (entity instanceof AbstractClientPlayer) {
    return MobTypeEnum.PLAYER;
  } else {
    // check special cases first
    for (MobType type : MobTypeRegistry.getSortedSpecialMobTypes()) {
      if (type.isMobType(entity)) {
        return type.getMobType(entity);
      }
    }
    // this code will continue if no special was found
    if (MobTypeRegistry.HOSTILE.isMobType(entity)) {
      return MobTypeEnum.HOSTILE;
    } else if (MobTypeRegistry.FRIENDLY.isMobType(entity)) {
      return MobTypeEnum.FRIENDLY;
    } else {
      return MobTypeEnum.HOSTILE; // default to hostile
    }
  }
}
 
Example #11
Source File: MixinModelPlayer.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Inject(method = "setRotationAngles", at = @At("RETURN"))
private void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn, CallbackInfo ci) {
    // This should always be the case I guess, but we better be safe
    if (entityIn instanceof AbstractClientPlayer) {
        EventBus.INSTANCE.post(new PreCopyPlayerModelAnglesEvent(((AbstractClientPlayer) entityIn), this));
    }

    copyModelAnglesAndOffest(bipedLeftArm, bipedLeftForeArm);
    copyModelAnglesAndOffest(bipedRightArm, bipedRightForeArm);
    copyModelAnglesAndOffest(bipedLeftArmwear, bipedLeftForeArmwear);
    copyModelAnglesAndOffest(bipedRightArmwear, bipedRightForeArmwear);

    copyModelAnglesAndOffest(bipedLeftLeg, bipedLeftLowerLeg);
    copyModelAnglesAndOffest(bipedRightLeg, bipedRightLowerLeg);
    copyModelAnglesAndOffest(bipedLeftLegwear, bipedLeftLowerLegwear);
    copyModelAnglesAndOffest(bipedRightLegwear, bipedRightLowerLegwear);

    if (entityIn instanceof AbstractClientPlayer) {
        EventBus.INSTANCE.post(new PostCopyPlayerModelAnglesEvent(((AbstractClientPlayer) entityIn), this));
    }
}
 
Example #12
Source File: TPoseHandler.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void modifyPlayer(AbstractClientPlayer entity, IMixinModelPlayer player, float heldPercent) {
    player.getBipedLeftUpperArm().rotateAngleZ = (float) Math.toRadians(-90.0f * heldPercent);
    player.getBipedLeftUpperArmwear().rotateAngleZ = (float) Math.toRadians(-90.0f * heldPercent);

    player.getBipedLeftUpperArm().rotateAngleX = 0;
    player.getBipedLeftUpperArmwear().rotateAngleX = 0;

    player.getBipedLeftUpperArm().rotateAngleY = 0;
    player.getBipedLeftUpperArmwear().rotateAngleY = 0;

    player.getBipedRightUpperArm().rotateAngleZ = (float) Math.toRadians(90.0f * heldPercent);
    player.getBipedRightUpperArmwear().rotateAngleZ = (float) Math.toRadians(90.0f * heldPercent);

    player.getBipedRightUpperArm().rotateAngleX = 0;
    player.getBipedRightUpperArmwear().rotateAngleX = 0;

    player.getBipedRightUpperArm().rotateAngleY = 0;
    player.getBipedRightUpperArmwear().rotateAngleY = 0;
}
 
Example #13
Source File: ClientProxy.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public static void onPlayerRender(RenderPlayerEvent.Pre event) {
    AbstractClientPlayer clientPlayer = (AbstractClientPlayer) event.getEntityPlayer();
    if (capeHoldersUUIDs.contains(clientPlayer.getUniqueID()) && clientPlayer.hasPlayerInfo() && clientPlayer.getLocationCape() == null) {
        NetworkPlayerInfo playerInfo = ObfuscationReflectionHelper.getPrivateValue(AbstractClientPlayer.class, clientPlayer, 0);
        Map<Type, ResourceLocation> playerTextures = ObfuscationReflectionHelper.getPrivateValue(NetworkPlayerInfo.class, playerInfo, 1);
        playerTextures.put(Type.CAPE, GREGTECH_CAPE_TEXTURE);
    }
}
 
Example #14
Source File: RenderCyberlimbHand.java    From Cyberware with MIT License 5 votes vote down vote up
private void renderArmFirstPerson(float p_187456_1_, float p_187456_2_, EnumHandSide p_187456_3_)
{
	boolean flag = p_187456_3_ != EnumHandSide.LEFT;
	float f = flag ? 1.0F : -1.0F;
	float f1 = MathHelper.sqrt_float(p_187456_2_);
	float f2 = -0.3F * MathHelper.sin(f1 * (float)Math.PI);
	float f3 = 0.4F * MathHelper.sin(f1 * ((float)Math.PI * 2F));
	float f4 = -0.4F * MathHelper.sin(p_187456_2_ * (float)Math.PI);
	GlStateManager.translate(f * (f2 + 0.64000005F), f3 + -0.6F + p_187456_1_ * -0.6F, f4 + -0.71999997F);
	GlStateManager.rotate(f * 45.0F, 0.0F, 1.0F, 0.0F);
	float f5 = MathHelper.sin(p_187456_2_ * p_187456_2_ * (float)Math.PI);
	float f6 = MathHelper.sin(f1 * (float)Math.PI);
	GlStateManager.rotate(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
	GlStateManager.rotate(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
	AbstractClientPlayer abstractclientplayer = this.mc.thePlayer;
	this.mc.getTextureManager().bindTexture(abstractclientplayer.getLocationSkin());
	GlStateManager.translate(f * -1.0F, 3.6F, 3.5F);
	GlStateManager.rotate(f * 120.0F, 0.0F, 0.0F, 1.0F);
	GlStateManager.rotate(200.0F, 1.0F, 0.0F, 0.0F);
	GlStateManager.rotate(f * -135.0F, 0.0F, 1.0F, 0.0F);
	GlStateManager.translate(f * 5.6F, 0.0F, 0.0F);
	RenderPlayer renderplayer = getEntityRenderObject(this.mc.thePlayer, p_187456_3_);
	GlStateManager.disableCull();

	if (flag)
	{
		renderplayer.renderRightArm(abstractclientplayer);
	}
	else
	{
		renderplayer.renderLeftArm(abstractclientplayer);
	}

	GlStateManager.enableCull();
}
 
Example #15
Source File: CosmeticHat.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@InvokeEvent
public void onPlayerRender(RenderPlayerEvent e) {
    Minecraft mc = Minecraft.getMinecraft();
    AbstractClientPlayer player = e.getEntity();
    if (CosmeticsUtil.shouldHide(getPurchaseType())) return;

    if (isPurchasedBy(player.getUniqueID()) && !player.isInvisible()) {
        HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(player.getUniqueID());
        if (packageIfReady.getCachedSettings().getCurrentHatType() != getPurchaseType()) return;

        GlStateManager.pushMatrix();
        GlStateManager.translate(e.getX(), e.getY(), e.getZ());

        double scale = 1.0F;
        double rotate = interpolate(player.prevRotationYawHead, player.rotationYawHead, e.getPartialTicks());
        double rotate1 = interpolate(player.prevRotationPitch, player.rotationPitch, e.getPartialTicks());

        GL11.glScaled(-scale, -scale, scale);
        GL11.glTranslated(0.0, -((player.height - (player.isSneaking() ? .25 : 0)) - .38) / scale, 0.0);
        GL11.glRotated(180.0 + rotate, 0.0, 1.0, 0.0);
        GL11.glRotated(rotate1, 1.0D, 0.0D, 0.0D);
        GlStateManager.translate(0, -.45, 0);

        /* Bind the hat texture and render the model */
        mc.getTextureManager().bindTexture(hatTexture);
        hatModel.render(player, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

        GlStateManager.popMatrix();
    }
}
 
Example #16
Source File: MixinAbstractClientPlayer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @author asbyth
 * @reason update fov event
 */
@Overwrite
public float getFovModifier() {
    float f = 1.0F;

    if (capabilities.isFlying) {
        f *= 1.1F;
    }

    IAttributeInstance iAttributeInstance = getEntityAttribute(SharedMonsterAttributes.movementSpeed);
    f = (float) ((double) f * ((iAttributeInstance.getAttributeValue() / (double) capabilities.getWalkSpeed() + 1.0D) / 2.0D));

    if (capabilities.getWalkSpeed() == 0.0F || Float.isNaN(f) || Float.isInfinite(f)) {
        f = 1.0F;
    }

    if (isUsingItem() && getItemInUse().getItem() == Items.bow) {
        int duration = getItemInUseDuration();
        float f1 = (float) duration / 20.0F;

        if (f1 > 1.0F) {
            f1 = 1.0F;
        } else {
            f1 = f1 * f1;
        }

        f *= 1.0F - f1 * 0.15F;
    }

    FovUpdateEvent event = new FovUpdateEvent((AbstractClientPlayer) (Object) this, f);
    EventBus.INSTANCE.post(event);
    return event.getNewFov();
}
 
Example #17
Source File: StaticCape.java    From DeveloperCapes with MIT License 5 votes vote down vote up
@Override
public void loadTexture(AbstractClientPlayer player) {
    ResourceLocation location = this.getLocation();
    player.func_152121_a(MinecraftProfileTexture.Type.CAPE, location);

    Minecraft.getMinecraft().renderEngine.loadTexture(location, this.getTexture());
}
 
Example #18
Source File: CapeManager.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns a CapeUser for a player
 *
 * @param player
 * @return
 */
public CapeUser find(AbstractClientPlayer player) {
    for (CapeUser user : this.capeUserList) {
        if (user.getUuid().equals(player.getUniqueID().toString().replace("-", ""))) {
            return user;
        }
    }
    return null;
}
 
Example #19
Source File: CopyPlayerModelAnglesEvent.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public CopyPlayerModelAnglesEvent(@NotNull AbstractClientPlayer entity, @NotNull IMixinModelBiped model) {
    Preconditions.checkNotNull(entity, "entity");
    Preconditions.checkNotNull(model, "model");

    this.entity = entity;
    this.model = model;
}
 
Example #20
Source File: CapeManager.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns a ResourceLocation for a player
 *
 * @param player
 * @return
 */
public ResourceLocation getCape(AbstractClientPlayer player) {
    final CapeUser user = this.find(player);
    if (user != null) {
        final ResourceLocation res = this.findResource(user.getCape());
        if (res != null) {
            return res;
        }
    }
    return null;
}
 
Example #21
Source File: PlayerRendererHookVisitor.java    From OpenModsLib with MIT License 5 votes vote down vote up
public PlayerRendererHookVisitor(String rendererTypeCls, ClassVisitor cv, IResultListener listener) {
	super(Opcodes.ASM5, cv);
	this.listener = listener;

	Type injectedMethodType = Type.getMethodType(Type.VOID_TYPE, MappedType.of(AbstractClientPlayer.class).type(), Type.FLOAT_TYPE, Type.FLOAT_TYPE, Type.FLOAT_TYPE);
	modifiedMethod = new MethodMatcher(rendererTypeCls, injectedMethodType.getDescriptor(), "applyRotations", "func_77043_a");
}
 
Example #22
Source File: TPoseHandler.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void modifyPlayer(AbstractClientPlayer entity, IMixinModelBiped player, float heldPercent) {
    player.getBipedLeftUpperArm().rotateAngleZ = (float) Math.toRadians(-90.0f * heldPercent);
    player.getBipedLeftUpperArm().rotateAngleY = 0;
    player.getBipedLeftUpperArm().rotateAngleX = 0;

    player.getBipedRightUpperArm().rotateAngleZ = (float) Math.toRadians(90.0f * heldPercent);
    player.getBipedRightUpperArm().rotateAngleY = 0;
    player.getBipedRightUpperArm().rotateAngleX = 0;
}
 
Example #23
Source File: FlossDanceHandler.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean shouldNotModify(AbstractClientPlayer entity, IMixinModelBiped player) {
    AnimationState animationState = get(entity.getUniqueID());
    int ticks = animationState.getFrames();

    if (ticks <= 2) {
        if (animationState.shouldReset()) {
            resetAnimation(player);
        }

        return true;
    }

    return false;
}
 
Example #24
Source File: PlayerRendererHookVisitor.java    From OpenModsLib with MIT License 5 votes vote down vote up
public InjectorMethodVisitor(MethodVisitor mv) {
	super(Opcodes.ASM5, mv);

	try {
		postMethod = Method.getMethod(PlayerRendererHookVisitor.class.getMethod("post", AbstractClientPlayer.class, float.class));
	} catch (NoSuchMethodException e) {
		throw new RuntimeException(e);
	}

	Log.debug("Injecting hook %s.%s into EntityPlayerRender.rotateCorpse", PlayerRendererHookVisitor.class, postMethod);
}
 
Example #25
Source File: EssentialsMissingHandlerClient.java    From Cyberware with MIT License 5 votes vote down vote up
private void setLightmap()
{
	AbstractClientPlayer abstractclientplayer = this.mc.thePlayer;
	int i = this.mc.theWorld.getCombinedLight(new BlockPos(abstractclientplayer.posX, abstractclientplayer.posY + (double)abstractclientplayer.getEyeHeight(), abstractclientplayer.posZ), 0);
	float f = (float)(i & 65535);
	float f1 = (float)(i >> 16);
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1);
}
 
Example #26
Source File: StaticCape.java    From DeveloperCapes with MIT License 4 votes vote down vote up
@Override
public boolean isTextureLoaded(AbstractClientPlayer player) {
    ResourceLocation cape = player.getLocationCape();
    return cape != null;
}
 
Example #27
Source File: TileEntityFancySkullRenderer.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@SuppressWarnings("unchecked")
public void renderSkull(float x, float y, float z, int meta, float rotation, int type, GameProfile profile) {
	ModelHead model = model1;

	switch (type) {
		case 0:
		default:
			bindTexture(skeleton_texture);
			break;
		case 1:
			bindTexture(wither_skeleton_texture);
			break;
		case 2:
			bindTexture(zombie_texture);
			model = model2;
			break;
		case 3:
			ResourceLocation texture = AbstractClientPlayer.locationStevePng;
			if (profile != null) {
				Minecraft minecraft = Minecraft.getMinecraft();
				Map<Type, MinecraftProfileTexture> map = minecraft.func_152342_ad().func_152788_a(profile);
				if (map.containsKey(Type.SKIN))
					texture = minecraft.func_152342_ad().func_152792_a(map.get(Type.SKIN), Type.SKIN);
			}
			bindTexture(texture);
			break;
		case 4:
			bindTexture(creeper_texture);
	}

	OpenGLHelper.pushMatrix();
	OpenGLHelper.disableCull();

	if (meta != 1)
		switch (meta) {
			case 2:
				OpenGLHelper.translate(x + 0.5F, y + 0.25F, z + 0.74F);
				break;
			case 3:
				OpenGLHelper.translate(x + 0.5F, y + 0.25F, z + 0.26F);
				rotation = 180.0F;
				break;
			case 4:
				OpenGLHelper.translate(x + 0.74F, y + 0.25F, z + 0.5F);
				rotation = 270.0F;
				break;
			case 5:
			default:
				OpenGLHelper.translate(x + 0.26F, y + 0.25F, z + 0.5F);
				rotation = 90.0F;
		}
	else
		GL11.glTranslatef(x + 0.5F, y, z + 0.5F);

	OpenGLHelper.enableRescaleNormal();
	OpenGLHelper.scale(-1.0F, -1.0F, 1.0F);
	OpenGLHelper.enableAlpha();
	model.render(rotation);
	OpenGLHelper.popMatrix();
}
 
Example #28
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;
		}
	}
}
 
Example #29
Source File: MixinLayerCape.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject(method = "doRenderLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPlayer;renderCape(F)V", ordinal = 0))
private void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks,
                           float ageInTicks, float netHeadYaw, float headPitch, float scale, CallbackInfo ci) {
    hyperiumLayerCape.doRenderLayer(entitylivingbaseIn);
}
 
Example #30
Source File: RenderCyberlimbHand.java    From Cyberware with MIT License 4 votes vote down vote up
public void renderItemInFirstPerson(AbstractClientPlayer p_187457_1_, float p_187457_2_, float p_187457_3_, EnumHand p_187457_4_, float p_187457_5_, @Nullable ItemStack p_187457_6_, float p_187457_7_)
{
	boolean flag = p_187457_4_ == EnumHand.MAIN_HAND;
	EnumHandSide enumhandside = flag ? p_187457_1_.getPrimaryHand() : p_187457_1_.getPrimaryHand().opposite();
	GlStateManager.pushMatrix();

	if (p_187457_6_ == null)
	{
		if (flag && !p_187457_1_.isInvisible())
		{
			
			this.renderArmFirstPerson(p_187457_7_, p_187457_5_, enumhandside);
		}
	}
	else if (p_187457_6_.getItem() instanceof net.minecraft.item.ItemMap)
	{
		if (flag && itemStackOffHand == null)
		{
			this.renderMapFirstPerson(p_187457_3_, p_187457_7_, p_187457_5_);
		}
		else
		{
			this.renderMapFirstPersonSide(p_187457_7_, enumhandside, p_187457_5_, p_187457_6_);
		}
	}
	else
	{
		boolean flag1 = enumhandside == EnumHandSide.RIGHT;

		if (p_187457_1_.isHandActive() && p_187457_1_.getItemInUseCount() > 0 && p_187457_1_.getActiveHand() == p_187457_4_)
		{
			int j = flag1 ? 1 : -1;

			switch (p_187457_6_.getItemUseAction())
			{
				case NONE:
					this.transformSideFirstPerson(enumhandside, p_187457_7_);
					break;
				case EAT:
				case DRINK:
					this.transformEatFirstPerson(p_187457_2_, enumhandside, p_187457_6_);
					this.transformSideFirstPerson(enumhandside, p_187457_7_);
					break;
				case BLOCK:
					this.transformSideFirstPerson(enumhandside, p_187457_7_);
					break;
				case BOW:
					this.transformSideFirstPerson(enumhandside, p_187457_7_);
					GlStateManager.translate((float)j * -0.2785682F, 0.18344387F, 0.15731531F);
					GlStateManager.rotate(-13.935F, 1.0F, 0.0F, 0.0F);
					GlStateManager.rotate((float)j * 35.3F, 0.0F, 1.0F, 0.0F);
					GlStateManager.rotate((float)j * -9.785F, 0.0F, 0.0F, 1.0F);
					float f5 = (float)p_187457_6_.getMaxItemUseDuration() - ((float)this.mc.thePlayer.getItemInUseCount() - p_187457_2_ + 1.0F);
					float f6 = f5 / 20.0F;
					f6 = (f6 * f6 + f6 * 2.0F) / 3.0F;

					if (f6 > 1.0F)
					{
						f6 = 1.0F;
					}

					if (f6 > 0.1F)
					{
						float f7 = MathHelper.sin((f5 - 0.1F) * 1.3F);
						float f3 = f6 - 0.1F;
						float f4 = f7 * f3;
						GlStateManager.translate(f4 * 0.0F, f4 * 0.004F, f4 * 0.0F);
					}

					GlStateManager.translate(f6 * 0.0F, f6 * 0.0F, f6 * 0.04F);
					GlStateManager.scale(1.0F, 1.0F, 1.0F + f6 * 0.2F);
					GlStateManager.rotate((float)j * 45.0F, 0.0F, -1.0F, 0.0F);
			}
		}
		else
		{
			float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(p_187457_5_) * (float)Math.PI);
			float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(p_187457_5_) * ((float)Math.PI * 2F));
			float f2 = -0.2F * MathHelper.sin(p_187457_5_ * (float)Math.PI);
			int i = flag1 ? 1 : -1;
			GlStateManager.translate((float)i * f, f1, f2);
			this.transformSideFirstPerson(enumhandside, p_187457_7_);
			this.transformFirstPerson(enumhandside, p_187457_5_);
		}

		this.renderItemSide(p_187457_1_, p_187457_6_, flag1 ? ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND : ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, !flag1);
	}

	GlStateManager.popMatrix();
}