
PhantomTiger
Members-
Posts
27 -
Joined
-
Last visited
Everything posted by PhantomTiger
-
[Solved] [1.7.10] Client-Side entity function not being called
PhantomTiger replied to PhantomTiger's topic in Modder Support
So after messing around with the code this morning I finally solved the issue, firstly I @Override the readSpawnData and writeSpawnData functions in my entity class which didn't directly solve the issue however did appear to smooth-en the rendering process. However while combing through the forums again I found a post by diesieben07 and changed my registering function to EntityRegistry.registerModEntity(PapPapEntity.class, "PapPapEntity", 113, MainRegistry.modInstance, 128, Integer.MAX_VALUE, false); and wall-la it works wonderfully, thank you very much diesieben07. And thank you kindly jeffryfisher, jabelar, Izzy Axel, and Abastro for helping me progress to this point in my older posts on older issues with my custom painting. After a year (I started this mod on April 29, 2015) I can finally clean it up and get this puppy out there, but thank you all for the help, I definitely have a much more hefty knowledge of entity coding now. -
[Solved] [1.7.10] Client-Side entity function not being called
PhantomTiger replied to PhantomTiger's topic in Modder Support
So I kind of have no clue what I did but the paintings SPAWN now and WITH my texture (kind of how programming works isn't it?), there's just one slight issue left, which I know gottsch has made a post for a while ago however was never solved, but maybe someone can help me figure this out. Whenever I spawn the painting they stay for about 5 seconds before it shift 1/2 block upwards, to just test if this still occurs when the mod is built and in a non-test environment they acted slightly different but still wrong. Small paintings (1x1 and 2x1) still move up a half block (and sometimes jump a full block up but back down to a half block immediately afterward), however larger paintings (i.e. 2x2) just jump up one block and stay stable there. I am not too sure how to debug why this jump occurs. All help is appreciated and kind thanks to all those who helped me get this far! Coding I hope this also helps anyone else out there struggling to get a custom painting to work in 1.7.10 -
[Solved] [1.7.10] Client-Side entity function not being called
PhantomTiger replied to PhantomTiger's topic in Modder Support
Thanks for the reply! But I have spent days combing all the painting rendering related posts and tried at least a hundred things over the past year to still be unable to get it to render. I always try to figure things out myself and hate asking for help but this one problem is too much for me alone. But I do hope whoever knows the solution can help me EDIT: I definitely have spent a lot of time observing that post you suggested, it helped me fix a lot of other problems, but for client side functions I believe changed a bit from 1.7.10 to 1.8, but I will keep looking at what he did -
Hello everyone, I have been working on a mod for a year now and am almost complete, however something about entity coding trips me up, I have my final entity, a hanging entity, almost working, however the client side function needed for the rendering of my entity is not being called and I am not sure how to call it, I have tried just simply naming the function in my class which references the vanilla class and even completely putting the client side function in my class all to no avail. Help to solve what I'm doing wrong is greatly appreciated! Here is my entity class: This is the function in EntityPainting which I am trying to call Thanks!
-
I see what you mean! It took me a few days but when I realized that I can do a compare contrast by spawning a vanilla painting and see what it does in entitypainting then spawn my own and see what the difference is, the vanilla painting uses the entitypainting client-side constructor: however my painting does not, there's the reason art is null, so now I am scanning what is causing vanilla painting to call into that and not mine, I'll keep you all updated if I find anything.
-
I knew about breakpoints, but I didn't know you can use them to see what variables are each step! That's really useful, thank you for telling me about that. So I did that and found out that in "this.funca(ent, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY);" That ent is just the globaluniqueID, while the sizeX, sizeY, offsetX, and offsetY are given randomly one of the fittable enum painting coordinates. However enumart is null, so I looked back to "PapPapEntity.EnumArt enumart = ent.art;" ent is still just the ID, however art seems to be null, then I looked in the vanilla EntityPainting class because that is where it designates these values and observed that at first few steps, art = the ID of the random painting selected, but then randomly becomes null before put into my renderer. I tested using just manual coordinates in place of the enumart.sizeX and so on and the coordinated painting I put in actually rendered! However it moved up .5 blocks randomly but I am not really concerned about that considering it might just be a glitch by manually putting numbers in place of the variables. I find this strange because it is using solely the vanilla classes in creating the enum values, yet I recieve a null. I am now focusing on my PapPapEntity class, since that is where it is directing the render to get the enum values from EntityPainting. Plus trying to pinpoint why art suddenly nulls, unless it's supposed to do that, but I doubt it. I'll update if I find anything else. I updated the code in my render class if any of you care to see it:
-
I thought about what you said, and I concluded that just how I setup TigerEntity is probably causing the entity to not be called on or registered, so I abandoned my OCD style of clean calling and decided to register it right in my main class, at least for now, and something interesting happened. So now when I use my item the game crashes, BUT, it is an error dealing with MY render class, so now it is being called! Now I just need to find why there is a null pointer in my class. Here is the modified main: Here is my render class again for easier access: And my lovely little error (and a little bit of log to have more reference): The first line it is talking about is this.funca(ent, enumart.sizeX, enumart.sizeY); and the second is the renderThePainting((PapPapEntity)ent, douba, doubb, doubc, flota, flotb); at the bottom I'm getting close! I can feel it! Thank you so much for your help so far!
-
Like this? Unfortunately it didn't seem to work, but maybe I misunderstood which one to put in the init I thought i registered the entity in my TigerEntity class, which you can look at in my first post, I don't think I am missing any entity registrations, just need that one line i think, I tried putting the entity registrations in the init too, but that also had no affect
-
jeffryfisher is right, I copied the vanilla painting png, replacing their paintings with my own, and used their set pixel enum template, since I rather not mess with adding more enum values before I can actually get the texture to display on my item's spawned hanging entity (currently my item's hanging entity uses the vanilla painting png). Draco18s is also right, through my many trials of trying to get this to work, one of them was to do that and just completely write out my entitypainting class and extend it to entityhanging, it opened up a whole new world of issues, mostly a java error: "don't know how to add [my entitypainting class]", but I don't think that is the solution (hopefully), so I just am going with the simplified entitypainting right now. I'll keep combing through my classes and vanilla's, so far all I have found is it seems to be called by entityitemframe->renderitemframe->rendermanager, however I do not know yet if these frame classes are being called when I use my item yet, I do know from scanning the vanilla classes it seems that the frame classes are situated in the painting item class. It's frustrating to say in the least to back track in the rendermanager and use break points in there due to minecraft constantly uses all of the rendermanager functions for camera positions so they are called every frame. EDIT: EntityItemFrame and RenderItemFrame seem to be constantly called, I don't think they are what I originally thought they were
-
Here is my main mod class: And the Server Proxy is: Which the Client Proxy is: Which I believe everything should be in order in those classes but perhaps a small error has waited until my hanging entity to display itself. I have been trying to use the call hierarchy on vanilla's render painting class to try to see what function in my classes is calling that instead of my own, my searching has turned up empty except it seems to be the rendermanager class that is initiating the vanilla render class when I use my item, however from there I cannot seem to find any trails to my classes I tried implements IEntityAdditionalSpawnData however it had no effect on the issue. Although this experience has helped me learn how to use the debugger more in detail so thank you for suggesting for me to use it in this issue. I'll keep searching the rendermanager's hierarchy and I will post if I find something, and thank you for any more suggestions you can give!
-
Hm, well I figured out why "private PapPapEntity createPapPapEntity" wasn't being called and changed the instance in itemuse to now call on "private PapPapEntity createPapPapEntity", however my render functions have yet to be called on and it seems to still be using original minecraft's render Tweaked Item Class:
-
Oops, my bad, I thought I forgot to add one of my classes Client Proxy Registration: You're right, when I debug using breakpoints absolutely no function is called in my rendering class when I spawn using my item. So I looked at my item class and noticed that "private PapPapEntity createPapPapEntity" at the bottom is also never called, but "public boolean onItemUse" is. So there must be some mis-coding with my item class, probably with the on item use function, although I am not too sure what Although I am happy that I found a probable source of the problem! I am not sure where it is in the function, maybe someone can see what I am not? Thanks for your help!
-
Hi I am creating a mod that is related to ancient Egypt, I have everything coded and well except for one thing, my custom hanging entity (painting format). I have been trying to solve this for nearly a year now, I have even devoted complete weekends to just working on this one thing to only get 0 steps closer each time, I am not someone to give up though, so I refuse to abandon the project. I have read the minecraft source code dozen times over, looked at each function, studied other mods with custom hanging entities, and I am still completely stumped. My problem is that I am trying to make custom paintings for my mod which uses the same png template as normal minecraft paintings, so I wouldn't have to change the enum coordinates. Whenever I test my item which spawns the hanging entity the texture is that of the normal minecraft paintings and not my own, yet they still drop my item. Either it is spawning something I don't want it to or the texture adding is wrong, I don't know. I would be really grateful if someone can see what I'm not. Item Class: Entity Class: Render Class: Item Registration: Entity Registration: There is an anomaly when I test the code, I am not sure if it relates to why this is happening, but it will tell me that "Using missing texture, unable to load minecraft:textures/blocks/tigermodobelisk1_1.png", which I never told it to look for the texture in the minecraft directory, nor does it seem to actually affect the texture of the block, since none of them have a missing texture and are all correct, could there be something that I set up wrong in the main that would cause the mod to look in minecraft: first before my mod and that causes the painting to take on their png instead of mine? I'm not sure why it would since the png I told it to look for is not named like their painting png. Thanks!
-
Hi, I am having trouble trying to understand where the error is happening within my code, the game crashes when I right click my custom painting item on a surface, I'm guessing something is going wrong with the spawning of the entity. Thanks for any help! The Error: My Entity class public class PapPapEntity extends EntityPainting{ public PapPapEnum fielda; public static enum PapPapEnum{ AlphA("AlphA", 16, 16, 0, 0), AlphB("AlphB", 16, 16, 16, 0), AlphC("AlphC", 16, 16, 32, 0), AlphD("AlphD", 16, 16, 48, 0), AlphE("AlphE", 16, 16, 64, 0), Ankh("Ankh", 16, 16, 80, 0), Udjat("Udjat", 16, 16, 96, 0), Pool("Pool", 32, 16, 0, 32), Courbet("Courbet", 32, 16, 32, 32), Sea("Sea", 32, 16, 64, 32), Sunset("Sunset", 32, 16, 96, 32), Creebet("Creebet", 32, 16, 128, 32), Wanderer("Wanderer", 16, 32, 0, 64), Graham("Graham", 16, 32, 16, 64), Match("Match", 32, 32, 0, 128), Bust("Bust", 32, 32, 32, 128), Stage("Stage", 32, 32, 64, 128), Void("Void", 32, 32, 96, 128), SkullAndRoses("SkullAndRoses", 32, 32, 128, 128), Wither("Wither", 32, 32, 160, 128), Fighters("Fighters", 64, 32, 0, 96), Pointer("Pointer", 64, 64, 0, 192), Pigscene("Pigscene", 64, 64, 64, 192), BurningSkull("BurningSkull", 64, 64, 128, 192), Skeleton("Skeleton", 64, 48, 192, 64), DonkeyKong("DonkeyKong", 64, 48, 192, 112); public static final int maxArtTitleLength = "SkullAndRoses".length(); public final String title; public final int sizeX; public final int sizeY; public final int offsetX; public final int offsetY; private PapPapEnum(String strin2, int int9, int int10, int int11, int int12){ this.title = strin2; this.sizeX = int9; this.sizeY = int10; this.offsetX = int11; this.offsetY = int12; } } public PapPapEntity(World world) { super(world); } public PapPapEntity(World world, int int1, int int2, int int3, int int4) { super(world, int1, int2, int3, int4); ArrayList arraylist = new ArrayList(); PapPapEnum[] aenumart = PapPapEnum.values(); int i1 = aenumart.length; for (int j1 = 0; j1 < i1; ++j1){ PapPapEnum enumart = aenumart[j1]; this.fielda = enumart; this.setDirection(int4); if (this.onValidSurface()){ arraylist.add(enumart); } } if (!arraylist.isEmpty()){ this.fielda = (PapPapEnum)arraylist.get(this.rand.nextInt(arraylist.size())); } this.setDirection(int4); } @SideOnly(Side.CLIENT) public PapPapEntity(World world, int int5, int int6, int int7, int int8, String strin1){ super(world, int5, int6, int7, int8); PapPapEnum[] aenumart = PapPapEnum.values(); int i1 = aenumart.length; int i2 = 0; while (i2<i1){ PapPapEnum enumart = aenumart[i2]; if (enumart.title.equals(strin1)){ this.fielda = enumart; break; } i2++; } this.setDirection(int8); } public void writeEntityToNBT(NBTTagCompound tagzcom) { tagzcom.setString("Motive", this.fielda.title); super.writeEntityToNBT(tagzcom); } public void readEntityFromNBT(NBTTagCompound tagzcom){ String s = tagzcom.getString("Motive"); PapPapEnum[] aenumart = PapPapEnum.values(); int i = aenumart.length; for (int j = 0; j < i; ++j){ PapPapEnum enumart = aenumart[j]; if (enumart.title.equals(s)){ this.fielda = enumart; } } if (this.fielda == null){ this.fielda = PapPapEnum.AlphA; } super.readEntityFromNBT(tagzcom); } public int getWidthPixels(){ return this.fielda.sizeX; } public int getHeightPixels(){ return this.fielda.sizeY; } public void onBroken(Entity entit){ if (entit instanceof EntityPlayer){ EntityPlayer entityplayer = (EntityPlayer)entit; if (entityplayer.capabilities.isCreativeMode){ return; } } this.entityDropItem(new ItemStack(TigerItems.PapPap), 0.0F); } } My Entity Rendering Class @SideOnly(Side.CLIENT) public class PapPapRender extends Render{ private static final ResourceLocation local = new ResourceLocation(RefStrings.MODID, "textures/painting/egypt.png"); public void doRender(PapPapEntity entity, double douba, double doubb, double doubc, float flota, float flotb){ GL11.glPushMatrix(); GL11.glTranslated(douba, doubb, doubc); GL11.glRotatef(flota, 0.0F, 1.0F, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); PapPapEntity.PapPapEnum enumart = entity.fielda; float f2 = 0.0625F; GL11.glScalef(f2, f2, f2); funca(entity, enumart.sizeX, enumart.sizeY); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } private void funca(PapPapEntity entity, int inta, int intb){ float f = (float)(-inta) / 2.0F; float f1 = (float)(-intb) / 2.0F; float f2 = 0.5F; float f3 = 0.75F; float f4 = 0.8125F; float f5 = 0.0F; float f6 = 0.0625F; float f7 = 0.75F; float f8 = 0.8125F; float f9 = 0.001953125F; float f10 = 0.001953125F; float f11 = 0.7519531F; float f12 = 0.7519531F; float f13 = 0.0F; float f14 = 0.0625F; for (int i1 = 0; i1 < inta / 16; ++i1) { for (int j1 = 0; j1 < intb / 16; ++j1){ float f15 = f + (float)((i1 + 1) * 16); float f16 = f + (float)(i1 * 16); float f17 = f1 + (float)((j1 + 1) * 16); float f18 = f1 + (float)(j1 * 16); this.funcb(entity, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F); float f19 = (float)(0 + inta - i1 * 16) / 256.0F; float f20 = (float)(0 + inta - (i1 + 1) * 16) / 256.0F; float f21 = (float)(0 + intb - j1 * 16) / 256.0F; float f22 = (float)(0 + intb - (j1 + 1) * 16) / 256.0F; Tessellator t = Tessellator.instance; t.startDrawingQuads(); t.setNormal(0.0F, 0.0F, 1.0F); t.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5); t.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5); t.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6); t.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6); t.setNormal(0.0F, 1.0F, 0.0F); t.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9); t.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9); t.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10); t.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10); t.setNormal(0.0F, -1.0F, 0.0F); t.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9); t.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9); t.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10); t.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10); t.setNormal(-1.0F, 0.0F, 0.0F); t.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13); t.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14); t.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14); t.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13); t.setNormal(1.0F, 0.0F, 0.0F); t.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13); t.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14); t.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14); t.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13); t.draw(); } } } private void funcb(PapPapEntity entity, float flot1, float flot2){ int i = MathHelper.floor_double(entity.posX); int j = MathHelper.floor_double(entity.posY + (double)(flot2 / 16.0F)); int k = MathHelper.floor_double(entity.posZ); if (entity.hangingDirection == 2) { i = MathHelper.floor_double(entity.posX + (double)(flot1 / 16.0F)); } if (entity.hangingDirection == 1) { k = MathHelper.floor_double(entity.posZ - (double)(flot1 / 16.0F)); } if (entity.hangingDirection == 0) { i = MathHelper.floor_double(entity.posX - (double)(flot1 / 16.0F)); } if (entity.hangingDirection == 3) { k = MathHelper.floor_double(entity.posZ + (double)(flot1 / 16.0F)); } int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0); int i1 = l % 65536; int j1 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1); GL11.glColor3f(1.0F, 1.0F, 1.0F); } protected ResourceLocation getEntityTexture(Entity ent){ return local; } public void doRender(Entity entity, double douba, double doubb, double doubc, float flota, float flotb){ doRender((PapPapEntity)entity, douba, doubb, doubc, flota, flotb); } }
-
[UNSOLVED][1.7.10] Rendering custom entity texture
PhantomTiger replied to PhantomTiger's topic in Modder Support
Update: I have made my entity class a bit easier to read, and changed it to extend entityhanging instead of entitypainting. Minecraft no longer crashes but now just reports "silently" an error while trying to spawn the entity which it does not. Entity class import java.util.ArrayList; import com.tiger.item.TigerItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityHanging; import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class PapPapEntity extends EntityHanging { public PapPapEntity.EnumArt art; private static final String __OBFID = "CL_00001018"; public PapPapEntity(World world) { super(world); } public PapPapEntity(World world2, int int1, int int2, int int3, int int4) { super(world2, int1, int2, int3, int4); ArrayList arraylist = new ArrayList(); PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values(); int i1 = aenumart.length; for (int j1 = 0; j1 < i1; ++j1){ PapPapEntity.EnumArt enumart = aenumart[j1]; this.art = enumart; this.setDirection(int4); if (this.onValidSurface()){ arraylist.add(enumart); } } if (!arraylist.isEmpty()){ this.art = (PapPapEntity.EnumArt)arraylist.get(this.rand.nextInt(arraylist.size())); } this.setDirection(int4); } @SideOnly(Side.CLIENT) public PapPapEntity(World world3, int int5, int int6, int int7, int int8, String strin1){ this(world3, int5, int6, int7, int8); PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values(); int i1 = aenumart.length; for (int j1 = 0; j1 < i1; ++j1){ PapPapEntity.EnumArt enumart = aenumart[j1]; if (enumart.title.equals(strin1)){ this.art = enumart; break; } } this.setDirection(int8); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound tagcom) { tagcom.setString("Motive", this.art.title); super.writeEntityToNBT(tagcom); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound tagcom2){ String s = tagcom2.getString("Motive"); PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values(); int i = aenumart.length; for (int j = 0; j < i; ++j){ PapPapEntity.EnumArt enumart = aenumart[j]; if (enumart.title.equals(s)){ this.art = enumart; } } if (this.art == null){ this.art = PapPapEntity.EnumArt.Kebab; } super.readEntityFromNBT(tagcom2); } public int getWidthPixels(){ return this.art.sizeX; } public int getHeightPixels(){ return this.art.sizeY; } public void onBroken(Entity entit){ if (entit instanceof EntityPlayer){ EntityPlayer entityplayer = (EntityPlayer)entit; if (entityplayer.capabilities.isCreativeMode){ return; } } this.entityDropItem(new ItemStack(TigerItems.PapPap), 0.0F); } public static enum EnumArt{ Kebab("Kebab", 16, 16, 0, 0), Aztec("Aztec", 16, 16, 16, 0), Alban("Alban", 16, 16, 32, 0), Aztec2("Aztec2", 16, 16, 48, 0), Bomb("Bomb", 16, 16, 64, 0), Plant("Plant", 16, 16, 80, 0), Wasteland("Wasteland", 16, 16, 96, 0), Pool("Pool", 32, 16, 0, 32), Courbet("Courbet", 32, 16, 32, 32), Sea("Sea", 32, 16, 64, 32), Sunset("Sunset", 32, 16, 96, 32), Creebet("Creebet", 32, 16, 128, 32), Wanderer("Wanderer", 16, 32, 0, 64), Graham("Graham", 16, 32, 16, 64), Match("Match", 32, 32, 0, 128), Bust("Bust", 32, 32, 32, 128), Stage("Stage", 32, 32, 64, 128), Void("Void", 32, 32, 96, 128), SkullAndRoses("SkullAndRoses", 32, 32, 128, 128), Wither("Wither", 32, 32, 160, 128), Fighters("Fighters", 64, 32, 0, 96), Pointer("Pointer", 64, 64, 0, 192), Pigscene("Pigscene", 64, 64, 64, 192), BurningSkull("BurningSkull", 64, 64, 128, 192), Skeleton("Skeleton", 64, 48, 192, 64), DonkeyKong("DonkeyKong", 64, 48, 192, 112); /** Holds the maximum length of paintings art title. */ public static final int maxArtTitleLength = "SkullAndRoses".length(); /** Painting Title. */ public final String title; public final int sizeX; public final int sizeY; public final int offsetX; public final int offsetY; private EnumArt(String strin2, int int9, int int10, int int11, int int12){ this.title = strin2; this.sizeX = int9; this.sizeY = int10; this.offsetX = int11; this.offsetY = int12; } } } Silent error -
[UNSOLVED][1.7.10] Rendering custom entity texture
PhantomTiger replied to PhantomTiger's topic in Modder Support
Hello again! I am sorry for the 2 month silence, I had a lack of internet until this week, although I have been periodically working on my code and better understand it. Now when I try to spawn the entity the game crashes (Which to me seems more like progress than the just getting the original paintings). I figured out why I was getting the original paintings on spawn, I was telling it to in the rendering class to doRender(EntityPainting) instead of doRender(PapPapEntity), now I just need to figure out what is causing the game to crash when trying to spawn my paintings. I have tried many many different things on my own, and hope I can get some experienced input here. Many thanks! Here is the most recent render class import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderPainting; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityPainting; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import com.tiger.lib.RefStrings; @SideOnly(Side.CLIENT) public class PapPapRender extends Render{ private static final String __OBFID = "CL_00001018"; private static final ResourceLocation local = new ResourceLocation(RefStrings.MODID + ":textures/painting/papy_egypt.png"); public void doRender(EntityPainting entity, double douba, double doubb, double doubc, float flota, float flotb){ GL11.glPushMatrix(); GL11.glTranslated(douba, doubb, doubc); GL11.glRotatef(flota, 0.0F, 1.0F, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); this.bindEntityTexture(entity); EntityPainting.EnumArt enumart = entity.art; float f2 = 0.0625F; GL11.glScalef(f2, f2, f2); this.funca(entity, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } protected ResourceLocation getEntityTexture(PapPapEntity texture){ return local; } private void funca(EntityPainting entity2, int inta, int intb, int intc, int intd){ float f = (float)(-inta) / 2.0F; float f1 = (float)(-intb) / 2.0F; float f2 = 0.5F; float f3 = 0.75F; float f4 = 0.8125F; float f5 = 0.0F; float f6 = 0.0625F; float f7 = 0.75F; float f8 = 0.8125F; float f9 = 0.001953125F; float f10 = 0.001953125F; float f11 = 0.7519531F; float f12 = 0.7519531F; float f13 = 0.0F; float f14 = 0.0625F; for (int i1 = 0; i1 < inta / 16; ++i1) { for (int j1 = 0; j1 < intb / 16; ++j1){ float f15 = f + (float)((i1 + 1) * 16); float f16 = f + (float)(i1 * 16); float f17 = f1 + (float)((j1 + 1) * 16); float f18 = f1 + (float)(j1 * 16); this.funcb(entity2, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F); float f19 = (float)(intc + inta - i1 * 16) / 256.0F; float f20 = (float)(intc + inta - (i1 + 1) * 16) / 256.0F; float f21 = (float)(intd + intb - j1 * 16) / 256.0F; float f22 = (float)(intd + intb - (j1 + 1) * 16) / 256.0F; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22); tessellator.setNormal(0.0F, 0.0F, 1.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10); tessellator.setNormal(0.0F, -1.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10); tessellator.setNormal(-1.0F, 0.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13); tessellator.setNormal(1.0F, 0.0F, 0.0F); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13); tessellator.draw(); } } } private void funcb(EntityPainting entity3, float flot1, float flot2) { int i = MathHelper.floor_double(entity3.posX); int j = MathHelper.floor_double(entity3.posY + (double)(flot2 / 16.0F)); int k = MathHelper.floor_double(entity3.posZ); if (entity3.hangingDirection == 2) { i = MathHelper.floor_double(entity3.posX + (double)(flot1 / 16.0F)); } if (entity3.hangingDirection == 1) { k = MathHelper.floor_double(entity3.posZ - (double)(flot1 / 16.0F)); } if (entity3.hangingDirection == 0) { i = MathHelper.floor_double(entity3.posX - (double)(flot1 / 16.0F)); } if (entity3.hangingDirection == 3) { k = MathHelper.floor_double(entity3.posZ + (double)(flot1 / 16.0F)); } int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0); int i1 = l % 65536; int j1 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1); GL11.glColor3f(1.0F, 1.0F, 1.0F); } @Override protected ResourceLocation getEntityTexture(Entity texture){ return this.getEntityTexture((PapPapEntity)texture); } public void doRender(Entity entity, double douba, double doubb, double doubc, float flota, float flotb){ this.doRender((PapPapEntity)entity, douba, doubb, doubc, flota, flotb); } } Here is the most recent entity class import java.util.ArrayList; import com.tiger.item.TigerItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityHanging; import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class PapPapEntity extends EntityPainting { public PapPapEntity.EnumArt art; private static final String __OBFID = "CL_00001018"; public PapPapEntity(World world) { super(world); } public PapPapEntity(World p_i1600_1_, int p_i1600_2_, int p_i1600_3_, int p_i1600_4_, int p_i1600_5_) { super(p_i1600_1_, p_i1600_2_, p_i1600_3_, p_i1600_4_, p_i1600_5_); ArrayList arraylist = new ArrayList(); PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values(); int i1 = aenumart.length; for (int j1 = 0; j1 < i1; ++j1){ PapPapEntity.EnumArt enumart = aenumart[j1]; this.art = enumart; this.setDirection(p_i1600_5_); if (this.onValidSurface()){ arraylist.add(enumart); } } if (!arraylist.isEmpty()){ this.art = (PapPapEntity.EnumArt)arraylist.get(this.rand.nextInt(arraylist.size())); } this.setDirection(p_i1600_5_); } @SideOnly(Side.CLIENT) public PapPapEntity(World p_i1601_1_, int p_i1601_2_, int p_i1601_3_, int p_i1601_4_, int p_i1601_5_, String p_i1601_6_){ this(p_i1601_1_, p_i1601_2_, p_i1601_3_, p_i1601_4_, p_i1601_5_); PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values(); int i1 = aenumart.length; for (int j1 = 0; j1 < i1; ++j1){ PapPapEntity.EnumArt enumart = aenumart[j1]; if (enumart.title.equals(p_i1601_6_)){ this.art = enumart; break; } } this.setDirection(p_i1601_5_); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound p_70014_1_) { p_70014_1_.setString("Motive", this.art.title); super.writeEntityToNBT(p_70014_1_); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound p_70037_1_){ String s = p_70037_1_.getString("Motive"); PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values(); int i = aenumart.length; for (int j = 0; j < i; ++j){ PapPapEntity.EnumArt enumart = aenumart[j]; if (enumart.title.equals(s)){ this.art = enumart; } } if (this.art == null){ this.art = PapPapEntity.EnumArt.Kebab; } super.readEntityFromNBT(p_70037_1_); } public int getWidthPixels(){ return this.art.sizeX; } public int getHeightPixels(){ return this.art.sizeY; } public void onBroken(Entity p_110128_1_){ if (p_110128_1_ instanceof EntityPlayer){ EntityPlayer entityplayer = (EntityPlayer)p_110128_1_; if (entityplayer.capabilities.isCreativeMode){ return; } } this.entityDropItem(new ItemStack(TigerItems.PapPap), 0.0F); } public static enum EnumArt{ Kebab("Kebab", 16, 16, 0, 0), Aztec("Aztec", 16, 16, 16, 0), Alban("Alban", 16, 16, 32, 0), Aztec2("Aztec2", 16, 16, 48, 0), Bomb("Bomb", 16, 16, 64, 0), Plant("Plant", 16, 16, 80, 0), Wasteland("Wasteland", 16, 16, 96, 0), Pool("Pool", 32, 16, 0, 32), Courbet("Courbet", 32, 16, 32, 32), Sea("Sea", 32, 16, 64, 32), Sunset("Sunset", 32, 16, 96, 32), Creebet("Creebet", 32, 16, 128, 32), Wanderer("Wanderer", 16, 32, 0, 64), Graham("Graham", 16, 32, 16, 64), Match("Match", 32, 32, 0, 128), Bust("Bust", 32, 32, 32, 128), Stage("Stage", 32, 32, 64, 128), Void("Void", 32, 32, 96, 128), SkullAndRoses("SkullAndRoses", 32, 32, 128, 128), Wither("Wither", 32, 32, 160, 128), Fighters("Fighters", 64, 32, 0, 96), Pointer("Pointer", 64, 64, 0, 192), Pigscene("Pigscene", 64, 64, 64, 192), BurningSkull("BurningSkull", 64, 64, 128, 192), Skeleton("Skeleton", 64, 48, 192, 64), DonkeyKong("DonkeyKong", 64, 48, 192, 112); /** Holds the maximum length of paintings art title. */ public static final int maxArtTitleLength = "SkullAndRoses".length(); /** Painting Title. */ public final String title; public final int sizeX; public final int sizeY; public final int offsetX; public final int offsetY; private EnumArt(String p_i1598_3_, int p_i1598_4_, int p_i1598_5_, int p_i1598_6_, int p_i1598_7_){ this.title = p_i1598_3_; this.sizeX = p_i1598_4_; this.sizeY = p_i1598_5_; this.offsetX = p_i1598_6_; this.offsetY = p_i1598_7_; } } } Here is the error, it seems to have started at getWidthPixels but I have no clue why -
[UNSOLVED][1.7.10] Rendering custom entity texture
PhantomTiger replied to PhantomTiger's topic in Modder Support
I updated the code, defiantly refactored the variables (that was annoying to read haha), got rid of EnumArt, still didn't work, I even tried making my own enum for the art in my Entity class, however my version of .art wouldn't carry over to the Render class, so I deleted that. Thanks guys for your help though, I am really starting to understand Minecraft's code more and I appreciate it, although apparently not enough yet to fix this texture thing X( Anyways here is my updated Render class: package com.tiger.entitiy; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityPainting; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import com.tiger.lib.RefStrings; public class PapPapRender extends Render{ private static final ResourceLocation local = new ResourceLocation(RefStrings.MODID, "textures/painting/papy_egypt.png"); public void doRender(EntityPainting entity, double douba, double doubb, double doubc, float flota, float flotb){ GL11.glPushMatrix(); GL11.glTranslated(douba, doubb, doubc); GL11.glRotatef(flota, 0.0F, 1.0F, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); this.bindEntityTexture(entity); float f2 = 0.0625F; GL11.glScalef(f2, f2, f2); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityPainting texture){ return local; } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ @Override protected ResourceLocation getEntityTexture(Entity texture){ return this.getEntityTexture((EntityPainting)texture); } public void doRender(Entity entity, double douba, double doubb, double doubc, float flota, float flotb){ this.doRender((EntityPainting)entity, douba, doubb, doubc, flota, flotb); } } I'm curious though, why are there two doRenders? -
[UNSOLVED][1.7.10] Rendering custom entity texture
PhantomTiger replied to PhantomTiger's topic in Modder Support
I've been looking at it for the last 8ish hours and I am truly stumped, here are my other classes if anybody wants to scan those for problems or missing functions. ItemHangingEntity class package com.tiger.entitiy; import com.tiger.CreativeTabs.TigerCreativeTabs; import com.tiger.item.TigerItems; import net.minecraft.entity.EntityHanging; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemHangingEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; import net.minecraft.world.World; public class PapPapHanging extends ItemHangingEntity{ public PapPapHanging(Class p_i45342_1_) { super(p_i45342_1_); this.setCreativeTab(TigerCreativeTabs.tabItems); } /** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS */ @Override public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){ if (p_77648_7_ == 0){ return false; } else if (p_77648_7_ == 1){ return false; } else{ int i1 = Direction.facingToDirection[p_77648_7_]; EntityHanging entityhanging = this.createHangingEntity(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1); if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_)){ return false; } else{ if (entityhanging != null && entityhanging.onValidSurface()){ if (!p_77648_3_.isRemote){ p_77648_3_.spawnEntityInWorld(entityhanging); } --p_77648_1_.stackSize; } return true; } } } /** * Create the hanging entity associated to this item. */ private EntityHanging createHangingEntity(World p_82810_1_, int p_82810_2_, int p_82810_3_, int p_82810_4_, int p_82810_5_){ return (EntityHanging) new PapPapEntity(p_82810_1_, p_82810_2_, p_82810_3_, p_82810_4_, p_82810_5_); } } EntityPainting class package com.tiger.entitiy; import java.util.ArrayList; import com.tiger.item.TigerItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityHanging; import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class PapPapEntity extends EntityPainting { public PapPapEntity(World world) { super(world); } public PapPapEntity(World p_i1600_1_, int p_i1600_2_, int p_i1600_3_, int p_i1600_4_, int p_i1600_5_) { super(p_i1600_1_, p_i1600_2_, p_i1600_3_, p_i1600_4_, p_i1600_5_); } public void onBroken(Entity p_110128_1_) { if (p_110128_1_ instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer)p_110128_1_; if (entityplayer.capabilities.isCreativeMode) { return; } } this.entityDropItem(new ItemStack(TigerItems.PapPap), 0.0F); } } RenderPainting Class package com.tiger.entitiy; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityPainting; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import com.tiger.lib.RefStrings; @SideOnly(Side.CLIENT) public class PapPapRender extends Render{ private static final ResourceLocation field_110807_a = new ResourceLocation(RefStrings.MODID + "textures/painting/papy_egypt.png"); private static final String __OBFID = "CL_00001018"; /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(EntityPainting p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { GL11.glPushMatrix(); GL11.glTranslated(p_76986_2_, p_76986_4_, p_76986_6_); GL11.glRotatef(p_76986_8_, 0.0F, 1.0F, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); this.bindEntityTexture(p_76986_1_); EntityPainting.EnumArt enumart = p_76986_1_.art; float f2 = 0.0625F; GL11.glScalef(f2, f2, f2); this.func_77010_a(p_76986_1_, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityPainting p_110775_1_) { return field_110807_a; } private void func_77010_a(EntityPainting p_77010_1_, int p_77010_2_, int p_77010_3_, int p_77010_4_, int p_77010_5_) { float f = (float)(-p_77010_2_) / 2.0F; float f1 = (float)(-p_77010_3_) / 2.0F; float f2 = 0.5F; float f3 = 0.75F; float f4 = 0.8125F; float f5 = 0.0F; float f6 = 0.0625F; float f7 = 0.75F; float f8 = 0.8125F; float f9 = 0.001953125F; float f10 = 0.001953125F; float f11 = 0.7519531F; float f12 = 0.7519531F; float f13 = 0.0F; float f14 = 0.0625F; for (int i1 = 0; i1 < p_77010_2_ / 16; ++i1) { for (int j1 = 0; j1 < p_77010_3_ / 16; ++j1) { float f15 = f + (float)((i1 + 1) * 16); float f16 = f + (float)(i1 * 16); float f17 = f1 + (float)((j1 + 1) * 16); float f18 = f1 + (float)(j1 * 16); this.func_77008_a(p_77010_1_, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F); float f19 = (float)(p_77010_4_ + p_77010_2_ - i1 * 16) / 256.0F; float f20 = (float)(p_77010_4_ + p_77010_2_ - (i1 + 1) * 16) / 256.0F; float f21 = (float)(p_77010_5_ + p_77010_3_ - j1 * 16) / 256.0F; float f22 = (float)(p_77010_5_ + p_77010_3_ - (j1 + 1) * 16) / 256.0F; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22); tessellator.setNormal(0.0F, 0.0F, 1.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10); tessellator.setNormal(0.0F, -1.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10); tessellator.setNormal(-1.0F, 0.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13); tessellator.setNormal(1.0F, 0.0F, 0.0F); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13); tessellator.draw(); } } } private void func_77008_a(EntityPainting p_77008_1_, float p_77008_2_, float p_77008_3_) { int i = MathHelper.floor_double(p_77008_1_.posX); int j = MathHelper.floor_double(p_77008_1_.posY + (double)(p_77008_3_ / 16.0F)); int k = MathHelper.floor_double(p_77008_1_.posZ); if (p_77008_1_.hangingDirection == 2) { i = MathHelper.floor_double(p_77008_1_.posX + (double)(p_77008_2_ / 16.0F)); } if (p_77008_1_.hangingDirection == 1) { k = MathHelper.floor_double(p_77008_1_.posZ - (double)(p_77008_2_ / 16.0F)); } if (p_77008_1_.hangingDirection == 0) { i = MathHelper.floor_double(p_77008_1_.posX - (double)(p_77008_2_ / 16.0F)); } if (p_77008_1_.hangingDirection == 3) { k = MathHelper.floor_double(p_77008_1_.posZ + (double)(p_77008_2_ / 16.0F)); } int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0); int i1 = l % 65536; int j1 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1); GL11.glColor3f(1.0F, 1.0F, 1.0F); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity p_110775_1_) { return this.getEntityTexture((EntityPainting)p_110775_1_); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { this.doRender((EntityPainting)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } } Entity registration code int randomId =EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerModEntity(PapPapEntity.class, "PapPapEntity", randomId, MainRegistry.modInstance, 128, 1, true); ClientProxy code public void registerRenderInformation(){ RenderingRegistry.registerEntityRenderingHandler(PapPapEntity.class, new PapPapRender()); } Item Creation code public static Item PapPap; PapPap = new PapPapHanging(PapPapEntity.class).setCreativeTab(TigerCreativeTabs.tabItems).setUnlocalizedName("PapPap").setTextureName(RefStrings.MODID + ":ppap"); GameRegistry.registerItem(PapPap, PapPap.getUnlocalizedName()); Thank you for going through my code and trying to help! -
[UNSOLVED][1.7.10] Rendering custom entity texture
PhantomTiger replied to PhantomTiger's topic in Modder Support
Tried that, boy whatever this is, it is being stubborn , I am still going through the RenderPainting source code and see what is wrong, perhaps if I don't extend this and just paste all of that code in my class? Edit: Nope. It must be how I am trying to pull up the png file, but none of the names are wrong. unless it is how I am tying the entity to the item, is this a problem? PapPap = new PapPapHanging(PapPapEntity.class).setCreativeTab(TigerCreativeTabs.tabItems).setUnlocalizedName("PapPap").setTextureName(RefStrings.MODID + ":ppap"); PapPap is the custom item, aka Papyrus Paper, it's not just a silly name haha -
[UNSOLVED][1.7.10] Rendering custom entity texture
PhantomTiger replied to PhantomTiger's topic in Modder Support
I tried deleting the function with enumart and checked console, there's no missing textures for the paintings, interesting, I wonder if there is something else that must be put in ResourceLocation? Edit: I tried removing all the functions in the rendering class except for: protected ResourceLocation getEntityTexture(Entity painting) { return new ResourceLocation(RefStrings.MODID + ":textures/painting/paintings_egypt.png"); } however the pictures still render, but just as their vanilla counterparts -
[UNSOLVED][1.7.10] Rendering custom entity texture
PhantomTiger replied to PhantomTiger's topic in Modder Support
Oh yeah good catch! Unfortunately that didn't seem to work, but it should help after finding the other problem, is there any other classes I should be looking at to find the possible error? -
Hi, I made a custom item act like the painting item and spawn paintings, however it is still using the pictures from the vanilla minecraft texture png instead of the png from my mod's texture's file, can someone take a look at my rendering class to see what I missed? Much thanks! Rendering Class import java.util.Iterator; import java.util.List; import java.util.Iterator; import java.util.List; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import com.tiger.lib.RefStrings; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderPainting; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityHanging; import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.Direction; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; public class PapPapRender extends RenderPainting { private static final ResourceLocation field_110807_a = new ResourceLocation(RefStrings.MODID, "textures/painting/paintings_egypt.png"); protected ResourceLocation getEntityTexture(EntityPainting derp){ return field_110807_a; } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(EntityPainting p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_){ GL11.glPushMatrix(); GL11.glTranslated(p_76986_2_, p_76986_4_, p_76986_6_); GL11.glRotatef(p_76986_8_, 0.0F, 1.0F, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); this.bindEntityTexture(p_76986_1_); EntityPainting.EnumArt enumart = p_76986_1_.art; float f2 = 0.0625F; GL11.glScalef(f2, f2, f2); this.func_77010_a(p_76986_1_, 16, 16, 0, 0); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } private void func_77010_a(EntityPainting p_77010_1_, int sizeX, int sizeY, int p_77010_4_, int p_77010_5_){ float f = (float)(-sizeX) / 2.0F; float f1 = (float)(-sizeY) / 2.0F; float f2 = 0.5F; float f3 = 0.75F; float f4 = 0.8125F; float f5 = 0.0F; float f6 = 0.0625F; float f7 = 0.75F; float f8 = 0.8125F; float f9 = 0.001953125F; float f10 = 0.001953125F; float f11 = 0.7519531F; float f12 = 0.7519531F; float f13 = 0.0F; float f14 = 0.0625F; for (int i1 = 0; i1 < sizeX / 16; ++i1){ for (int j1 = 0; j1 < sizeY / 16; ++j1){ float f15 = f + (float)((i1 + 1) * 16); float f16 = f + (float)(i1 * 16); float f17 = f1 + (float)((j1 + 1) * 16); float f18 = f1 + (float)(j1 * 16); this.lighting(p_77010_1_, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F); float f19 = (float)(p_77010_4_ + sizeX - i1 * 16) / 256.0F; float f20 = (float)(p_77010_4_ + sizeX - (i1 + 1) * 16) / 256.0F; float f21 = (float)(p_77010_5_ + sizeY - j1 * 16) / 256.0F; float f22 = (float)(p_77010_5_ + sizeY - (j1 + 1) * 16) / 256.0F; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22); tessellator.setNormal(0.0F, 0.0F, 1.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10); tessellator.setNormal(0.0F, -1.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10); tessellator.setNormal(-1.0F, 0.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13); tessellator.setNormal(1.0F, 0.0F, 0.0F); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13); tessellator.draw(); } } } private void lighting(EntityPainting p_77008_1_, float p_77008_2_, float p_77008_3_){ int i = MathHelper.floor_double(p_77008_1_.posX); int j = MathHelper.floor_double(p_77008_1_.posY + (double)(p_77008_3_ / 16.0F)); int k = MathHelper.floor_double(p_77008_1_.posZ); if (p_77008_1_.hangingDirection == 2){ i = MathHelper.floor_double(p_77008_1_.posX + (double)(p_77008_2_ / 16.0F)); } if (p_77008_1_.hangingDirection == 1){ k = MathHelper.floor_double(p_77008_1_.posZ - (double)(p_77008_2_ / 16.0F)); } if (p_77008_1_.hangingDirection == 0){ i = MathHelper.floor_double(p_77008_1_.posX - (double)(p_77008_2_ / 16.0F)); } if (p_77008_1_.hangingDirection == 3){ k = MathHelper.floor_double(p_77008_1_.posZ + (double)(p_77008_2_ / 16.0F)); } int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0); int i1 = l % 65536; int j1 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1); GL11.glColor3f(1.0F, 1.0F, 1.0F); } protected ResourceLocation getEntityTexture(Entity derp){ return this.getEntityTexture((EntityPainting)derp); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_){ this.doRender((PapPapEntity)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } }