mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 10:06:00 +00:00
Move purely display data into ScriptItemCustom.Display
This commit is contained in:
1 parent
adef51cd53
commit
9188499e7e
4 files changed
+115
-107
No files matched your search
@@ -46,7 +46,7 @@ public class CustomItemRenderer implements IItemRenderer {
|
||||
public void renderItem(ItemRenderType type, ItemStack itemStack, Object... data) {
|
||||
ScriptCustomItem scriptCustomItem = ItemScripted.GetWrapper(itemStack);
|
||||
|
||||
ImageData imageData = ClientCacheHandler.getImageData(scriptCustomItem.texture);
|
||||
ImageData imageData = ClientCacheHandler.getImageData(scriptCustomItem.itemDisplay.texture);
|
||||
if (!imageData.imageLoaded()) {
|
||||
return;
|
||||
}
|
||||
@@ -64,34 +64,34 @@ public class CustomItemRenderer implements IItemRenderer {
|
||||
if (!entityItem.ignoreFrustumCheck) {
|
||||
entityItem.ignoreFrustumCheck = true;
|
||||
|
||||
float entityXZSize = (float) Math.sqrt(Math.pow(scriptCustomItem.scaleX,2) + Math.pow(scriptCustomItem.scaleZ,2));
|
||||
this.setEntitySize(entityItem, entityXZSize * 0.25F, scriptCustomItem.scaleY * 0.25F);
|
||||
float entityXZSize = (float) Math.sqrt(Math.pow(scriptCustomItem.itemDisplay.scaleX,2) + Math.pow(scriptCustomItem.itemDisplay.scaleZ,2));
|
||||
this.setEntitySize(entityItem, entityXZSize * 0.25F, scriptCustomItem.itemDisplay.scaleY * 0.25F);
|
||||
|
||||
double XSize = entityItem.boundingBox.maxX - entityItem.boundingBox.minX;
|
||||
double YSize = entityItem.boundingBox.maxY - entityItem.boundingBox.minY;
|
||||
double ZSize = entityItem.boundingBox.maxZ - entityItem.boundingBox.minZ;
|
||||
entityItem.boundingBox.maxX = entityItem.boundingBox.minX + XSize * scriptCustomItem.scaleX;
|
||||
entityItem.boundingBox.maxY = entityItem.boundingBox.minY + YSize * scriptCustomItem.scaleY;
|
||||
entityItem.boundingBox.maxZ = entityItem.boundingBox.minZ + ZSize * scriptCustomItem.scaleZ;
|
||||
entityItem.boundingBox.maxX = entityItem.boundingBox.minX + XSize * scriptCustomItem.itemDisplay.scaleX;
|
||||
entityItem.boundingBox.maxY = entityItem.boundingBox.minY + YSize * scriptCustomItem.itemDisplay.scaleY;
|
||||
entityItem.boundingBox.maxZ = entityItem.boundingBox.minZ + ZSize * scriptCustomItem.itemDisplay.scaleZ;
|
||||
}
|
||||
|
||||
float entityRenderTicks = Minecraft.getMinecraft().timer.renderPartialTicks;
|
||||
float bobbing = MathHelper.sin(((float)entityItem.age + entityRenderTicks) / 10.0F + entityItem.hoverStart) * 0.1F + 0.1F;
|
||||
|
||||
if(!scriptCustomItem.isNormalItem){
|
||||
GL11.glRotatef(scriptCustomItem.rotationX, 1, 0, 0);
|
||||
GL11.glRotatef(scriptCustomItem.rotationY, 0, 1, 0);
|
||||
GL11.glRotatef(scriptCustomItem.rotationZ, 0, 0, 1);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationX, 1, 0, 0);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationY, 0, 1, 0);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationZ, 0, 0, 1);
|
||||
}
|
||||
|
||||
GL11.glRotatef(scriptCustomItem.rotationXRate * entityRenderTicks %360, 1, 0, 0);
|
||||
GL11.glRotatef(scriptCustomItem.rotationYRate * entityRenderTicks %360, 0, 1, 0);
|
||||
GL11.glRotatef(scriptCustomItem.rotationZRate * entityRenderTicks %360, 0, 0, 1);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationXRate * entityRenderTicks %360, 1, 0, 0);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationYRate * entityRenderTicks %360, 0, 1, 0);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationZRate * entityRenderTicks %360, 0, 0, 1);
|
||||
|
||||
if (!renderInFrame) {
|
||||
if(!scriptCustomItem.isNormalItem){
|
||||
GL11.glScalef(scriptCustomItem.scaleX, scriptCustomItem.scaleY, scriptCustomItem.scaleZ);
|
||||
GL11.glTranslatef(0.0F, (Math.max(scriptCustomItem.scaleY, 1) - 1) * (1.0F / 4), 0.0F);
|
||||
GL11.glScalef(scriptCustomItem.itemDisplay.scaleX, scriptCustomItem.itemDisplay.scaleY, scriptCustomItem.itemDisplay.scaleZ);
|
||||
GL11.glTranslatef(0.0F, (Math.max(scriptCustomItem.itemDisplay.scaleY, 1) - 1) * (1.0F / 4), 0.0F);
|
||||
}
|
||||
GL11.glTranslatef(0.0F, -bobbing, 0.0F);
|
||||
}
|
||||
@@ -144,23 +144,23 @@ public class CustomItemRenderer implements IItemRenderer {
|
||||
GL11.glRotatef(-80, 0, 1, 0);
|
||||
GL11.glRotatef(80, 0, 0, 1);
|
||||
|
||||
GL11.glRotatef(scriptCustomItem.rotationXRate * item3dRenderTicks %360, 1, 0, 0);
|
||||
GL11.glRotatef(scriptCustomItem.rotationYRate * item3dRenderTicks %360, 0, 1, 0);
|
||||
GL11.glRotatef(scriptCustomItem.rotationZRate * item3dRenderTicks %360, 0, 0, 1);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationXRate * item3dRenderTicks %360, 1, 0, 0);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationYRate * item3dRenderTicks %360, 0, 1, 0);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationZRate * item3dRenderTicks %360, 0, 0, 1);
|
||||
|
||||
GL11.glScalef(0.6F, 0.6F,0.6F);
|
||||
}
|
||||
else {
|
||||
GL11.glTranslatef(scriptCustomItem.translateX, scriptCustomItem.translateY, scriptCustomItem.translateZ);
|
||||
GL11.glRotatef(scriptCustomItem.rotationX, 1, 0, 0);
|
||||
GL11.glRotatef(scriptCustomItem.rotationY, 0, 1, 0);
|
||||
GL11.glRotatef(scriptCustomItem.rotationZ, 0, 0, 1);
|
||||
GL11.glTranslatef(scriptCustomItem.itemDisplay.translateX, scriptCustomItem.itemDisplay.translateY, scriptCustomItem.itemDisplay.translateZ);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationX, 1, 0, 0);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationY, 0, 1, 0);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationZ, 0, 0, 1);
|
||||
|
||||
GL11.glRotatef(scriptCustomItem.rotationXRate * item3dRenderTicks %360, 1, 0, 0);
|
||||
GL11.glRotatef(scriptCustomItem.rotationYRate * item3dRenderTicks %360, 0, 1, 0);
|
||||
GL11.glRotatef(scriptCustomItem.rotationZRate * item3dRenderTicks %360, 0, 0, 1);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationXRate * item3dRenderTicks %360, 1, 0, 0);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationYRate * item3dRenderTicks %360, 0, 1, 0);
|
||||
GL11.glRotatef(scriptCustomItem.itemDisplay.rotationZRate * item3dRenderTicks %360, 0, 0, 1);
|
||||
|
||||
GL11.glScalef(scriptCustomItem.scaleX, scriptCustomItem.scaleY, scriptCustomItem.scaleZ);
|
||||
GL11.glScalef(scriptCustomItem.itemDisplay.scaleX, scriptCustomItem.itemDisplay.scaleY, scriptCustomItem.itemDisplay.scaleZ);
|
||||
}
|
||||
|
||||
int color = scriptCustomItem.getColor();
|
||||
@@ -230,7 +230,7 @@ public class CustomItemRenderer implements IItemRenderer {
|
||||
int pass = 0;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
ClientCacheHandler.getImageData(scriptCustomItem.texture).bindTexture();
|
||||
ClientCacheHandler.getImageData(scriptCustomItem.itemDisplay.texture).bindTexture();
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
@@ -277,7 +277,7 @@ public class CustomItemRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
if(!scriptCustomItem.isNormalItem)
|
||||
GL11.glScalef(scriptCustomItem.scaleX, scriptCustomItem.scaleY, scriptCustomItem.scaleZ);
|
||||
GL11.glScalef(scriptCustomItem.itemDisplay.scaleX, scriptCustomItem.itemDisplay.scaleY, scriptCustomItem.itemDisplay.scaleZ);
|
||||
GL11.glTranslatef(-f7, -f8, -((f9 + f10) * (float)b0 / 2.0F));
|
||||
|
||||
for (int k = 0; k < b0; ++k)
|
||||
@@ -289,7 +289,7 @@ public class CustomItemRenderer implements IItemRenderer {
|
||||
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
}*/
|
||||
|
||||
ImageData imageData = ClientCacheHandler.getImageData(scriptCustomItem.texture);
|
||||
ImageData imageData = ClientCacheHandler.getImageData(scriptCustomItem.itemDisplay.texture);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f15, f4, f14, f5, imageData.getTotalWidth(), imageData.getTotalHeight(), f9);
|
||||
|
||||
if (itemStack.hasEffect(pass))
|
||||
@@ -389,7 +389,7 @@ public class CustomItemRenderer implements IItemRenderer {
|
||||
GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure that render states are reset, a renderEffect can derp them up.
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
ClientCacheHandler.getImageData(scriptCustomItem.texture).bindTexture();
|
||||
ClientCacheHandler.getImageData(scriptCustomItem.itemDisplay.texture).bindTexture();
|
||||
renderCustomItemSlot(0,0,16,16, itemRed, itemGreen, itemBlue);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
@@ -464,7 +464,7 @@ public class CustomItemRenderer implements IItemRenderer {
|
||||
TextureManager texturemanager = mc.getTextureManager();
|
||||
int par3 = 0;
|
||||
|
||||
ClientCacheHandler.getImageData(scriptCustomItem.texture).bindTexture();
|
||||
ClientCacheHandler.getImageData(scriptCustomItem.itemDisplay.texture).bindTexture();
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
IIcon icon = entityLivingBase.getItemIcon(itemStack, par3);
|
||||
@@ -519,7 +519,7 @@ public class CustomItemRenderer implements IItemRenderer {
|
||||
|
||||
public static void renderCustomItemIn2D(ItemStack itemStack, Tessellator p_78439_0_, float p_78439_1_, float p_78439_2_, float p_78439_3_, float p_78439_4_, float p_78439_7_)
|
||||
{
|
||||
ImageData imageData = ClientCacheHandler.getImageData(ItemScripted.GetWrapper(itemStack).texture);
|
||||
ImageData imageData = ClientCacheHandler.getImageData(ItemScripted.GetWrapper(itemStack).itemDisplay.texture);
|
||||
int width = imageData.getTotalWidth();
|
||||
int height = imageData.getTotalHeight();
|
||||
|
||||
|
||||
Reference in new issue
Block a user