Jump to content

Recommended Posts

Posted

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));

Posted

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(...);  ::)

Posted

 

@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-

Posted

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-

Posted

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;
    }



}


Posted

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-

Posted

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

 

  • 2 months later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Please read the FAQ and post logs as described there.
    • Upon starting the server I get; [main/ERROR] [minecraft/Main]: Failed to start the minecraft server net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [     Framework (framework) has failed to load correctly §7java.lang.NoClassDefFoundError: net/minecraft/client/gui/components/toasts/Toast ] I suspect there is a (possibly a few) client-only mods installed on my server. Any help would be appreciated! (Yes I know there are a lot of mods...) Here is the crash log:   https://paste.ee/p/pRz5mhMl#s=0
    • That's basically what the failure does, my apologies for failing to specify.  It just tries again on the next tick until it detects the entities for that chunk are loaded, and then tries to load the entity.  From there it gets into different failure states depending on what goes wrong, but in short, if the entity fails to load once the entity list becomes available, the request is cleared and must be resubmitted by the end user.  There should be few cases where that actually happens. Yes, that is my understanding of forceloading.  That's why on a successful summon, it removes the forceload.  Otherwise it does just leave the chunks loaded long term. Thank you for your help, any knowledge is useful!  I don't often mess with forceloading and my prior experience is 1.16 so I'm also a bit out of my depth haha.
    • I will have to do more research about 1.18 chunk loading. You were unclear about how your code manages with the entity load failure. If you simply used a loop, I suggest submitting a tick task to the next tick which does the same thing, checking if the entities are loaded and if so teleporting the right one else submitting another tick task etc. Also I think forceloading permanently force loads the chunk, and it only starts to unload when you make a subsequent call to mark the chunk as not forceloaded. I may be completely wrong, I dont know much about 1.18, most of my experience is 1.20. Good luck I hope you figure it out after all this time 😅
    • i managed to fix it by reinstalling the modpack and re-add all the extra mods I've had previously.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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