mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 12:46:12 +03:00
108 lines
5.4 KiB
Diff
108 lines
5.4 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java
|
|
@@ -58,31 +58,29 @@
|
|
if (itemarmor.getEquipmentSlot() == slotIn)
|
|
{
|
|
T t = this.getModelFromSlot(slotIn);
|
|
+ t = getArmorModelHook(entityLivingBaseIn, itemstack, slotIn, t);
|
|
t.setModelAttributes(this.renderer.getMainModel());
|
|
t.setLivingAnimations(entityLivingBaseIn, limbSwing, limbSwingAmount, partialTicks);
|
|
this.setModelSlotVisible(t, slotIn);
|
|
boolean flag = this.isLegSlot(slotIn);
|
|
- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag));
|
|
+ this.renderer.bindTexture(this.getArmorResource(entityLivingBaseIn, itemstack, slotIn, null));
|
|
|
|
- switch (itemarmor.getArmorMaterial())
|
|
{
|
|
- case LEATHER:
|
|
+ if (itemarmor.hasOverlay(itemstack)) // Allow this for anything, not only cloth
|
|
+ {
|
|
int i = itemarmor.getColor(itemstack);
|
|
float f = (float)(i >> 16 & 255) / 255.0F;
|
|
float f1 = (float)(i >> 8 & 255) / 255.0F;
|
|
float f2 = (float)(i & 255) / 255.0F;
|
|
GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha);
|
|
t.render(entityLivingBaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
|
- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay"));
|
|
- case CHAIN:
|
|
- case IRON:
|
|
- case GOLD:
|
|
- case DIAMOND:
|
|
+ this.renderer.bindTexture(this.getArmorResource(entityLivingBaseIn, itemstack, slotIn, "overlay"));
|
|
+ }
|
|
+ { // Non-colored
|
|
GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha);
|
|
t.render(entityLivingBaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
|
- default:
|
|
-
|
|
- if (!this.skipRenderGlint && itemstack.isItemEnchanted())
|
|
+ } // Default
|
|
+ if (!this.skipRenderGlint && itemstack.hasEffect())
|
|
{
|
|
renderEnchantedGlint(this.renderer, entityLivingBaseIn, t, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
|
|
}
|
|
@@ -139,11 +137,13 @@
|
|
Minecraft.getMinecraft().entityRenderer.setupFogColor(false);
|
|
}
|
|
|
|
+ @Deprecated //Use the more sensitive version getArmorResource below
|
|
private ResourceLocation getArmorResource(ItemArmor armor, boolean p_177181_2_)
|
|
{
|
|
return this.getArmorResource(armor, p_177181_2_, (String)null);
|
|
}
|
|
|
|
+ @Deprecated //Use the more sensitive version getArmorResource below
|
|
private ResourceLocation getArmorResource(ItemArmor armor, boolean p_177178_2_, String p_177178_3_)
|
|
{
|
|
String s = String.format("textures/models/armor/%s_layer_%d%s.png", armor.getArmorMaterial().getName(), p_177178_2_ ? 2 : 1, p_177178_3_ == null ? "" : String.format("_%s", p_177178_3_));
|
|
@@ -161,4 +161,49 @@
|
|
protected abstract void initArmor();
|
|
|
|
protected abstract void setModelSlotVisible(T p_188359_1_, EntityEquipmentSlot slotIn);
|
|
+
|
|
+ /*=================================== FORGE START =========================================*/
|
|
+
|
|
+ /**
|
|
+ * Hook to allow item-sensitive armor model. for LayerBipedArmor.
|
|
+ */
|
|
+ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot, T model)
|
|
+ {
|
|
+ return model;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide.
|
|
+ *
|
|
+ * @param entity Entity wearing the armor
|
|
+ * @param stack ItemStack for the armor
|
|
+ * @param slot Slot ID that the item is in
|
|
+ * @param type Subtype, can be null or "overlay"
|
|
+ * @return ResourceLocation pointing at the armor's texture
|
|
+ */
|
|
+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, EntityEquipmentSlot slot, String type)
|
|
+ {
|
|
+ ItemArmor item = (ItemArmor)stack.getItem();
|
|
+ String texture = item.getArmorMaterial().getName();
|
|
+ String domain = "minecraft";
|
|
+ int idx = texture.indexOf(':');
|
|
+ if (idx != -1)
|
|
+ {
|
|
+ domain = texture.substring(0, idx);
|
|
+ texture = texture.substring(idx + 1);
|
|
+ }
|
|
+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (isLegSlot(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type));
|
|
+
|
|
+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type);
|
|
+ ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s1);
|
|
+
|
|
+ if (resourcelocation == null)
|
|
+ {
|
|
+ resourcelocation = new ResourceLocation(s1);
|
|
+ ARMOR_TEXTURE_RES_MAP.put(s1, resourcelocation);
|
|
+ }
|
|
+
|
|
+ return resourcelocation;
|
|
+ }
|
|
+ /*=================================== FORGE END ===========================================*/
|
|
}
|