use of de.sanandrew.mods.claysoldiers.api.soldier.ISoldier in project ClaySoldiersMod by SanAndreasP.
the class LayerCape method doRenderLayer.
@Override
public void doRenderLayer(EntityCreature creature, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (creature instanceof ISoldier) {
ISoldier soldier = (ISoldier) creature;
boolean hasDiamond = soldier.hasUpgrade(Upgrades.MC_DIAMOND, EnumUpgradeType.MISC) || soldier.hasUpgrade(Upgrades.MC_DIAMONDBLOCK, EnumUpgradeType.MISC);
if (hasDiamond || soldier.hasUpgrade(Upgrades.MC_PAPER, EnumUpgradeType.MISC)) {
if (hasDiamond) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.renderer.bindSoldierTexture(Resources.ENTITY_WEARABLE_CAPE_DIAMOND.resource);
} else {
ISoldierUpgradeInst clrUpg = soldier.getUpgradeInstance(Upgrades.MC_CONCRETEPOWDER, EnumUpgradeType.MISC);
if (clrUpg != null) {
float[] clr = EnumDyeColor.byMetadata(clrUpg.getNbtData().getInteger("color")).getColorComponentValues();
GlStateManager.color(clr[0], clr[1], clr[2], 1.0F);
} else {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
this.renderer.bindSoldierTexture(Resources.ENTITY_WEARABLE_CAPE_PAPER.resource);
}
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 0.0F, 0.125F);
double dX = soldier.getChasingPosX(partialTicks) - (creature.prevPosX + (creature.posX - creature.prevPosX) * partialTicks);
double dY = soldier.getChasingPosY(partialTicks) - (creature.prevPosY + (creature.posY - creature.prevPosY) * partialTicks);
double dZ = soldier.getChasingPosZ(partialTicks) - (creature.prevPosZ + (creature.posZ - creature.prevPosZ) * partialTicks);
float yaw = creature.prevRenderYawOffset + (creature.renderYawOffset - creature.prevRenderYawOffset) * partialTicks;
double sinYaw = MathHelper.sin(yaw * 0.017453292F);
double cosYaw = (-MathHelper.cos(yaw * 0.017453292F));
float rotY = (float) dY * 10.0F;
rotY = MathHelper.clamp(rotY, -6.0F, 32.0F);
float rotX = (float) (dX * sinYaw + dZ * cosYaw) * 100.0F;
float rotZ = (float) (dX * cosYaw - dZ * sinYaw) * 100.0F;
if (rotX < 0.0F) {
rotX = 0.0F;
}
float f4 = creature.prevRotationYaw + (creature.rotationYaw - creature.prevRotationYaw) * partialTicks;
rotY = rotY + MathHelper.sin((creature.prevDistanceWalkedModified + (creature.distanceWalkedModified - creature.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4;
if (creature.isSneaking()) {
rotY += 25.0F;
}
GlStateManager.rotate(6.0F + rotX / 2.0F + rotY, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(rotZ / 2.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(-rotZ / 2.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
ModelCape.INSTANCE.renderCape();
GlStateManager.popMatrix();
}
}
}
use of de.sanandrew.mods.claysoldiers.api.soldier.ISoldier in project ClaySoldiersMod by SanAndreasP.
the class LayerGoggles method doRenderLayer.
@Override
public void doRenderLayer(EntityCreature creature, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (!(creature instanceof ISoldier)) {
return;
}
ISoldier soldier = (ISoldier) creature;
ISoldierUpgradeInst inst = soldier.getUpgradeInstance(Upgrades.MC_GLASS, EnumUpgradeType.MISC);
if (inst != null) {
GlStateManager.pushMatrix();
this.renderer.getSoldierModel().bipedHead.postRender(scale);
if (this.model.texture != null) {
this.renderer.bindSoldierTexture(this.model.texture);
this.model.render(scale);
}
ItemStack renderedStack = GLASS_NORMAL;
if (inst.getNbtData().hasKey("color")) {
EnumDyeColor clr = EnumDyeColor.byMetadata(inst.getNbtData().getByte("color"));
renderedStack = GLASS_STAINED.computeIfAbsent(clr, newClr -> new ItemStack(Blocks.STAINED_GLASS, 1, newClr.getMetadata()));
}
RenderUtils.renderStackInWorld(renderedStack, 0.15D, -0.3D, -0.1825D, 0.0F, 0.0F, 0.0F, 0.375F);
RenderUtils.renderStackInWorld(renderedStack, -0.15D, -0.3D, -0.1825D, 0.0F, 0.0F, 0.0F, 0.375F);
GlStateManager.enableRescaleNormal();
GlStateManager.popMatrix();
}
}
use of de.sanandrew.mods.claysoldiers.api.soldier.ISoldier in project ClaySoldiersMod by SanAndreasP.
the class LayerLeatherArmor method doRenderLayer.
@Override
public void doRenderLayer(EntityCreature creature, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (!(creature instanceof ISoldier)) {
return;
}
ISoldier soldier = (ISoldier) creature;
if (soldier.hasUpgrade(Upgrades.MC_LEATHER, EnumUpgradeType.MISC)) {
this.renderModel(this.modelLeatherArmor, scale);
} else if (soldier.hasUpgrade(Upgrades.MC_RABBITHIDE, EnumUpgradeType.MISC)) {
this.renderModel(this.modelRabbitHide, scale);
}
ISoldierUpgradeInst woolInst = soldier.getUpgradeInstance(Upgrades.EM_WOOL, EnumUpgradeType.ENHANCEMENT);
if (woolInst != null) {
ColorObj cObj = new ColorObj(EnumDyeColor.byMetadata(woolInst.getNbtData().getInteger("color")).getColorValue());
GlStateManager.color(cObj.fRed(), cObj.fGreen(), cObj.fBlue());
this.renderModel(this.modelPadding, scale);
GlStateManager.color(1.0F, 1.0F, 1.0F);
}
}
use of de.sanandrew.mods.claysoldiers.api.soldier.ISoldier in project ClaySoldiersMod by SanAndreasP.
the class LayerGoldHoodie method doRenderLayer.
@Override
public void doRenderLayer(EntityCreature creature, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (!(creature instanceof ISoldier)) {
return;
}
ISoldier soldier = (ISoldier) creature;
if (soldier.hasUpgrade(Upgrades.EM_GOLDINGOT, EnumUpgradeType.ENHANCEMENT)) {
this.renderer.bindSoldierTexture(Resources.ENTITY_WEARABLE_GOLD_HOODIE.resource);
this.modelGunpwd.setModelAttributes(this.renderer.getSoldierModel());
this.modelGunpwd.render(creature, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
}
}
use of de.sanandrew.mods.claysoldiers.api.soldier.ISoldier in project ClaySoldiersMod by SanAndreasP.
the class LayerLilyPants method doRenderLayer.
@Override
public void doRenderLayer(EntityCreature creature, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (!(creature instanceof ISoldier)) {
return;
}
ISoldier soldier = (ISoldier) creature;
if (soldier.hasUpgrade(Upgrades.MC_LILYPAD, EnumUpgradeType.MISC)) {
if (this.modelLilyPants.texture != null) {
this.renderer.bindSoldierTexture(this.modelLilyPants.texture);
}
GlStateManager.pushMatrix();
this.renderer.getSoldierModel().bipedBody.postRender(scale);
this.modelLilyPants.renderBody(scale);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
this.renderer.getSoldierModel().bipedLeftLeg.postRender(scale);
this.modelLilyPants.renderLeftLeg(scale);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
this.renderer.getSoldierModel().bipedRightLeg.postRender(scale);
this.modelLilyPants.renderRightLeg(scale);
GlStateManager.popMatrix();
}
}
Aggregations