Jump to content

[1.7.2][Solved] Render Not Being Registered


TLHPoE

Recommended Posts

I've had this problem before, but I cannot find the old post in my history. :(

 

Yesterday my entities were rendering perfectly, but now they don't render at all. None of the methods in the render class are called except for the constructor, which leads me to believe that the renders are not being registered properly.

 

ClientProxy:

package legions;

import java.io.File;

import legions.entity.EntityArcherL;
import legions.entity.EntityInfantryL;
import legions.entity.EntityTroopLeaderL;
import legions.handler.ClientFMLEventHandlerL;
import legions.handler.ClientForgeEventHandlerL;
import legions.handler.KeyHandlerL;
import legions.network.PacketCommandL;
import legions.render.RenderHumanL;
import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.client.registry.RenderingRegistry;

public class ClientProxyL extends ServerProxyL {
public static Configuration config;
public static ClientFMLEventHandlerL fmlEvents;
public static ClientForgeEventHandlerL forgeEvents;
public static KeyHandlerL keyHandler;

@Override
public void initClient() {
	config = new Configuration(new File("./config/Legions/Client.cfg"), true);
	config.load();
	addKeys();
	loadConfigurations();
	addEvents();
	addRenders();
	config.save();
}

public void loadConfigurations() {
	shouldSlide = config.get("Gui", "Enable Sliding Menu", true).getBoolean(true);
}

public void addKeys() {
	keyHandler = new KeyHandlerL();
}

public void addEvents() {
	fmlEvents = new ClientFMLEventHandlerL();
	forgeEvents = new ClientForgeEventHandlerL();
}

public void addRenders() {
	for(int i = 0; i < 1000; i++) {
		System.err.println("ADDING RENDERS");
	}
	RenderingRegistry.registerEntityRenderingHandler(EntityInfantryL.class, new RenderHumanL());
	RenderingRegistry.registerEntityRenderingHandler(EntityArcherL.class, new RenderHumanL());
	RenderingRegistry.registerEntityRenderingHandler(EntityTroopLeaderL.class, new RenderHumanL());
}

public static boolean shouldSlide;
public static int currentMenu = 0;
public static int guiY = -64;
public static PacketCommandL commandPacket;
}

 

Entity (I have 3 more entities that are virtually the same):

package legions.entity;

import legions.TroopL;
import legions.UtilL;
import net.minecraft.entity.EntityLiving;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class EntityInfantryL extends EntityLiving {
public int type;
public boolean hired = false;

public EntityInfantryL(World world) {
	super(world);
	this.setDead();
}

public EntityInfantryL(World world, int type) {
	super(world);
	this.type = type;
	this.setSize(0.6F, 1.8F);
}

@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
	super.writeEntityToNBT(nbt);
	nbt.setInteger("Type", type);
}

@Override
protected boolean canDespawn() {
	return false;
}

@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
	super.readEntityFromNBT(nbt);
	type = nbt.getInteger("Type");
}

public void giveEquipment() {
	switch(type) {
	case (TroopL.BASIC_INFANTRY_1):
		this.setCurrentItemOrArmor(0, new ItemStack(Items.wooden_sword));
		break;
	case (TroopL.BASIC_INFANTRY_2):
		this.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword));
		this.setCurrentItemOrArmor(4, new ItemStack(Items.golden_helmet));
		this.setCurrentItemOrArmor(3, new ItemStack(Items.golden_chestplate));
		this.setCurrentItemOrArmor(2, new ItemStack(Items.golden_leggings));
		this.setCurrentItemOrArmor(1, new ItemStack(Items.golden_boots));
		break;
	case (TroopL.BASIC_INFANTRY_3):
		this.setCurrentItemOrArmor(0, new ItemStack(Items.iron_sword));
		this.setCurrentItemOrArmor(4, new ItemStack(Items.iron_helmet));
		this.setCurrentItemOrArmor(3, new ItemStack(Items.iron_chestplate));
		this.setCurrentItemOrArmor(2, new ItemStack(Items.iron_leggings));
		this.setCurrentItemOrArmor(1, new ItemStack(Items.iron_boots));
		break;
	case (TroopL.BASIC_INFANTRY_4):
		this.setCurrentItemOrArmor(0, new ItemStack(Items.diamond_sword));
		this.setCurrentItemOrArmor(4, new ItemStack(Items.diamond_helmet));
		this.setCurrentItemOrArmor(3, new ItemStack(Items.diamond_chestplate));
		this.setCurrentItemOrArmor(2, new ItemStack(Items.diamond_leggings));
		this.setCurrentItemOrArmor(1, new ItemStack(Items.diamond_boots));
		break;
	}
}

public static EntityInfantryL spawnInfantry(World world, int type, double x, double y, double z) {
	EntityInfantryL e = new EntityInfantryL(world, type);
	e.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
	e.rotationYawHead = e.rotationYaw;
	e.renderYawOffset = e.rotationYaw;
	world.spawnEntityInWorld(e);
	e.giveEquipment();
	return e;
}

public static EntityInfantryL spawnRandomInfantry(World world, double x, double y, double z) {
	EntityInfantryL e = new EntityInfantryL(world, UtilL.getRandomIntegerBetween(0, 3));
	System.err.println("SPAWNED INFANTRY WITH TYPE " + e.type);
	e.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
	e.rotationYawHead = e.rotationYaw;
	e.renderYawOffset = e.rotationYaw;
	world.spawnEntityInWorld(e);
	e.giveEquipment();
	return e;
}
}

 

Render:

package legions.render;

import legions.UtilL;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;

public class RenderHumanL extends RenderBiped {
private static final float SCALE = 0.9375F;
private static final ResourceLocation TEXTURE = UtilL.newResource("textures/entity/human.png");

public RenderHumanL() {
	super(new ModelBiped(), 0.5F);
}

@Override
public void doRender(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) {
	System.err.println("RENDER");
	super.doRender(par1EntityLiving, par2, par4, par6, par8, par9);
}

@Override
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) {
	System.err.println("SCALE");
	GL11.glScalef(SCALE, SCALE, SCALE);
}

@Override
protected ResourceLocation getEntityTexture(Entity par1Entity) {
	System.err.println("TEXTURE");
	return TEXTURE;
}
}

 

ServerProxy:

package legions;

import java.io.File;

import legions.entity.EntityArcherL;
import legions.entity.EntityInfantryL;
import legions.entity.EntityTroopLeaderL;
import legions.handler.ServerForgeEventHandlerL;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.common.registry.EntityRegistry;

public class ServerProxyL {
public static Configuration config;
public static ServerForgeEventHandlerL forgeEvents;

public void initServer() {
	config = new Configuration(new File("./config/Legions/Server.cfg"), true);
	config.load();
	addEvents();
	addEntities();
	config.save();
}

public void addEvents() {
	forgeEvents = new ServerForgeEventHandlerL();
}

public void addEntities() {
	addEntity(EntityInfantryL.class, "infantry");
	addEntity(EntityArcherL.class, "archer");
	addEntity(EntityTroopLeaderL.class, "leader");
}

public void initClient() {
}

private static void addEntity(Class<? extends Entity> clazz, String name) {
	EntityRegistry.registerModEntity(clazz, name, EntityRegistry.findGlobalUniqueEntityId(), Legions.instance, 64, 20, true);
}
}

 

I have prints in the render class (not the constructor) and before I register the renders. The only prints that fire are the ones before I register the renders.

Kain

Link to comment
Share on other sites

Why do you init the renderers inside the config.load() and config.save(), seems stupid.

 

@Override
public void initClient() {
	config = new Configuration(new File("./config/Legions/Client.cfg"), true);
	config.load();
                loadConfigurations();
                config.save();

	addKeys();	
	addEvents();
	addRenders();

}

 

That would make more sense for me. I dont know if that affects the renderers, tell me if it does, other wise I will look through your code more carefully.

Link to comment
Share on other sites

As I've been a modder since a long time ago I know perfectly well what configs are, but why are you putting your entity codes within the config.load and save? It shouldn't be there except if you were to add config stuff there!

Link to comment
Share on other sites

I know how configurations work, but I don't know why I saved after loading everything else...

 

I changed it, but nothing has changed.

 

ServerProxy:

package legions;

import java.io.File;

import legions.entity.EntityArcherL;
import legions.entity.EntityInfantryL;
import legions.entity.EntityTroopLeaderL;
import legions.handler.ServerForgeEventHandlerL;
import net.minecraft.entity.Entity;
import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.common.registry.EntityRegistry;

public class ServerProxyL {
public static Configuration config;
public static ServerForgeEventHandlerL forgeEvents;

public void initServer() {
	loadConfigurations();
	addEvents();
	addEntities();
}

public void loadConfigurations() {
	config = new Configuration(new File("./config/Legions/Server.cfg"), true);
	config.load();
	config.save();
}

public void addEvents() {
	forgeEvents = new ServerForgeEventHandlerL();
}

public void addEntities() {
	addEntity(EntityInfantryL.class, "infantry");
	addEntity(EntityArcherL.class, "archer");
	addEntity(EntityTroopLeaderL.class, "leader");
}

public void initClient() {
}

private static void addEntity(Class<? extends Entity> clazz, String name) {
	EntityRegistry.registerModEntity(clazz, name, EntityRegistry.findGlobalUniqueEntityId(), Legions.instance, 64, 20, true);
}
}

 

ClientProxy:

package legions;

import java.io.File;

import legions.entity.EntityArcherL;
import legions.entity.EntityInfantryL;
import legions.entity.EntityTroopLeaderL;
import legions.handler.ClientFMLEventHandlerL;
import legions.handler.ClientForgeEventHandlerL;
import legions.handler.KeyHandlerL;
import legions.network.PacketCommandL;
import legions.render.RenderHumanL;
import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.client.registry.RenderingRegistry;

public class ClientProxyL extends ServerProxyL {
public static Configuration config;
public static ClientFMLEventHandlerL fmlEvents;
public static ClientForgeEventHandlerL forgeEvents;
public static KeyHandlerL keyHandler;

@Override
public void initClient() {
	loadConfigurations();
	addKeys();
	addEvents();
	addRenders();
}

public void loadConfigurations() {
	config = new Configuration(new File("./config/Legions/Client.cfg"), true);
	config.load();
	shouldSlide = config.get("Gui", "Enable Sliding Menu", true).getBoolean(true);
	config.save();
}

public void addKeys() {
	keyHandler = new KeyHandlerL();
}

public void addEvents() {
	fmlEvents = new ClientFMLEventHandlerL();
	forgeEvents = new ClientForgeEventHandlerL();
}

public void addRenders() {
	RenderingRegistry.registerEntityRenderingHandler(EntityInfantryL.class, new RenderHumanL());
	RenderingRegistry.registerEntityRenderingHandler(EntityArcherL.class, new RenderHumanL());
	RenderingRegistry.registerEntityRenderingHandler(EntityTroopLeaderL.class, new RenderHumanL());
}

public static boolean shouldSlide;
public static int currentMenu = 0;
public static int guiY = -64;
public static PacketCommandL commandPacket;
}

Kain

Link to comment
Share on other sites

If I remember correctly, you are suppose to leave the methods in your server proxy "blank."

They set the things you want in the method in the client proxy - in other words, delete the things inside the methods in ServerProxyL.

 

One more thing, let me see your main class after you fixed those things.

Link to comment
Share on other sites

I'm pretty sure I'm not suppose to cram everything into my client proxy. I did that with the same outcome.

 

 

Here's my main class:

package legions;

import static legions.ReferenceL.ID;
import static legions.ReferenceL.NAME;
import static legions.ReferenceL.VERSION;
import legions.handler.PacketHandlerL;
import legions.network.PacketCommandL;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = ID, name = NAME, version = VERSION)
public class Legions {
@Instance(ID)
public static Legions instance;
@SidedProxy(clientSide = ID + ".ClientProxyL", serverSide = ID + ".ServerProxyL")
public static ServerProxyL proxy;
public static PacketHandlerL packetHandler;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	proxy.initServer();
	proxy.initClient();
}

@EventHandler
public void init(FMLInitializationEvent event) {
	packetHandler = new PacketHandlerL();
	packetHandler.initialise();
}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
	packetHandler.registerPacket(PacketCommandL.class);
	packetHandler.postInitialise();
}
}

Kain

Link to comment
Share on other sites

Ok, everything is being called right. I tried using another method of registering the render, but nothing.

 

public void addRenders() {
	RenderHumanL render = new RenderHumanL();
	render.setRenderManager(RenderManager.instance);
	RenderManager.instance.entityRenderMap.put(EntityInfantryL.class, render);
	RenderManager.instance.entityRenderMap.put(EntityArcherL.class, render);
	RenderManager.instance.entityRenderMap.put(EntityTroopLeaderL.class, render);
}

 

I'm gonna try registering the renders in different intialization events.

 

Edit: Nope

Kain

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Ratuasia77 adalah bocoran slot rekomendasi gacor dari Ratuasia77 yang bisa anda temukan di SLOT Ratuasia77. Situs SLOT Ratuasia77 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ratuasia77 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ratuasia77 merupakan SLOT Ratuasia77 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ratuasia77. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ratuasia77 hari ini yang telah disediakan SLOT Ratuasia77. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ratuasia77 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ratuasia77 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ratuasia77 di link SLOT Ratuasia77.
    • 20 SLOT DEMO GRATIS PRAGMATIC PLAY x500 RUPIAH ANTI LAG & 20 DEMO SLOT MAHJONG WAYS PG SOFT GRATIS ANTI RUNGKAD KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
    • BOCORAN POLA SLOT GACOR MAHJONG WAYS MAXWIN x500 PETIR MERAH HARI INI HINGGA MALAM INI KLIK DISINI DAFTAR SLOT VVIP << KLIK DISINI DAFTAR SLOT VVIP << KLIK DISINI DAFTAR SLOT VVIP << KLIK DISINI DAFTAR SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
    • Museumbola merupakan wadah judi online terkhusus untuk sbobet atau judi bola. Dengan daftar dan deposit menggunakan BANK BCA, Anda berkesempatan mendapatkan prediksi jitu pertandingan secara update setiap hari yang bisa anda jadikan acuan untuk bermain judi bola. Hanya dengan 10 ribu rupiah dan anda bermain Mix Parlay menggunakan prediksi yang telah di sediakan oleh kami, anda akan memenangkan jutaan rupiah. Yuk segera klik DAFTAR sekarang juga.
    • I was just trying to play my modded world when i randomly got this crash for no reason. I sorted through like every mod and eventually I realized it was LLibrary but I can't seem to find a solution to fix the crashing. I can't lose the world that I have that uses this mod please help me. Here's the report: https://pastebin.com/0D00B79i If anyone has a solution please let me know.  
  • Topics

×
×
  • Create New...

Important Information

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