Jump to content

PhantomTiger

Members
  • Posts

    27
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    Trying to make a Mod

PhantomTiger's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. 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.
  2. 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
  3. 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
  4. 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!
  5. 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.
  6. 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:
  7. Hm, I looked at my classes the last two days to see what is making my entity null, however I am not sure what the culprit is here, nulls have always been my bane in programming. Can someone explain what is nulling the entity to me?
  8. 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!
  9. 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
  10. 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
  11. 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!
  12. 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:
  13. 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!
  14. 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!
  15. 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); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.