Jump to content

[1.8] Rendering Entity Model


Sakuya is my waifu

Recommended Posts

So couple days ago i created a shrine with power and everything, worked and powered just fine and today i bacame a code wizard... wat ._.

any ideas?

 

Above can be translated: "I don't see your code, bruh!"  :'(

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Good idea for a shrine, probably going to use that, thanks and code wizard too, a final boss which will crash your game... or or make your screen "crack" and teleport you to the matix dimension... thanks 'bruh

 

Model:

public class ModelSoul extends ModelBase{

public ModelRenderer core = new ModelRenderer(this, 0, 0);
public ModelRenderer outercore;
public ModelRenderer aura;

public ModelSoul(){
	textureWidth = 64;
	textureHeight = 64;

	this.core = new ModelRenderer(this, 32, 1);
	this.core.addBox(-2F, -2F, -2F, 4, 4, 4);
    this.core.setRotationPoint(0F, 16F, 0F);

    this.outercore = new ModelRenderer(this, 0 ,16);
    this.outercore.addBox(-3F, -3F, -3F, 6, 6, 6);
    this.outercore.setRotationPoint(0F, 16F, 0F);
    
    this.aura = new ModelRenderer(this, 0, 0);
    this.aura.addBox(-4F, -4F, -4F, 8, 8, ;
    this.aura.setRotationPoint(0F, 16F, 0F);
}

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5){
   
    this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    this.core.render(f5);
    this.aura.render(f5);
    this.outercore.render(f5);
  }

public void setRotationAngles(Entity entity, float f, float f1, float f2, float f3, float f4, float f5){
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  }
}

 

main entity class

public class Es {

public static void registerEntity() {
	createEntity(EntitySoul.class, "Soul", 0xF3F0CD, 0x055D61);
}

public static void createEntity(Class enityClass, String entityName, int solidColor, int spotColor){
	int randomID = EntityRegistry.findGlobalUniqueEntityId();
	EntityRegistry.registerGlobalEntityID(enityClass, entityName, randomID);
	EntityRegistry.registerModEntity(enityClass, entityName, randomID, neko.Kudo.Kudo.instance, 64, 1, true);
	EntityRegistry.addSpawn(enityClass, 2, 0, 1, EnumCreatureType.CREATURE, BiomeGenBase.forest);

	createEgg(randomID, solidColor, spotColor);
}

private static void createEgg(int randomID, int solidColor, int spotColor){
	EntityList.entityEggs.put(Integer.valueOf(randomID), new EntityList.EntityEggInfo(randomID, solidColor, spotColor));
}
}

 

entity itself:

public class EntitySoul extends EntityMob{

public EntitySoul(World worldIn) {
	super(worldIn);
	this.setSize(1.0F, 1.0F);

}

}

 

client proxy:

public class ClientProxy extends CommonProxy{
@Override
public void registerRenders(){
	Bs.registerRenders();
	Is.registerRenders();
	Es.registerEntity();		

}
}

server proxy:

public class CommonProxy {
public void registerRenders(){

}
}

 

 

"The cycle of life and death continues. We will live, they will die."

Link to comment
Share on other sites

Sooo... where is rendering class? You only gave model.

 

Also - look at your client proxy. Since when registering entity is a renderig stuff for client?

 

1. Creating entity should be done in COMMON proxy or main mod class. All in pre-init.

2. Then you need to register renderer in CLIENT proxy. Rendering goes to init phase.

 

To make renderer you can extend Render<something>.class.

 

According to your namig - EntitySoul - should this be alive? Moreover - should this be a mob? Sould sounds rather like EntityLivingBase or JUST Entity.

To register renderer you use:

RenderingRegistry.registerEntityRenderingHandler(EntitySomething.class, new RenderSomething(Minecraft.getMinecraft().getRenderManager()));

 

Sidenote: I don't belive you that it worked before. It couldn't unless you had mentioned above stuff and removed it on accident.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

forgot to put main and renderer class:

public class RenderSoul extends RenderLiving{

private static final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID + ":textures/entity/soul.png");

public RenderSoul(RenderManager p_i46153_1_, ModelBase p_i46153_2_, float p_i46153_3_) {
	super(p_i46153_1_, p_i46153_2_, p_i46153_3_);
}

protected ResourceLocation getEntityTexture(EntitySoul entity){
	return texture;
}

protected ResourceLocation getEntityTexture(Entity entity){
	return this.getEntityTexture((EntitySoul)entity);
}

}

and in my main mod class

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	Es.registerEntity();		
}

i like creating seperate classes and not putting everything in main mod class...

 

this is how it looks right now :

https://goo.gl/photos/1XgrHdPZizAVDeBa8

"The cycle of life and death continues. We will live, they will die."

Link to comment
Share on other sites

Again: Did you register the renderer?

Next: What are you putting into RenderSoul constructor. Whole Code, not just parts.

Last: Fix variable namig - to something meaningful.

 

Whenever something changes - you need to post changes. Best would be git.

 

If you did register it, check (by placing print) if your renderer is being called at all.

 

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

so in client proxy:

public class ClientProxy extends CommonProxy{

@Override
public void registerRenders(){
	Es.registerRenders();
}
}

 

and in main entity class:

public static void registerRenders() {
	RenderingRegistry.registerEntityRenderingHandler(EntitySoul.class, new RenderSoul(Minecraft.getMinecraft().getRenderManager()));

}

but it tells me to add arguments to match RenderSoul if i do so, game crashes saying "Rendering entity in world

 

java.lang.NullPointerException: Rendering entity in world"

"The cycle of life and death continues. We will live, they will die."

Link to comment
Share on other sites

// JokesOn

EDIT: Removed. I guess not everyone knows memes :C

// JokesOff

 

1. Learn Java

2. Learn what is constructor.

3. Look at your Renderer's constructor.

4. Figure out what should be inside.

5.Come back with code that actually is being called.

 

Code in question:

public RenderSoul(RenderManager p_i46153_1_, ModelBase p_i46153_2_, float p_i46153_3_) {
	super(p_i46153_1_, p_i46153_2_, p_i46153_3_);
}

new RenderSoul(Minecraft.getMinecraft().getRenderManager()) // Where are 3 args? I see only one.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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