Posted August 19, 201312 yr I have an item (ItemRocketLauncher) Which, onItemRightClick spawns in the EntityRocket... BUT ITS INVISIBLE I decided to make a techne model... exported it as a model, fixed errors... still invisible. Here is the code: ItemRocketLauncher package assets.battleofthebeasts.common.items; import java.util.List; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import assets.battleofthebeasts.common.BattleOfTheBeastsMod; import assets.battleofthebeasts.entity.projectiles.EntityRocket; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemRocketLauncher extends Item { public ItemRocketLauncher(int id) { super(id); this.setMaxStackSize(1); this.setCreativeTab(CreativeTabs.tabMaterials); } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister reg) { this.itemIcon = reg.registerIcon(BattleOfTheBeastsMod.modid + ":" + this.getUnlocalizedName()); } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if(par3EntityPlayer.capabilities.isCreativeMode||par3EntityPlayer.inventory.consumeInventoryItem(BattleOfTheBeastsMod.ItemWizardPower.itemID)) { par2World.playSoundAtEntity(par3EntityPlayer, "fireworks.launch", 0.8F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityRocket(par2World, par3EntityPlayer)); } } return par1ItemStack; } } EntityRocket package assets.battleofthebeasts.entity.projectiles; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import assets.battleofthebeasts.common.BattleOfTheBeastsMod; public class EntityRocket extends EntityThrowable { //field_92057 = ExplosionRadius public int field_92057_e = 3; private Entity shootingEntity; private double speed = 0.3F; public EntityRocket(World par1World) { super(par1World); this.motionX*=speed; this.motionY*=speed; this.motionZ*=speed; } @Override protected float getGravityVelocity() { return 0; } public EntityRocket(World par1World, EntityPlayer par3EntityPlayer) { super(par1World, par3EntityPlayer); } public EntityRocket(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { //| Make this true of you want to spawn fire on explosion //V this.worldObj.newExplosion((EntityRocket)null, this.posX, this.posY, this.posZ, (float)this.field_92057_e, false, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); this.setDead(); } } RenderRocket package assets.battleofthebeasts.render; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import assets.battleofthebeasts.common.BattleOfTheBeastsMod; import assets.battleofthebeasts.entity.projectiles.EntityRocket; import assets.battleofthebeasts.models.RocketModel; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderRocket extends RenderLiving { public static final ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "/textures/entity/Rocket.png"); public RenderRocket(RocketModel par1RocketModel, float par2) { super(par1RocketModel, par2); } @Override public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) { GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glRotatef(90F, 0F, 1.0F, 0.0F); } protected ResourceLocation func_110832_a(EntityRocket par1EntityRocket) { return Texture; } protected ResourceLocation func_110775_a(Entity par1Entity) { return this.func_110832_a((EntityRocket)par1Entity); } } RocketModel // Date: 8/18/2013 9:33:30 PM // Template version 1.1 // Java generated by Techne // Keep in mind that you still need to fill in some blanks // - ZeuX package assets.battleofthebeasts.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class RocketModel extends ModelBase { //fields ModelRenderer Front; ModelRenderer Middle; ModelRenderer Tip; ModelRenderer End; public RocketModel() { textureWidth = 64; textureHeight = 64; Front = new ModelRenderer(this, 2, 6); Front.addBox(-2F, -2F, -6F, 4, 4, 6); Front.setRotationPoint(0F, 0F, 0F); Front.setTextureSize(64, 64); Front.mirror = true; setRotation(Front, 0F, 0F, 0F); Middle = new ModelRenderer(this, 2, 18); Middle.addBox(-1F, -1F, 0F, 2, 2, 2); Middle.setRotationPoint(0F, 0F, 0F); Middle.setTextureSize(64, 64); Middle.mirror = true; setRotation(Middle, 0F, 0F, 0F); Tip = new ModelRenderer(this, 2, 2); Tip.addBox(-1F, -1F, -1F, 2, 2, 1); Tip.setRotationPoint(0F, 0F, -6F); Tip.setTextureSize(64, 64); Tip.mirror = true; setRotation(Tip, 0F, 0F, 0F); End = new ModelRenderer(this, 2, 24); End.addBox(-2F, -2F, 0F, 4, 4, 1); End.setRotationPoint(0F, 0F, 2F); End.setTextureSize(64, 64); End.mirror = true; setRotation(End, 0F, 0F, 0F); } 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); Front.render(f5); Middle.render(f5); Tip.render(f5); End.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } } Load Method (Main Class) EntityRegistry.registerGlobalEntityID(EntityRocket.class, "Rocket", 21); RenderingRegistry.registerEntityRenderingHandler(EntityRocket.class, new RenderRocket(new RocketModel(), 0.1F));
August 19, 201312 yr public class RenderRocket extends RenderLiving { public static final ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "textures/entity/Rocket.png"); public RenderRocket(RocketModel par1RocketModel, float par2) { super(par1RocketModel, par2); } @Override public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) { GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glRotatef(90F, 0F, 1.0F, 0.0F); } protected ResourceLocation func_110775_a(Entity par1Entity) { return Texture; } } This would be better. By the way, your doRender method doesn't render your model or anything. You should probably call model.render(...);
August 19, 201312 yr @Override public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) { GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glRotatef(90F, 0F, 1.0F, 0.0F); } dafuq is this ? lets place this into my gl-to-english translator String glCode = "GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glRotatef(90F, 0F, 1.0F, 0.0F);" String englishOutput = GLTranslator.translateGlCode(glCode); System.out.println(englishOutput); console: -save the current matrix state -restore the latest matrix state//2 statement which togheter do absolutelly nothing -rotate the whole world with the quaternion (90, 0, 1, 0)//yes you will mess everything up with this how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
August 19, 201312 yr Author GotoLink, I copied your method, Nothing really changed much... Can you show me how to call the model.render exactly?
August 19, 201312 yr lol... lololol.... hmm.. lolol Can you show me how to call the model.render exactly? .. lol model.render(); yup ... how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
August 19, 201312 yr Author STILL invisible... Here is what I have in my RenderRocket RenderRocket package assets.battleofthebeasts.render; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import assets.battleofthebeasts.common.BattleOfTheBeastsMod; import assets.battleofthebeasts.models.RocketModel; public class RenderRocket extends RenderLiving { public static final ResourceLocation Texture = new ResourceLocation(BattleOfTheBeastsMod.modid, "textures/entity/Rocket.png"); public RenderRocket(RocketModel par1RocketModel, float par2) { super(par1RocketModel, par2); } public static void doRender(RocketModel model, Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { model.render(par1Entity, par2, par2, par2, par2, par2, par2); } protected ResourceLocation func_110775_a(Entity par1Entity) { return Texture; } }
August 19, 201312 yr model.render(par1Entity, par2, par2, par2, par2, par2, par2); dont jsut fill method with any argument you find :\ this will only appear if both you and the mob are at 0, 0, 0 how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
August 19, 201312 yr Author hydroflame, I know you are one of the most helpful peeps on Forge, but I'm going to have to ask you to re-type in the entire RenderCode for me... and btw, model.render(par1Entity, par2, par2, par2, par2, par2, par2); dont jsut fill method with any argument you find :\ this will only appear if both you and the mob are at 0, 0, 0 the arguments were added automatically, If i were to remove it, it will come out as an error
August 19, 201312 yr par2, par3, par4, par5, par6, par7 how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
August 19, 201312 yr Author Is there anything else to change on the other classes? The freaking rocket is still invisible
November 8, 201311 yr I'm still having this same problem, I tried to use AnnihilatorBoltModel.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); But couldn't make a static reference to a non-static variable Creator of Metroid Cubed! Power Suits, Beams, Hypermode and more! http://i.imgur.com/ghgWmA3.jpg[/img]
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.