Jump to content

skullywag

Members
  • Posts

    102
  • Joined

  • Last visited

Everything posted by skullywag

  1. I have the exact code i put above running right now, in an entity renderer calling a model class, renderTileEntityAt method: GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); ResourceLocation textures = (new ResourceLocation("skullywag_spawnCrystalsProto:textures/blocks/Crystal.png")); Minecraft.getMinecraft().renderEngine.bindTexture(textures); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); It works fine, no class for the resource location.
  2. if you are on 1.6.4 you can use: ResourceLocation textures = (new ResourceLocation("name_modname:textures/items/texture.png")); Minecraft.getMinecraft().renderEngine.bindTexture(textures); in your renderer. I think thats what you're after...
  3. Forgive me if im misunderstanding you but, the start of my renderer looks like this: public class TileEntityCrystalRenderer extends TileEntitySpecialRenderer { private final ModelCustom model; public TileEntityCustomRenderer() { this.model = new ModelCustom (); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { GL11.glPushMatrix(); As per my OP if I put a print statement before that GL11 PushMatrix, both te.getBlockMetadata and te.blockMetadata return 0 all the time, even I place meta 1, 2 or 3. The render method I posted in the OP is in my model class.
  4. so what have you got making it tick, tickrandomly?, tickscheduler?
  5. Throw some debug in there and work out if its being called.
  6. Hi all, Im trying to add a block that "grows" using metadata (0 = just planted, 1 = slightly grown 2 = full grown). I have a model that contains all the shapes for all the states, I want to pick the ones to show with a switch/if, something like: public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); if(meta == 0) { MainCrystal.render(f5); } if(meta == 1) { MainCrystal1.render(f5); OffShoot11.render(f5); OffShoot12.render(f5); OffShoot13.render(f5); } if(meta == 2) { MainCrystal2.render(f5); OffShoot21.render(f5); OffShoot22.render(f5); OffShoot23.render(f5); } but im having trouble passing the metadata in from anywhere, Ive tried from my TileEntity Renderer class in the renderTileEntityAt method to no avail. Ive tried NBT, no luck. The problem seems to be that if i print the entity passed in to renderTileEntityAt it seems to know where it is (x,y,z) it know what its blocktype is it however ALWAYS returns 0 for getBlockMetadata and blockMetadata. Once ive solved this issue there is something else id like to ask on this subject but i wont muddy the waters here until this is solved as this is the one thats bugging me.
  7. God dammit.....i should of spotted that. Im gonna use the same excuse as last night....its almost 3am and I need sleep. This better not become a thing...you'll give me a complex. Either way when I get this mod done youre going in the credits, youve bailed me out twice now...might even add a "Grey Ghost" mob as tribute to your awesomeness. Thanks again...and goodnight! *wanders off to bed mumbling AGAIN about how daft he is*
  8. Thanks for your help (again) TGG So ive tweaked it to this: float entityScaleFactor = Math.abs(entityHeight) >= 0.1f ? 1.2f / entityHeight : 1.0f; // avoid problems if height == 0.0 GL11.glScalef(entityScaleFactor, entityScaleFactor, entityScaleFactor); float f1 = entityScaleFactor; GL11.glScalef(f1, f1, f1); as 1.2 looked a little closer to what I want with a height passed of 1.8, a height of 2.9 looks small and 4 is tiny, any height under the 1.2 obviously grows in size and looks hilarious! Is there anyway I can make them more uniform, what im after is if the block is 1.0F high all entities will get a rendered height of say 0.8F as it stands now the taller the mob the smaller it is rendered.
  9. Just tried your code and the entities are their actual sizes...working through it now.... edit - does it matter to that code if the heights are floats? it asked me to cast to float on the math absolute value line
  10. hey all, Im trying to scale a bunch of randomly heighted entities down to fit inside a block. Now with a float im passing to GL11.glScalef(f1, f1, f1); I end up with some entities sticking out of the block. The float in this example is 0.4375F. So an entity with height of 1.8 fits nicely, one with height of 4 does not. Does GL11 have a set specific size option? so I can make all entities the same size and therefore fit in the block (im not the best with GL tbh) Or can this be done with some math, ive had a go but cant quite nail the equation. Or is their a way to set the height of an entity when I get it? so I can make em all the same height before scaling. edit - my brain is telling me to work out the percentage difference between the entity height given and the preffered height, but then i cant think of the next step.
  11. God Dammit, that was my problem, Why the hell didnt I think to use the same bloody method at both ends. I was using mobentity.getEntityName() on the death, which is OBVIOUSLY not the same as the one in EntityList, I said it would end up being something stupidly simple, hate being right when I say that. Thank you muchly and apologies for wasting your time on something that should have been entirely straight forward. Its almost 3am here think I need some sleep. Oh and if it wasnt obvious its working beautifully. *goes to bed mumbling about how daft he is*
  12. Can you cast using [] I thought it was ()
  13. ok, some detail required. Entities in game drop a custom xp orb type entity when killed, this entity holds the unique identifier which is written on death of the entity (using a forge living death event to write to NBT of the orb entity, ive tried entityID,and enitityName). When you collect these orbs they "fill" an item on your hotbar and transfer the identifier to it, you then (once the item is full) right click it on a block (a custom mob spawner) the mob spawner uses pretty similar code to vanilla to spawn the entity. The key part is the transfer of the identifier to the mob spawning block: spawner.getSpawnerLogic().setMobName(mobtospawn); This sets a String in the mob spawners logic, that is returned in getEntityNameToSpawn() below. So if I were to kill a Thaumcraft "Angry Zombie" thats what would be passed to the setMobName. The spawner block then uses the code i put above: Entity entity = EntityList.createEntityByName(this.getEntityNameToSpawn(), this.getSpawnerWorld()); to create the entity and spawn it (once I have the entity here the rest of my code is fine), Everything works perfectly if the mob name and the registration name are the same. I even have 2 custom mob entities (zombie and skeleton with burn in sun disabled) that I can call by passing their entity name, they work fine as their name is also the name I used when registering them. Im looking for a sure fire way of getting the right entity whether its vanilla or custom mobs. So it seems I have 2 options, either I change what im passing as the identifier or I change how I lookup the mob entity. Im pretty sure this is gonna be a really simple thing in the end, I just cannot find the 1 piece of info im missing.
  14. EntityRegistry doesnt give me any methods that seems useful in this regard. Looked in .instance() as well, the only thing that looks like a possibility is: EntityRegistry.instance().lookupModSpawn but theres 2 versions of it, that I cant bend my head around what they need, ill look into these, but any other help is appreciated. Thanks for your help so far, I hate getting stuck on things like this, you would think there would be something on the mob to track back...
  15. yep it returns "Wild Boar"as well. Another example is thaumcraft, Wisps work fine as ingame the name is "wisp" and they are I assume registered as "Wisp", however ingame "Angry Zombie" does not equal "Brainy Zombie" as its registered.
  16. Hey all, Im having some issues in regards to spawning mobs using the data available ingame. My issue is that I have been using: Entity entity = EntityList.createEntityByName(this.getEntityNameToSpawn(), this.getSpawnerWorld()); To spawn mobs, im killing said mobs and storing their info in an item and passing the name of the mob to it, the issue is not all mobs return an entity when passing the name thats available ingame. As an example I know all the Twilight Forest mobs require "TwlightForest." in front of what "mobentity.getEntityName()" will return. So I get "Wild Boar" ingame, but it wants "TwilightForest.Wild Boar". I dont want to write internal rules for each custom mod that has its own mobs, id rather this was kept as dynamic as possible. Ive tried creating from IDs, from NBT, nothing I do seems to work. The only thing I can think might lead me to a solution is to use mobentity.getClass() in some way but my brain refuses to come up with the solution. EntityList doesnt seem to have the required method I need. Can someone here come up with a way of achieving this, or point out my stupidity (its probably this, its been a long night...)
  17. Ok i kind of have it working, had to make copy: EntityZombie RenderEntityZombie EntityZombieGroupData EntityZombieINNER1 ZombieEvent This gets me no fire in daylight, brilliant! however, all custom zombies are zombie villagers...*sigh*...nerd world problems....ill have a play for a bit see if i cant backtrace why this is happening and post a new thread if I get nowhere. edit - nope i derped, all is well. I accidentally deleted an IF so it was setting villager to TRUE all the time.....
  18. Thats what I had done to begin with but it came with its own issues (nameley the forgeEventFactory for call zombie aid) I couldnt resolve the errors with that as it will only take EntityZombie not EntityCustomZombie.
  19. Hi all, Couldnt fit what I wanted in the title so apologies about the vagueness. My issue is im trying to make a version of zombies that dont burn in sunlight, so I have extended the EntityZombie Class and overriden the method that does the burning, however in this same method is a call to the super.method which is in EntityZombie and obviously DOES contain the burning code. Now i need the stuff further up the chain in the supers so but would like to basically bypass the EntityZombie method and go straight to EntityMob, am I missing something fundementally simple here or am i going to have create a whole new Entity for this?
  20. ok so to get around this problem I created a new entity and renderer both almost exact replicas of EntitySkeleton and RenderSkeleton, registered my custom entity, then changed the onSpawnWithEgg method to remove the random setting of skeleton type (as im going to be setting this manually) then just set the attack type and weapon held in there based on skeleton type and bingo, I can now spawn what I want from a mob spawner without randomness. Not sure its the best way of sorting my issue but it works.
  21. you are missing your modname from the path, your mod isnt called basic based on your package name. and just for good measure the way i do it is to set the unlocalised name wherever then use: par1IconRegister.registerIcon(myMod.modid + ":" + (this.getUnlocalizedName().substring(5))); Hope it helps.
  22. ok think ive found part of my problem, if you are in the nether using a mobspawner and spawning skeletons, the method onSpawnWithEgg (which is the single worst named method ever) is called, which randomly sets the skeleton type to 1 (wither). So in the overworld i can use setSkeletonType and all is fine and dandy i can spawn normal skeletons or withers at my leisure, in the nether not so much, now to find away around this behaviour.
  23. Hey all, Simple enough question, why when i put: Entity entity = EntityList.createEntityByName(this.getEntityNameToSpawn(), this.getSpawnerWorld()); if (entity instanceof EntitySkeleton && ((EntitySkeleton)entity).getSkeletonType() == 1) { System.out.println("WITHER"); } in the updateSpawner method of a mob spawner does it never print even if a wither (1) is spawned. Debug states its 0 everytime no matter what type of skeleton is spawned. Im pretty sure ive got the syntax correct and the if i just do the "entity instanceof EntitySkeleton" part its true so I know that bit works. And if for some reason the above wont work for a reason im yet to understand, does anyone know of a way of getting the type of skeleton at all? Thanks.
  24. and from now on I will, please bare in mind that none of the forge tutorials and none of the tutorials submitted by third parties (like wuppy for instance) show doing this in this particular method (unless im blind), I understand its good practice in all programming languages and from now on ill remember to do it wherever I can to avoid such issues, this is all a learning experience for me and when it works perfectly fine in the Client you can surely understand my confusion. I understood the error fully I just couldnt understand HOW it was happening. Youve helped me a few times Draco18s and for that im grateful, however the guy trying to belittle me on a public forum for no reason whatsoever is just petty and uncalled for and I will always defend myself against such "trolls" especially when looking at their post history they get stuck on the same simple things I was getting stuck on. Anyways this lesson is learned, onto the next thing to learn.
  25. It states I read the crash report in the OP if youd open your eyes. It also states it worked fine in CLIENT ONLY MODE, I wanted to know why when running on a server I was getting the wrong meta data returned for a block I hadnt even placed. Literally on server login Id crash with that error. Turns out it was actually the world that was the issue and I had some left over ghost block or something (still dont know really). Killing the world and restarting got rid of part of the problem. So it might of seemed like a "common Java error" but it wasnt, So before you open your mouth and add nothing comments to my threads use your brain.
×
×
  • Create New...

Important Information

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