Jump to content

Recommended Posts

Posted

Hi there!

I have a problem when I'm trying to create a custom rendered block and I was wishing for some help.

 

Crash log:

---- Minecraft Crash Report ----
// This doesn't make any sense!

Time: 2014-04-23 01:24
Description: Initializing game

java.lang.NullPointerException
at net.be.mods.model.LampPostModel.<init>(LampPostModel.java:59)
at net.be.mods.renderer.RendererLampPost.<init>(RendererLampPost.java:18)
at net.be.mods.MainModBE.preInit(MainModBE.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:572)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:205)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:109)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:553)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:185)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:472)
at net.minecraft.client.Minecraft.run(Minecraft.java:809)
at net.minecraft.client.main.Main.main(Main.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at net.be.mods.model.LampPostModel.<init>(LampPostModel.java:59)
at net.be.mods.renderer.RendererLampPost.<init>(RendererLampPost.java:18)
at net.be.mods.MainModBE.preInit(MainModBE.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:572)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:205)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:109)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:553)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:185)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:472)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:809)
at net.minecraft.client.main.Main.main(Main.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

-- System Details --
Details:
Minecraft Version: 1.6.4
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 922970696 bytes (880 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v8.11 FML v6.4.49.965 Minecraft Forge 9.11.1.965 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{6.4.49.965} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized
Forge{9.11.1.965} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized
beautifulexistence{Pre-alpha v0.001} [bE mods] (bin) Unloaded->Constructed->Errored
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: AMD Radeon HD 7570 GL version 4.2.11476 Compatibility Profile Context, ATI Technologies Inc.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Pack: Default
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

 

Main Class:

@Mod(modid = MainModBE.modid, name = "BE mods", version = "Pre-alpha v0.001")
@NetworkMod(clientSideRequired = true, serverSideRequired = true)
public class MainModBE {

    public static final String modid = "beautifulexistence";

    @EventHandler
    public void preInit(FMLPreInitializationEvent e) {
    	
    	//Tile Entity
    	
        ClientRegistry.registerTileEntity(TileEntityPostLamp.class, "LampPost", new RendererLampPost());
        
        ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPostLamp.class, new RendererLampPost());

    public static Block blockLampPost;

    @EventHandler
    public void load(FMLInitializationEvent e)
    {

        LanguageRegistry.instance().addStringLocalization(BETab.getTranslatedTabLabel(), "BE Tab");

        blockLampPost = new blockLampPost(3006).setUnlocalizedName("blockLampPost").setHardness(4.0F).setStepSound(Block.soundMetalFootstep).setResistance(15.0F);

        GameRegistry.registerBlock(blockLampPost, modid + blockLampPost.getUnlocalizedName().substring(5));

        LanguageRegistry.addName(blockLampPost, "Lamp Post");

 

blockLampPost:

public class blockLampPost extends BlockContainer{

public blockLampPost(int id) {
	super(id, Material.rock);

	this.setLightValue(1F);
	this.setCreativeTab(MainModBE.BETab);
}

public TileEntity createNewTileEntity(World world) {
	return new TileEntityPostLamp();
}

public int getRenderType() {
	return -1;
}

public boolean isOpaqueCube() {
	return false;
}

public boolean renderAsNormalBlock() {
	return false;
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister icon) {
	this.blockIcon = icon.registerIcon(MainModBE.modid + ":" + "LampPlacer");
}

}

 

LampPostModel:

public class LampPostModel extends ModelBase {

    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape4;
    ModelRenderer Shape5;
    ModelRenderer Shape6;
    ModelRenderer Shape7;
    ModelRenderer Shape8;
  
  public LampPostModel()
  {
    textureWidth = 64;
    textureHeight = 64;
    
      Shape1 = new ModelRenderer(this, 0, 9);
      Shape1.addBox(-1F, -1F, -1F, 2, 2, 2);
      Shape1.setRotationPoint(0F, 23F, 0F);
      Shape1.setTextureSize(64, 64);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape2 = new ModelRenderer(this, 0, 14);
      Shape2.addBox(0F, 0F, 0F, 4, 1, 4);
      Shape2.setRotationPoint(-2F, 21F, -2F);
      Shape2.setTextureSize(64, 64);
      Shape2.mirror = true;
      setRotation(Shape2, 0F, 0F, 0F);
      Shape3 = new ModelRenderer(this, 15, 34);
      Shape3.addBox(0F, -5F, 0F, 1, 5, 1);
      Shape3.setRotationPoint(1F, 21.5F, -2F);
      Shape3.setTextureSize(64, 64);
      Shape3.mirror = true;
      setRotation(Shape3, 0.0872665F, 0F, 0.0872665F);
      Shape4 = new ModelRenderer(this, 10, 34);
      Shape4.addBox(0F, -5F, 0F, 1, 5, 1);
      Shape4.setRotationPoint(1F, 21.5F, 1F);
      Shape4.setTextureSize(64, 64);
      Shape4.mirror = true;
      setRotation(Shape4, -0.0872665F, 0F, 0.0872665F);
      Shape5 = new ModelRenderer(this, 5, 34);
      Shape5.addBox(0F, -5F, 0F, 1, 5, 1);
      Shape5.setRotationPoint(-2F, 21.5F, 1F);
      Shape5.setTextureSize(64, 64);
      Shape5.mirror = true;
      setRotation(Shape5, -0.0872665F, 0F, -0.0872665F);
      Shape6 = new ModelRenderer(this, 0, 34);
      Shape6.addBox(0F, -5F, 0F, 1, 5, 1);
      Shape6.setRotationPoint(-2F, 21.5F, -2F);
      Shape6.setTextureSize(64, 64);
      Shape6.mirror = true;
      setRotation(Shape6, 0.0872665F, 0F, -0.0872665F);
      Shape7.mirror = true;
      Shape7 = new ModelRenderer(this, 0, 20);
      Shape7.addBox(0F, 0F, 0F, 6, 1, 6);
      Shape7.setRotationPoint(-3F, 16F, -3F);
      Shape7.setTextureSize(64, 64);
      Shape7.mirror = true;
      setRotation(Shape7, 0F, 0F, 0F);
      Shape7.mirror = false;
      Shape8 = new ModelRenderer(this, 0, 28);
      Shape8.addBox(0F, 0F, 0F, 4, 1, 4);
      Shape8.setRotationPoint(-2F, 15F, -2F);
      Shape8.setTextureSize(64, 64);
      Shape8.mirror = true;
      setRotation(Shape8, 0F, 0F, 0F);
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
    Shape5.render(f5);
    Shape6.render(f5);
    Shape7.render(f5);
    Shape8.render(f5);
  }
  
  public void renderModel(float f5) {
    Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
    Shape5.render(f5);
    Shape6.render(f5);
    Shape7.render(f5);
    Shape8.render(f5);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z) {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  }
}

 

RenderLampPost:

public class RendererLampPost extends TileEntitySpecialRenderer{

private static final ResourceLocation texture = new ResourceLocation(MainModBE.modid, "textures/model/LampPost.png");

private LampPostModel model;

public RendererLampPost() {
	this.model = new LampPostModel();
}

public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {	

	GL11.glPushMatrix();
	GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
	GL11.glRotatef(180, 0F, 0F, 1F);
	this.bindTexture(texture);
	GL11.glPushMatrix();
	this.model.renderModel(0.0625F);
	GL11.glPopMatrix();
	GL11.glPopMatrix();
}
}

 

I only picked out the most important things and semi relevant stuff in the main class.

I am really stuck :/

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.