Posted July 14, 201312 yr i made a couple of items which I thought would be interesting to make them throwable. I just copied the snowball item and entity classes and adjusted the item class line: -par2World.spawnEntityInWorld(new EntitySnowball(par2World, par3EntityPlayer)); No errors occur but when I right click, no entity appears. It does hit mobs. What do I have to add to make the entity appear?
July 14, 201312 yr I had the same problem but I found this link which helped me render them here: http://www.minecraftforum.net/topic/1770612-rendering-problem-with-throwable-item/ also change entitysnowball to your entity so that when it does render it wont render as a snowball http://i1279.photobucket.com/albums/y523/textcraft/Jul%202013%20-%203/9fe024ebf03623c0265f2c0ac1dfaa87db905ff7c593e1616aec2474a92516f4db7b79aa8e4023f09fb0ecba4ae771f7606d800aacdf40b3b889e1274c94a41a97a0a04ec748_zps33f9ea75.png[/img]
July 14, 201312 yr Oh and for the hell of it look at my class item class package minecraftmod; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import minecraftmod.EntityShuriken; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntityFireball; import net.minecraft.entity.projectile.EntityFishHook; import net.minecraft.entity.projectile.EntitySmallFireball; import net.minecraft.entity.projectile.EntitySnowball; import net.minecraft.entity.projectile.EntityThrowable; public class Shuriken extends Item { public Shuriken(int par1) { super(par1); this.maxStackSize = 16; this.setCreativeTab(CreativeTabs.tabMisc); } public void registerIcons(IconRegister ir) { this.itemIcon = ir.registerIcon( "titaniummod:shuriken"); } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ public ItemStack onItemRightClick(ItemStack ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --ItemStack.stackSize; } par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.9F + 0.9F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityShuriken(par2World, par3EntityPlayer)); } return ItemStack; }} render class package minecraftmod; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.resources.ResourceLocation; import net.minecraft.entity.Entity; import net.minecraft.entity.projectile.EntityFireball; import net.minecraft.item.Item; import net.minecraft.util.Icon; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @SideOnly(Side.CLIENT) public class RenderShuriken extends Render { public RenderShuriken() { } public void doRenderFireball(EntityShuriken par1Entity, double par2, double par4, double par6, float par8, float par9) { GL11.glPushMatrix(); GL11.glTranslatef((float)par2, (float)par4, (float)par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); Icon icon = TitaniumMod.Shuriken.getIconFromDamage(0); Tessellator tessellator = Tessellator.instance; float f3 = icon.getMinU(); float f4 = icon.getMaxU(); float f5 = icon.getMinV(); float f6 = icon.getMaxV(); float f7 = 1.0F; float f8 = 0.5F; float f9 = 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); this.loadTexture("/gui/items.png"); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double)(0.0F - f8), (double)(0.0F - f9), 0.0D, (double)f3, (double)f6); tessellator.addVertexWithUV((double)(f7 - f8), (double)(0.0F - f9), 0.0D, (double)f4, (double)f6); tessellator.addVertexWithUV((double)(f7 - f8), (double)(1.0F - f9), 0.0D, (double)f4, (double)f5); tessellator.addVertexWithUV((double)(0.0F - f8), (double)(1.0F - f9), 0.0D, (double)f3, (double)f5); tessellator.draw(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } private void loadTexture(String string) { // TODO Auto-generated method stub } protected ResourceLocation func_110790_a(EntityFireball par1EntityFireball) { return TextureMap.field_110576_c; } protected ResourceLocation func_110775_a(Entity par1Entity) { return this.func_110790_a((EntityFireball)par1Entity); } /** * 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) { this.doRenderFireball((EntityShuriken)par1Entity, par2, par4, par6, par8, par9); } } http://i1279.photobucket.com/albums/y523/textcraft/Jul%202013%20-%203/9fe024ebf03623c0265f2c0ac1dfaa87db905ff7c593e1616aec2474a92516f4db7b79aa8e4023f09fb0ecba4ae771f7606d800aacdf40b3b889e1274c94a41a97a0a04ec748_zps33f9ea75.png[/img]
July 14, 201312 yr Author I don't know, I copied exactly what the forum post said - didn't work. Copied exactly what you had - still didn't work.
July 14, 201312 yr Did you make a render class. and if so did you register it in your client proxy or main class http://i1279.photobucket.com/albums/y523/textcraft/Jul%202013%20-%203/9fe024ebf03623c0265f2c0ac1dfaa87db905ff7c593e1616aec2474a92516f4db7b79aa8e4023f09fb0ecba4ae771f7606d800aacdf40b3b889e1274c94a41a97a0a04ec748_zps33f9ea75.png[/img]
July 14, 201312 yr Author Yes, I put this in my main class: @EventHandler public void init(FMLPreInitializationEvent event) { RenderingRegistry.registerEntityRenderingHandler(EntityThrowableItem.class, new RenderThrowableItem()); } And made the render class for it. And a question. Are all three of these classes (the item, entity and render) just taking the items image and using it for the entity then rendering it?
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.