mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 06:18:00 +01:00
Fix block heads for humans and add support for rendering items on the head.
This commit is contained in:
parent
d68b335a62
commit
e016f420a7
4 changed files with 13 additions and 15 deletions
|
@ -54,7 +54,7 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
|
||||||
this.addLayer(new LayerHeldPonyItem(this));
|
this.addLayer(new LayerHeldPonyItem(this));
|
||||||
this.addLayer(new LayerArrow(this));
|
this.addLayer(new LayerArrow(this));
|
||||||
this.addLayer(new LayerPonyCape(this));
|
this.addLayer(new LayerPonyCape(this));
|
||||||
this.addLayer(new LayerPonySkull(this));
|
this.addLayer(new LayerPonyCustomHead(this));
|
||||||
this.addLayer(new LayerPonyElytra((RenderPlayer) (Object) this));
|
this.addLayer(new LayerPonyElytra((RenderPlayer) (Object) this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.minelittlepony.model.PlayerModel;
|
||||||
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonyArmor;
|
import com.minelittlepony.renderer.layer.LayerPonyArmor;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonyElytra;
|
import com.minelittlepony.renderer.layer.LayerPonyElytra;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonySkull;
|
import com.minelittlepony.renderer.layer.LayerPonyCustomHead;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
@ -27,7 +27,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
||||||
this.addLayer(new LayerPonyArmor(this));
|
this.addLayer(new LayerPonyArmor(this));
|
||||||
this.addLayer(new LayerHeldPonyItem(this));
|
this.addLayer(new LayerHeldPonyItem(this));
|
||||||
// this.addLayer(new LayerArrow(this));
|
// this.addLayer(new LayerArrow(this));
|
||||||
this.addLayer(new LayerPonySkull(this));
|
this.addLayer(new LayerPonyCustomHead(this));
|
||||||
this.addLayer(new LayerPonyElytra(this));
|
this.addLayer(new LayerPonyElytra(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.entity.passive.EntityVillager;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemArmor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTUtil;
|
import net.minecraft.nbt.NBTUtil;
|
||||||
|
@ -26,11 +26,11 @@ import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
|
|
||||||
public class LayerPonySkull implements LayerRenderer<EntityLivingBase> {
|
public class LayerPonyCustomHead implements LayerRenderer<EntityLivingBase> {
|
||||||
|
|
||||||
private RenderLivingBase<? extends EntityLivingBase> renderer;
|
private RenderLivingBase<? extends EntityLivingBase> renderer;
|
||||||
|
|
||||||
public LayerPonySkull(RenderLivingBase<? extends EntityLivingBase> renderPony) {
|
public LayerPonyCustomHead(RenderLivingBase<? extends EntityLivingBase> renderPony) {
|
||||||
this.renderer = renderPony;
|
this.renderer = renderPony;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class LayerPonySkull implements LayerRenderer<EntityLivingBase> {
|
||||||
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float p_177141_3_,
|
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float p_177141_3_,
|
||||||
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
||||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||||
if (itemstack != null && itemstack.getItem() != null) {
|
if (!itemstack.isEmpty()) {
|
||||||
AbstractPonyModel model = getModel().getModel();
|
AbstractPonyModel model = getModel().getModel();
|
||||||
Item item = itemstack.getItem();
|
Item item = itemstack.getItem();
|
||||||
|
|
||||||
|
@ -49,15 +49,14 @@ public class LayerPonySkull implements LayerRenderer<EntityLivingBase> {
|
||||||
model.bipedHead.postRender(0.0625f);
|
model.bipedHead.postRender(0.0625f);
|
||||||
if (model instanceof ModelPlayerPony) {
|
if (model instanceof ModelPlayerPony) {
|
||||||
translate(0, .2, 0);
|
translate(0, .2, 0);
|
||||||
|
} else {
|
||||||
|
translate(0, 0, .15);
|
||||||
}
|
}
|
||||||
color(1, 1, 1, 1);
|
color(1, 1, 1, 1);
|
||||||
if (item instanceof ItemBlock) {
|
if (item == Items.SKULL) {
|
||||||
renderBlock(entity, itemstack);
|
|
||||||
} else if (item == Items.SKULL) {
|
|
||||||
if (model instanceof ModelPlayerPony) {
|
|
||||||
translate(0, 0, -.15);
|
|
||||||
}
|
|
||||||
renderSkull(itemstack, isVillager, limbSwing);
|
renderSkull(itemstack, isVillager, limbSwing);
|
||||||
|
} else if (!(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD) {
|
||||||
|
renderBlock(entity, itemstack);
|
||||||
}
|
}
|
||||||
popMatrix();
|
popMatrix();
|
||||||
}
|
}
|
||||||
|
@ -65,7 +64,6 @@ public class LayerPonySkull implements LayerRenderer<EntityLivingBase> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderBlock(EntityLivingBase entity, ItemStack itemstack) {
|
private void renderBlock(EntityLivingBase entity, ItemStack itemstack) {
|
||||||
// translate(0, -0.25, 0);
|
|
||||||
rotate(180, 0, 1, 0);
|
rotate(180, 0, 1, 0);
|
||||||
scale(0.625, -0.625, -0.625);
|
scale(0.625, -0.625, -0.625);
|
||||||
translate(0, 0.4, -0.21);
|
translate(0, 0.4, -0.21);
|
||||||
|
@ -74,6 +72,7 @@ public class LayerPonySkull implements LayerRenderer<EntityLivingBase> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderSkull(ItemStack itemstack, boolean isVillager, float limbSwing) {
|
private void renderSkull(ItemStack itemstack, boolean isVillager, float limbSwing) {
|
||||||
|
translate(0, 0, -.14);
|
||||||
float f = 1.1875f;
|
float f = 1.1875f;
|
||||||
scale(f, -f, -f);
|
scale(f, -f, -f);
|
||||||
if (isVillager) {
|
if (isVillager) {
|
|
@ -24,7 +24,6 @@ public class PonyFields<P, T> extends PrivateFields<P, T> {
|
||||||
|
|
||||||
protected PonyObf(String seargeName, String obfName, String mcpName) {
|
protected PonyObf(String seargeName, String obfName, String mcpName) {
|
||||||
super(seargeName, obfName, mcpName);
|
super(seargeName, obfName, mcpName);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue