Posted June 5, 201312 yr The last problem is solved, directly after this the next one comes up: My shurikens are all rendered same; all of them have the same texture... What have I done wrong? The corresponding Item class: public class MoreToolsShuriken extends Item { private int damage = 6; private int shurikenType = 0; public MoreToolsShuriken(int ID) { super(ID); } public MoreToolsShuriken(int ID, int Damage, int ShurikenType) { super(ID); this.damage = Damage; this.shurikenType = ShurikenType; } public MoreToolsShuriken setDamage(int Damage){ this.damage = Damage; return this; } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ EntityShuriken shuriken; switch (this.shurikenType){ case 1: shuriken = new EntityShurikenGold(world, player, this, damage); case 2: shuriken = new EntityShurikenCopper(world, player, this, damage); case 3: shuriken = new EntityShurikenGlass(world, player, this, damage); case 4: shuriken = new EntityShurikenDiamond(world, player, this, damage); case 5: shuriken = new EntityShurikenBloodCrystal(world, player, this, damage); default: shuriken = new EntityShuriken(world, player, this, damage); } world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + 0.5F); if (!world.isRemote) { world.spawnEntityInWorld(shuriken); } if (!player.capabilities.isCreativeMode){ if (-- stack.stackSize == 0) return null; } return stack; } } The Intialzation of these Items: shurikenIron = new MoreToolsShuriken(shurikenIronID, 4, 0).setUnlocalizedName(PicInit + "shurikenIron").setCreativeTab(MoreTools.tabMoreWeapons); shurikenGold = new MoreToolsShuriken(shurikenGoldID, 6, 1).setUnlocalizedName(PicInit + "shurikenGold").setCreativeTab(MoreTools.tabMoreWeapons); shurikenCopper = new MoreToolsShuriken(shurikenCopperID, 5, 2).setUnlocalizedName(PicInit + "shurikenCopper").setCreativeTab(MoreTools.tabMoreWeapons); shurikenDiamond = new MoreToolsShuriken(shurikenDiamondID, 7, 4).setUnlocalizedName(PicInit + "shurikenDiamond").setCreativeTab(MoreTools.tabMoreWeapons); shurikenBloodCrystal = new MoreToolsShuriken(shurikenBloodCrystalID, 9, 5).setUnlocalizedName(PicInit + "shurikenBloodCrystal").setCreativeTab(MoreTools.tabMoreWeapons); shurikenGlass = new MoreToolsShuriken(shurikenGlassID, 4, 3).setUnlocalizedName(PicInit + "shurikenGlass").setCreativeTab(MoreTools.tabMoreWeapons); The EntityShurkien Class: public class EntityShuriken extends EntityThrowable { private int damage = 2; private Item itemDrop; public EntityShuriken(World par1World) { super(par1World); } public EntityShuriken(World par1World, EntityLiving par2EntityLiving) { super(par1World, par2EntityLiving); } public EntityShuriken(World world, EntityLiving shotBy, Item itemDrop, int Damage) { super(world, shotBy); this.damage = Damage; this.itemDrop = itemDrop; } public EntityShuriken(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } /** * Called when this EntityThrowable hits a block or entity. */ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (par1MovingObjectPosition.entityHit != null) { par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (byte)damage); } else { if (!this.worldObj.isRemote) { if (itemDrop != null){ this.dropItem(itemDrop.itemID, 1); } } } if (!this.worldObj.isRemote) { this.setDead(); } } } The Render Class: @SideOnly(Side.CLIENT) public class RenderShuriken extends Render { private Item itemIcon; private int field_94150_f = 0; public RenderShuriken(Item par1, int par2) { this.itemIcon = par1; this.field_94150_f = par2; } public RenderShuriken(Item par1) { this(par1, 0); } /** * 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 doRender(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 par1Entity, double par2, double par4, double par6, float par8, float par9) { Icon icon = itemIcon.getIconFromDamage(this.field_94150_f); if (icon != null) { GL11.glPushMatrix(); GL11.glTranslatef((float)par2, (float)par4, (float)par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F, 0.5F); this.loadTexture("/gui/items.png"); Tessellator tessellator = Tessellator.instance; this.func_77026_a(tessellator, icon); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } } private void func_77026_a(Tessellator par1Tessellator, Icon par2Icon) { float f = par2Icon.getMinU(); float f1 = par2Icon.getMaxU(); float f2 = par2Icon.getMinV(); float f3 = par2Icon.getMaxV(); float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.25F; GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); par1Tessellator.startDrawingQuads(); par1Tessellator.setNormal(0.0F, 1.0F, 0.0F); par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3); par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3); par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2); par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2); par1Tessellator.draw(); } } And last but not least the initialization of the renderer: public static void registerEntities() { setUpEntity(EntityShuriken.class, "Iron Shuriken", 0, MoreTools.instance, 128, 1, true, new RenderShuriken(MoreToolsItems.shurikenIron)); setUpEntity(EntityShurikenCopper.class, "Copper Shuriken", 1, MoreTools.instance, 128, 1, true, new RenderShuriken(MoreToolsItems.shurikenCopper)); setUpEntity(EntityShurikenGold.class, "Gold Shuriken", 2, MoreTools.instance, 128, 1, true, new RenderShuriken(MoreToolsItems.shurikenGold)); setUpEntity(EntityShurikenDiamond.class, "Diamond Shuriken", 3, MoreTools.instance, 128, 1, true, new RenderShuriken(MoreToolsItems.shurikenDiamond)); setUpEntity(EntityShurikenBloodCrystal.class, "Blood Crystal Shuriken", 4, MoreTools.instance, 128, 1, true, new RenderShuriken(MoreToolsItems.shurikenBloodCrystal)); setUpEntity(EntityShurikenGlass.class, "Glass Shuriken", 5, MoreTools.instance, 128, 1, true, new RenderShuriken(MoreToolsItems.shurikenGlass)); } private static void setUpEntity(Class<? extends Entity> EntityClass, String EntityName, int ModID, Object ModObject, int trackingRange, int updateFrequency, boolean sendsVelocityUpdate, Render renderer){ EntityRegistry.registerGlobalEntityID(EntityClass, EntityName, EntityRegistry.findGlobalUniqueEntityId()); EntityRegistry.registerModEntity(EntityClass, EntityName, ModID, ModObject, trackingRange, updateFrequency, sendsVelocityUpdate); RenderingRegistry.registerEntityRenderingHandler(EntityClass, renderer); } I hope, somebody can help me with this problem... Thanks in advance!!! (If you need more source code, please tell me!) http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
June 5, 201312 yr Do you mean that the items have the same texture, or the entities, or both? BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 5, 201312 yr Author Do you mean that the items have the same texture, or the entities, or both? The Entities have the same texture. The Items are all different. The spawned Entities are different too, it's only the same texture. http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
June 7, 201312 yr Author Does no one have an Idea?! If so, you could tell me another way to create multiple Entities of the same Type (My Shurikens are like Snowballs) with different render Icons... Please help me! http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
June 15, 201312 yr Perhaps you might try reworking the renderer to use seperate files, the way it is done with items normally. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.