Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

  • Author
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

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.

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.

  • Author
1 minute ago, Draco18s said:

Well, are you getting an error in the log?

Nope no errors. :(

1 hour ago, Demonly said:

animals.initCommon();

 

1 hour ago, Demonly said:

animals.initCommon();

 

1 hour ago, Demonly said:

animals.initCommon();

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

  • Author
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. :(

  • Author

I have been able to load the models/textures through the Library.

 

Thank you anyone / everyone for the help ;)

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.