Jump to content

TileEntitySpecialRenderer custom block model issues....


Jakemichie97

Recommended Posts

Hello, I have made blocks with custom models before so I do know how to do it, however when I tried to make one earlier when I tried to start the client Minecraft crashed and said  that FML encountered a fatal error while launching. Now since I have access to the EE3 source code (as it's open source now (thanks Pahimar)) I did go through and check whether what I was doing was correct, and from what I can see everything should be working. From my testing, this seems to only happen when the tile entity has it's renderer bound to it. Thanks to whoever is looking, code is below. If you need anything else just ask!

 

 

 

Proxy Classes - Tile Entity and TESR Registration

Client:

 

 

package sorcerycraft.client;

import net.minecraftforge.client.EnumHelperClient;
import net.minecraftforge.client.MinecraftForgeClient;
import sorcerycraft.client.rendering.AlchemicalLecternRenderer;
import sorcerycraft.common.CommonProxy;
import sorcerycraft.common.lib.Rarities;
import sorcerycraft.common.lib.Reference;
import sorcerycraft.common.tileentities.TileEntityAlchemicalLectern;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;

public class ClientProxy extends CommonProxy {
@Override
public void initRendering()
{
	MinecraftForgeClient.preloadTexture(Reference.SPRITE_SHEET_ITEMS);
	MinecraftForgeClient.preloadTexture(Reference.SPRITE_SHET_BLOCKS);
}

@Override
public void initCustomRarities()
{
	EnumHelperClient.addRarity(Rarities.TRANSMUTATIONAL, Rarities.COLOUR_TRANSMUTATIONAL, Rarities.DISPLAY_NAME_TRANSMUTATIONAL);
	EnumHelperClient.addRarity(Rarities.DISCHARGED, Rarities.COLOUR_DISCHARGED, Rarities.DISPLAY_NAME_DISCHARGED);
	EnumHelperClient.addRarity(Rarities.ALCHEMICAL, Rarities.COLOUR_ALCHEMICAL, Rarities.DISPLAY_NAME_ALCHEMICAL);
	EnumHelperClient.addRarity(Rarities.FUEL, Rarities.COLOUR_FUEL, Rarities.DISPLAY_NAME_FUEL);
}

@Override
public void initTileEntities()
{
	super.initTileEntities();

	ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAlchemicalLectern.class, new AlchemicalLecternRenderer());
}
}

 

 

 

Common:

 

 

package sorcerycraft.common;

import sorcerycraft.client.ClientProxy;
import sorcerycraft.common.handlers.CraftingHandler;
import sorcerycraft.common.tileentities.TileEntityAlchemicalLectern;
import cpw.mods.fml.common.registry.GameRegistry;

public class CommonProxy {
public void initRendering() {}

public void initCustomRarities() {}

public void registerCraftingHandler()
{
	GameRegistry.registerCraftingHandler(new CraftingHandler());
}

public void initTileEntities()
{
	GameRegistry.registerTileEntity(TileEntityAlchemicalLectern.class, "tileSCAlchemicalLectern");
}
}

 

 

 

Crash log:

 

 

2012-11-17 17:27:43 [sEVERE] [ForgeModLoader] Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue
2012-11-17 17:27:43 [iNFO] [sTDERR] java.lang.NullPointerException
2012-11-17 17:27:43 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.printModStates(LoadController.java:194)
2012-11-17 17:27:43 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.transition(LoadController.java:96)
2012-11-17 17:27:43 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.initializeMods(Loader.java:652)
2012-11-17 17:27:43 [iNFO] [sTDERR] 	at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:197)
2012-11-17 17:27:43 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.startGame(Minecraft.java:465)
2012-11-17 17:27:43 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:752)
2012-11-17 17:27:43 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)

[/spoiler

Link to comment
Share on other sites

I only just got my TESR to work myself. I made a simple durp mistake that I felt stupid about afterwards lol.

 

can you please with post up your base class that has your @init and @postinit method as it looks like you have something your trying to pass that isn't being set, hence the null pointer exception.

 

I am still new to this myself but I might be able to spot something you are missing.

Neoublie

Author of Codename: Project Shadow

 

if you do models and textures pm me. looking for some assistance.

Link to comment
Share on other sites

 

 

package sorcerycraft.common;

import java.util.logging.Level;

import net.minecraft.src.Achievement;
import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
import net.minecraftforge.common.AchievementPage;
import sorcerycraft.client.CreativeTab;
import sorcerycraft.common.handlers.LogHandler;
import sorcerycraft.common.handlers.PacketHandler;
import sorcerycraft.common.handlers.AlchemyHandler;
import sorcerycraft.common.lib.Packets;
import sorcerycraft.common.lib.Reference;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
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;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.MOD_VERSION, useMetadata = true)

@NetworkMod(clientSideRequired=true, serverSideRequired=false/*, 
channels={ Packets.CHANNEL_CORE, Packets.CHANNEL_MISC }, packetHandler = PacketHandler.class*/)
public class SorceryCraft {
@Instance(Reference.MOD_ID)
public static SorceryCraft instance;

@SidedProxy(clientSide = "sorcerycraft.client.ClientProxy", serverSide = "sorcerycraft.common.CommonProxy")
public static CommonProxy proxy;

public static CreativeTabs tab = new CreativeTab(CreativeTabs.getNextID(), Reference.MOD_ID);

@PreInit
public void preLoad(FMLPreInitializationEvent event)
{
	LogHandler.init(); //Initializes the SorceryCraft logger
	LogHandler.log(Level.INFO, "SorceryCraft v"+Reference.MOD_VERSION+" installed."); //Load message
	LogHandler.log(Level.INFO, "Mod loading has commenced, be patient!"); //Load message

	//Initializes the configuration
	Config.init(event.getSuggestedConfigurationFile());

	//Registers the different classes
	proxy.registerEventHandlers();
	proxy.registerCraftingHandler();

	//Initializes the tile entities
	proxy.initTileEntities();

	//Initializes the client-only stuff for rendering
	proxy.initRendering();
}

@Init
public void load(FMLInitializationEvent event)
{
	//Initializes the custom rarity types
	proxy.initCustomRarities();

	//Loads the items and blocks
	ObjectCentre.loadObjects();

	//Loads the three tiers of transmutation recipes
	AlchemyHandler.loadTierOneRecipes();
	AlchemyHandler.loadTierTwoRecipes();
	AlchemyHandler.loadTierThreeRecipes();

	//Loads the SorceryCraft achievement page and achievements
	loadAchievements();
}

@PostInit
public void postLoad(FMLPostInitializationEvent event)
{
	LogHandler.log(Level.INFO, "Mod has fully loaded"); //Load message
}

/**
 * Add's a localization for the name of the given achievement.
 * 
 * @param ach
 * @param name
 */
private void addAchievementName(String ach, String name)
{
	LanguageRegistry.instance().addStringLocalization("achievement." + ach, "en_US", name);
}

/**
 * Add's a localization for the description of the given achievement.
 * 
 * @param ach
 * @param name
 */
private void addAchievementDesc(String ach, String desc)
{
	LanguageRegistry.instance().addStringLocalization("achievement." + ach + ".desc", "en_US", desc);
}

public void loadAchievements()
{
	/*
	 * Achievement registers
	 */
	warmDust = new Achievement(2001, "DustWarm", 0, 0, ObjectCentre.dustvodric, null).registerAchievement();
	alchObj = new Achievement(2002, "AlchStone", 0, 3, ObjectCentre.alchemystoneneutral, warmDust).registerAchievement();
	trans = new Achievement(2003, "Transmutation", 2, 3, ObjectCentre.parchment, alchObj).setSpecial().registerAchievement();

	/*
	 * Achievement modifying
	 */
	this.addAchievementName("DustWarm", "New Substance!");
	this.addAchievementDesc("DustWarm", "Aquire some Vodric Powder.");

	this.addAchievementName("AlchStone", "Ancient Alchemy!");
	this.addAchievementDesc("AlchStone", "Create your first Neutral Alchemical Stone.");

	this.addAchievementName("Transmutation", "New Skill!");
	this.addAchievementDesc("Transmutation", "Using the Neutral Alchemical Stone perform your first transmutation.");

	/*
	 * Ach' Page
	 */
	scAchPage = new AchievementPage("SorceryCraft", warmDust, alchObj, trans);
	AchievementPage.registerAchievementPage(scAchPage);
}

public static Achievement warmDust;
public static Achievement alchObj;
public static Achievement trans;

public static AchievementPage scAchPage;

public void initTiers()
{
	//Tier 1
	AlchemyHandler.addEntry(Block.cobblestone, AlchemyHandler.tierOne);
	AlchemyHandler.addEntry(Block.stone, AlchemyHandler.tierOne);
	AlchemyHandler.addEntry(Block.dirt, AlchemyHandler.tierOne);
	AlchemyHandler.addEntry(Block.grass, AlchemyHandler.tierOne);

	//Tier 2


	//Tier 3


	//Tier 4

}
}

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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