Jump to content

[SOLVED] [1.11.2] Custom Entity not rendering correctly.


Recommended Posts

Posted (edited)

Hey,

 

Few things before I post some code, I am using the following Library to assist in model imports:

- LLibrary

 

I was unsure if I should post this directly to the Library author, but I decided to come here first instead, maybe I misread something or am doing something stupid and someone

else can point it out to me rather than me bugging someone who could be extremely busy.

 

The code:

 

EntityDeer

package com.Demonly.animals.entity;

import net.minecraft.entity.ai.EntityAIRunAroundLikeCrazy;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;

public class EntityDeer extends EntityMob {

	public EntityDeer(World worldIn) {
		super(worldIn);
		this.setSize(1.5F, 1.5F);
		
		// AI Tasks
		this.tasks.addTask(1, new EntityAIWander(this, 5.0D));
		this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	}
	
	public boolean isAIEnabled() {
		return true;
	}

}

 

RenderDeer

package com.Demonly.animals.render;

import java.io.IOException;

import com.Demonly.animals.entity.EntityDeer;

import net.ilexiconn.llibrary.client.model.tabula.TabulaModel;
import net.ilexiconn.llibrary.client.model.tabula.TabulaModelHandler;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class RenderDeer extends RenderLiving<EntityDeer> {

	public RenderDeer(RenderManager renderManager) throws IOException {
	    super(renderManager, new TabulaModel(TabulaModelHandler.INSTANCE.loadTabulaModel("assets/deerly/Deer1.tbl")), 2F);
	}
	
	@Override
	protected ResourceLocation getEntityTexture(EntityDeer entity) {
		// TODO Auto-generated method stub
		return null;
	}

}

 

ClientProxy

package com.Demonly.proxy;

import java.io.IOException;

import com.Demonly.animals.entity.EntityDeer;
import com.Demonly.animals.render.RenderDeer;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.client.registry.RenderingRegistry;

public class ClientProxy implements CommonProxy {
	
	public void RegisterRenders() {
		
		RenderingRegistry.registerEntityRenderingHandler(EntityDeer.class,new IRenderFactory<EntityDeer>(){

					@Override
					public Render<? super EntityDeer> createRenderFor(RenderManager manager) {
						try {
							return new RenderDeer(manager);
						} catch (IOException e) {
							e.printStackTrace();
						}
						return null;
					}
		});
		
	}
}

 

AnimalRegistry

package com.Demonly.animals;

import com.Demonly.animals.entity.EntityDeer;

import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Biomes;
import net.minecraftforge.fml.common.registry.EntityRegistry;

public class AnimalRegistry {
	
	public void initCommon() {
		
		EntityRegistry.addSpawn(EntityDeer.class, 150, 15, 20, EnumCreatureType.AMBIENT, Biomes.FOREST);
	}

}

 

Main Class (Please ignore debugs)

package com.Demonly;

import java.io.IOException;

import com.Demonly.animals.AnimalRegistry;
import com.Demonly.animals.entity.EntityDeer;
import com.Demonly.proxy.ClientProxy;
import com.Demonly.proxy.CommonProxy;

import net.ilexiconn.llibrary.client.model.tabula.TabulaModel;
import net.ilexiconn.llibrary.client.model.tabula.TabulaModelHandler;
import net.ilexiconn.llibrary.client.model.tabula.container.TabulaModelContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.init.Blocks;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.EntityRegistry;

@Mod(dependencies = "required-after:llibrary@[1.7.7,)", modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)
public class Deerly {
	
	AnimalRegistry animals = new AnimalRegistry();

	@Instance
	public static Deerly instance;

	@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
	public static CommonProxy proxy;

	@EventHandler
    public void preInit(FMLPreInitializationEvent event) throws IOException {
		
		TabulaModelContainer container = TabulaModelHandler.INSTANCE.loadTabulaModel("assets/deerly/Deer1.tbl");
		
		System.out.println("TEST123: " + container.getAuthor());
		
		int redColor = (255 << 16);
		int orangeColor = (255 << 16)+ (200 << 8);
        System.out.println("Deerly Starting");
		EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID, "Deer1"), EntityDeer.class, "Deer", 1, this, 50, 1, true, redColor, orangeColor);
        animals.initCommon();
    }

	@EventHandler
	public void init(FMLInitializationEvent event) {
		animals.initCommon();
		
		ClientProxy cproxy = new ClientProxy();
		cproxy.RegisterRenders();
	}

	@EventHandler
	public void postInit(FMLPostInitializationEvent event) {
		animals.initCommon();
	}
}

 

I feel as if I am doing something wrong inside of the ClientProxy class for how you register the entity, as I am not used to the new format, I am used to the old format.

As of right now, the Entity spawns where it should, it has all the correct properties, however it's not getting the actual "Model Shape" that it should.

The main class as a bit of testing, and it does indeed call the correct .getAuthor() inside of logs.

 

Any and all help would be nice, thanks

Edited by Demonly
Posted (edited)

Your RenderDeer class is empty. There's nothing there.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
2 minutes ago, Draco18s said:

Your RenderDeer class is empty. There's nothing there.

What do you mean? I am sorry, a tad bit confused.

 

Nvmd u retracted this.

Edited by Demonly
Posted

Yeah, my eyes missed the model it loads.

That said, you're using Tabula Models and I have no idea how those are supposed to work.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Well, are you getting an error in the log?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
18 minutes ago, Differentiation said:

 

 

Out of the whole problem here, but why register it THREE times? o_O

 

Honestly, was old code that I was trying to clean up. :(

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.