Jump to content

Recommended Posts

Posted

I have no errors in eclipse but when I run the game, I keep getting this error:

 

cpw.mods.fml.common.LoaderException: java.lang.NullPointerException
at cpw.mods.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:246)
at cpw.mods.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:220)
at cpw.mods.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:196)
at Falconry.common.Falconry.Init(Falconry.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:485)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:657)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:456)
at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at cpw.mods.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:239)
... 34 more
--- END ERROR REPORT 9e0706f4 ----------

 

Here is my main mod file:

package Falconry.common;

import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.world.biome.BiomeGenBase;
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.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;


@Mod(modid = "SilentAssassin8_Falconry", name = "Falconry", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false, clientPacketHandlerSpec = @SidedPacketHandler(channels = {"Falconry"}, packetHandler = ClientPacketHandler.class), serverPacketHandlerSpec = @SidedPacketHandler(channels = {"Falconry"}, packetHandler = ServerPacketHandler.class))

public class Falconry {

public static Block BlockControlStation;

@Instance
public static Falconry instance = new Falconry();
private GuiHandler guiHandler = new GuiHandler();



@SidedProxy(clientSide = "Falconry.client.ClientProxyFalconry", serverSide = "Falconry.common.CommonProxyFalconry")
public static CommonProxyFalconry proxy;

static int startEntityId = 300;


@Init
public void Init(FMLInitializationEvent event) {

	proxy.registerRenderThings();

	EntityRegistry.registerModEntity(EntityRedTailedHawk.class, "RedTailedHawk", 1, this, 80, 3, true);
	EntityRegistry.addSpawn(EntityRedTailedHawk.class, 10, 2, 3, EnumCreatureType.creature, BiomeGenBase.forest, BiomeGenBase.desert, BiomeGenBase.desertHills);

	GameRegistry.registerTileEntity(TileControlStation.class, "tileEntityControlStation");
	GameRegistry.registerBlock(BlockControlStation, "BlockControlStation");

	LanguageRegistry.instance().addStringLocalization("entity.SilentAssassin8_Falconry.RedTailedHawk.name","Red-Tailed Hawk");
	LanguageRegistry.addName(BlockControlStation, "Control Station");

	NetworkRegistry.instance().registerGuiHandler(this, guiHandler);

	registerEntityEgg(EntityRedTailedHawk.class, 0x000000, 0xEB1313);

	BlockControlStation = new BlockControlStation(9000, 0).setBlockName("BlockControlStation");

}

public static int getUniqueEntityId() {

		do {
			startEntityId++;
		}
		while(EntityList.getStringFromID(startEntityId) != null);

		return startEntityId;
}	
public static void registerEntityEgg(Class<? extends Entity> entity, int primaryColor, int secondaryColor) {
	int id = getUniqueEntityId();
	EntityList.IDtoClassMapping.put(id, entity);
	EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor));	
}
}

 

I know that it has to do something with line 51 < GameRegistry.registerBlock(BlockControlStation, "BlockControlStation"); > but I don't know what to do to fix it. Any help would be greatly appreciated.

Posted

what does it mean my naming a String. How can ı fix it ?

 

Your mistake is in this line:

 

LanguageRegistry.addName("talipBlock", "Talip Block");

 

Where you do

 

"talipBlock"

 

When in quotation marks ("..."), a type is called a String. What you are doing is naming a String. This is not what you should do, which is naming the Object (Block) that you are naming. In this your code should look something like this:

 

LanguageRegistry.addName(talipBlock, "Talip Block");

 

In that code you are making a reference to the

 

public static Block talipBlock;

 

which is what you want to do.

 

 

edit:

Learn java.

 

This is something that is really recommended before you start modding.

mca.png
Posted

what does it mean my naming a String. How can ı fix it ?

 

Your mistake is in this line:

 

LanguageRegistry.addName("talipBlock", "Talip Block");

 

Where you do

 

"talipBlock"

 

When in quotation marks ("..."), a type is called a String. What you are doing is naming a String. This is not what you should do, which is naming the Object (Block) that you are naming. In this your code should look something like this:

 

LanguageRegistry.addName(talipBlock, "Talip Block");

 

In that code you are making a reference to the

 

public static Block talipBlock;

 

which is what you want to do.

 

 

edit:

Learn java.

 

This is something that is really recommended before you start modding.

 

Thanks for your help. I have already started but i new.

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.