Jump to content

Senitiel

Members
  • Posts

    66
  • Joined

  • Last visited

Everything posted by Senitiel

  1. You forgot to load texture. You have to put something like this Minecraft.getMinecraft().renderEngine.bindTexture("/mods/SurvivalChaos/textures/blocks/Campfire.png"); in public void renderAModelAt(TestEntityClass tileentity1, double d, double d1, double d2, float f) { GL11.glPushMatrix(); //Add this line here Minecraft.getMinecraft().renderEngine.bindTexture("/mods/SurvivalChaos/textures/blocks/Campfire.png"); // { GL11.glTranslatef((float) d + 0.5F, (float) d1 + 0.5F, (float) d2 + 0.5F); GL11.glPushMatrix(); // } GL11.glPopMatrix(); GL11.glPopMatrix(); } Just modify the string in bindTexture so, that it fits Your folder structure. Texture is best put in: mcp/src/minecraft/mods/SurvivalChaos (or anything what You have as Your mod id)/textures/blocks/Block texture.png Did i help?
  2. Well, You were supposed to use RenderThrownItem it as the body for private void doRenderRockSnowball(EntityRockSnowball par1Entity, double par2, double par4, double par6, float par8, float par9) { } Remember, there's no magic here - if a method isn't called anywhere, then it won't do anything. You may check it using Eclipse right click->show references
  3. I'm glad that I helped You, Raggarcowboy. As for You, ashtonr12: Hm. I use it in my mod as well, and it works in multi, doesn't crash server. Are You sure that it causes issues? As for code, this works fine. The example item is thrownItem and entitythrownitem. SpaceMarineMod.class ClientProxy ThrownItemEntity RenderThrownItem
  4. I'm not sure if it will work for You - it worked when I tried some tests myself, but then You may be missing some code I'm not aware You don't have. loadTexture("/mods/silverdagger/textures/items/Silver_Dagger.png"); This should rather stay this.loadTexture("/gui/items.png"); Important is that Icon icon = SilverDagger.swordSilver.getIconFromDamage(0); Try it. Now, if it works, further explanation is not necessary. If not: 1. Delete (or better comment, using ctrl+/ shortcut) the whole render code (I mean doRender function), leaving it an empty function. 2.Try to run it - if a) it still renders like white cube, that would mean that Your render code isn't even used. You would have to double check render registering, for example using the tutorial I provided. Part II and part III contain info about rendering. b) the entity simply doesn't show, that the thing that needs checking is if Your getIconFromDamage returns initialized Icon. You may need to move item registration to preInit method if it doesn't.
  5. Well, if it rendered, It would crash, as You cannot cast EntityDagger into EntityFireball in doRenderFireball. Change types used in method. Second: in EntitySilverDagger class, you have to define a constructor, which takes only world as parameter. Even if You don't use it anywhere, rendering functions still need it. Thirdly, you'll need also to register EntityID in EntityRegistry //RegisterRenders is a fine place for this line EntityRegistry.registerGlobalEntityID(EntitySilverDagger.class, "SilverDagger", ModLoader.getUniqueEntityId()); And register entity in Your load method EntityRegistry.registerModEntity(EntitySilverDagger.class, "SilverDagger", 1, instance, 160, 1, false); Does it work now? The float is not needed. Remove it.
  6. Use RenderFireball code, I think it's simpler. Icon icon = Item.fireballCharge.getIconFromDamage(0); this.loadTexture("/gui/items.png"); Tessellator tessellator = Tessellator.instance; float f3 = icon.getMinU(); float f4 = icon.getMaxU(); float f5 = icon.getMinV(); float f6 = icon.getMaxV(); Replace the icon with what You need. Or You could use Techne, there are some tutorials I may recommend. How to create models using Techne. http://pixelmon.wikinet.org/wiki/Techne_Tutorial How to texture models using Techne. http://dragonith.deviantart.com/art/Techne-Tutorial-Texturing-I-264650065 http://dragonith.deviantart.com/art/Techne-Tutorial-Texturing-II-264719834 You would also require another tutorial, on how to use Techne generated code to render entities. I've been using it to render items so far.
  7. I use a plain box as a model for my power fist item. It's basically a little bigger version of vanilla player arm, being like 4x16x4.I double the detail, making two 8x8 squares for top/bottom and four 8x32 rectangles for front/back/both sides. But the texture size I use is actually 128x 64, most of the texture file is left transparent. So, if You use a box 16x8x 8 (Why have You given only two dimensions?), and 256x128 texture, it's structure should look like this: 16x16 square transparent, 16x16 square for top, 16x16 square for bottom, 16x16 square transparent /... rest transparent 16x32front, 16x32 left side, 16x32 back, 16x32 right side, /... rest transparent. The other thing is, that it's really hard to help You if You don't show any code. Are You using Techne to create the model, or are just coding it Yourself?
  8. Do You use models? There is a function setTextureSize(width, height); Feed it right arguments, this should do the trick.
  9. The method itself looks fine. It will search for myCustomBow.png in the following folder structure: mcp/src/mods/myModName/textures/items/myCustomBow.png - if You already have a folder structure like so, You probably just have a typo somewhere in Your code. One thing I'm not sure: are You changing vanillla ItemBow code?
  10. That's strange, because I've been using TileEntities with blocks which do not implement this interface. I wonder if that changed, gotta test my code.
  11. Wait. You're not just tossing them, but placing them as blocks, right? This makes matters some more complicated. Are these hats primarily items, which can be placed as blocks, or blocks, which can be equipped? In the first case I know how to handle item Rendering, but I didn't do any complicated blocks, so I won't be of much use in the second case. Anyway, for Your blocks You need another rendering method. Take fence rendering for example, to see how it's done. But if You already do have a special rendering class for hat blocks, I'm out of ideas.
  12. First of all, study Your Ecplipse Console Output carefully to get what line causes the error - I cannot tell which line of Your code does it, as the code You've posted doesn't have line numbers. This could be this.spawnableCreatureList.clear(); if spawnableCreatureList is null, this will cause problem. this.fillerBlock = (byte) Server.AitherDirt.blockID; if Server or AitherDirt is null, this will cause problem this.theBiomeDecorator.grassPerChunk = 12; if theBiomeDecorator is null, this will cause problem. Every one of these fields needs to be initialized before You reference them - check which one of them isn't initialized before public BiomeGenAitherMountain is called and initialize it, with any values - this will fix Your problem.
  13. Hm, try to log any message in ReadFromNBT and WriteToNBT to check which one of these isn't called. But I'm not sure why it wouldn't as You have "hasTileEntity" and "createTileEntity" methods and You do TileEntityRegistration.
  14. It looks like You don't bind textures to the models. use Minecraft.getMinecraft().renderEngine.bindTexture("/mods/AwesomeArmorMod/textures/items/TopHat.png"); in Your renderer classes. But It would help if You've posted some code.
  15. As for This snippet should resolve the issue onUpdate() { if(worldObj.getBlockID(xCoord,yCoord,zCoord)!= YourBlock.blockID) { invalidate(); } To resolve issues with TileEntity not being save, first: override hasTileEntity in BlockChainReactive (return true) and put GameRegistry.registerTileEntity(TileEntityChainReactiveRock.class, "TileEntityChainReactiveRock"); int Your mod load method. Does this work?
  16. Thanks! This does the trick.
  17. Thanks! This Techne is indeed a really handy tool.
  18. In my code i have to access some private field. I know how to do this using reflection. try { Field lastDamage = EntityLiving.class.getDeclaredField("lastDamage"); lastDamage.setAccessible(true); int fieldValue = (Integer) lastDamage.get(movingobjectposition.entityHit); damage+=fieldValue; } catch (Exception e) { e.printStackTrace(); } However, this works only in Eclipse, after reobfuscation lastDamage gets some funky name field_70707_bp, so unless i change the string before reobfuscating my mod, the code above won't work in released version of my mod. Whereas I know where to find non reobfuscated name, It's a pain in the ass to keep an eye on it before reobfuscating. I read that newest version of FML allows for runtime reobfuscation, which is supposed to help it such cases. Does anyone know how to use that feature?
  19. glTranslatef will move Your model. It's easy to figure out this one using some kind of bisection method (If You want to move Your model in X axis, but You don't know how big the factor should be, give it some value x1, then, if it's too big, give it x1/2 and if x1/2 is too little, give it x1*3/4 and so on until You got Your value). Just remember to use glTranslate after rotating and before scaling. glRotatef will rotate model by angle (first parameter) using axis (three other parameters). It's easiest to give 0.0F to two axes, and 1.0F to one axis. Glove model should be rotated more or less like this: GL11.glRotatef(-55, 0.0F, 0.0F, 1.0F); As arms are by default rotated 55 degrees around Z axis. Maybe some other angles should be applied to other axes, but I'm not sure. Also note, that You should specify some offset (not texture offset) in Techne if You're using it, so that Your model has good rotation center. Otherwise, rotating and translating will be extremely tricky.
  20. Hm. First of all, You got me wrong again. I was proposing that You do: public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count) { player.worldObj.spawnParticle("smoke", player.posX-1+rand.nextInt(2)+rand.nextDouble(), player.posY-1+rand.nextDouble(), player.posZ-1+rand.nextInt(2)+rand.nextDouble(), 0.0D, 0.0D, 0.0D); } public void onPlayerStoppedUsing(world, stack, player, otherargs) { if (!lock) { Main.startHunt(player); lock = true; } } Now, why it doesn't work? Looks like Main.startHunt is called in remote world, so if(!world.isRemote) returns false. There may be issues with getting worldObj from player, as Player has various entities EntityPlayer, EntityPlayerMP, EntitySinglePlayerMP, EntityOtherPlayerMP and so on. It's complicated and may be made even more complicated with updates. My tip? Change hunt.setHuntCancelIfActiveWithNew to accept world parameter, add World worldObj to Hunt class, and call public void onPlayerStoppedUsing(world, stack, player, otherargs) { if (!lock) { Main.startHunt(player,world); lock = true; } } Does it work now?
  21. From oracle docs: So, You need to have rand.nextInt(2). . I think it may have changed with the last version of Java. As for smoke, use: onUsingItemTick(ItemStack stack, EntityPlayer player, int count) To spawn smoke, and onPlayerStoppedUsing to run the event.
  22. damageValue = 4; //rare item damage value } else if (randomChange < 20) { damageValue2 = damageValue, damageValue2 - it's not working because of a typo, I believe. As For onPlayerStoppedUsing, You may need to specify getMaxItemUseDuration or getItemUseAction. Also, do You call par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); in onItemRightClick?
  23. EntityPlayer has worldObj field. It's marked public, there should be no problem accessing it.
  24. I have the following problem: I've made a power fist item that is basically an augmented glove which can be used in close combat. The deal is, I don't know how to render it so, it looks like it's worn on Players arm, instead of being held. I'm not sure how to do that. Either how to make a custom item render, or how to change players skin a bit, so that it looks like he's wearing a glove. I don't want to change any of the base classes.
  25. So is the mob spawning, but not rendering, or rendering, but not spawning? Or both of these problems?
×
×
  • Create New...

Important Information

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