Today I will show you how to make an Item, when you right click it, it will throw a small ball. When that small ball hits a block, it will blow up.
To get our mod to work, we need a mod File! How about: GrenadeMod.java! PERFECT!
Now to start building out initial file with our first methods.
package com.hk.testing.grenademod;
import net.minecraft.item.Item;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(name = "Grenade Mod", modid = GrenadeMod.MODID, version = GrenadeMod.VERSION)
public class GrenadeMod
{
/*
* Necessities- START
*/
public static final String MODID = "grenadeMod";
public static final String VERSION = "1.0";
/*
* Necessities- END
*/
@EventHandler
/**
* This is called when Forge setting up.
*
* @param event the Event
*/
public void preInit(FMLPreInitializationEvent event) {}
@EventHandler
/**
* This is called when Forge is done setting up and ready to initiate mods
*
* @param event the Event
*/
public void init(FMLInitializationEvent event) {}
@EventHandler
/**
* This is called when Forge is done setting up and ready to initiate mods
*
* @param event the Event
*/
public void postInit(FMLPostInitializationEvent event) {}
}
Simple mod file! We will use this as out base of operations!
I will start off with a simple item file: ItemGrenade.java
package com.hk.testing.grenademod;
import com.hk.testing.Main;
import com.hk.testing.entities.EntityEntityOrb;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemGrenade extends Item
{
public ItemGrenade()
{
this.setUnlocalizedName("grenade"); //Sets the name of this item, Has to be unique!
this.setCreativeTab(CreativeTabs.tabCombat); //This Item will be in the Combat Creative Tab!
this.setTextureName(GrenadeMod.MODID + ":" + "grenade"); //The texture for this item is the Grenade!
}
/**
* Render Pass sensitive version of hasEffect()
*/
public boolean hasEffect(ItemStack par1ItemStack, int pass)
{
//This means it will look "special" in the inventory
return true;
}
}
Pretty simple Item class.
To register this newly built item: We have to go to out main file, and make a field like so:
public static Item grenade;
now, in the preInit() method, we will define it:
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
//Initiate the Grenade
grenade = new ItemGrenade();
}
Then! In the init() method, register it:
public void init(FMLInitializationEvent event)
{
GameRegistry.registerItem(grenade, grenade.getUnlocalizedName());
}
If you run the game right now, you will have nothing but an item in the Combat tab! Not very useful is it...
Now we will work on adding the "throwing" ability to the item!
In the ItemGrenade file add an onItemRightClick(…) method:
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
This alone won't do anything explodey! You have to add this in the method
//This if statement is here to check that the Server is working
if (!par2World.isRemote)
{
/* This method in World spawn in an entity,
* You can use with anything that extends
* the Entity class, in this case it's
* the EntityGrenade class
*/
par2World.spawnEntityInWorld(new EntityGrenade(par2World, par3EntityPlayer));
//Decrease an item from the stack because you just used it!
--par1ItemStack.stackSize;
}
Now, if you're in eclipse, you will get an error, No Class like EntityGrenade… We will fix that.
In eclipse, hover over the error and create the class. Make sure it extends EntityThrowable!
Now the class:
The class should have that new baby smell, look. Like this:
package com.hk.testing.grenademod;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.world.World;
public class EntityGrenade extends EntityThrowable
{
/*
* If you're wondering why I have all of
* these constructors for no reason, It's
* used by Forge to use this class, If you
* don't have these, your minecraft is going
* to crash!
*/
public EntityGrenade(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public EntityGrenade(World par1World, EntityLivingBase par2EntityLivingBase)
{
super(par1World, par2EntityLivingBase);
}
public EntityGrenade(World par1World)
{
super(par1World);
}
@Override
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition mop)
{
System.out.println("Entity landed!");
}
}
If you run the game from here, when you right click the entity, it will most probably crash or nothing will happen for a few seconds then you will see "Entity Landed" in the console.
Before we give this entity the ability to suicide bomb for our pleasure, we need to register it too!
Now this might be hard for some of you guys, so I will try to explain it the best I can.
You will have to create two new files! One for the Client and one for the Server. You can do what I did and/or name it what I did, but it will probably look really strange! Here what they should look like:
I named one of my classes GrenadeClient and one GrenadeCommon
The GrenadeCommon should have nothing but this:
package com.hk.testing.grenademod;
public class GrenadeCommon
{
public void registerRenderThings() {}
public void registerSounds() {}
}
But the GrenadeClient should look like this:
package com.hk.testing.grenademod;
import net.minecraft.client.renderer.entity.RenderSnowball;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class GrenadeClient extends GrenadeCommon
{
@Override
public void registerRenderThings()
{
RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(GrenadeMod.grenade));
}
@Override
public void registerSounds() {}
}
If ran from here, nothing different will happen. The next few steps are all in the Main file
Just like everything else in modding, You have to register the proxies (The two new files you created). Here's how you would do that:
Create a new field that's like this:
@SidedProxy(clientSide = "com.hk.testing.grenademod.GrenadeClient", serverSide = "com.hk.testing.proxies.GrenadeCommon")
public static GrenadeCommon proxy;
If you have had a problem with this before, If you're in eclipse, all you need to do is right click on the GrenadeClient file and click "Copy Qualified Name" and then paste in where it says clientSide="[pastehere]"
Don't leave it like that, only where it's up to you're package.
If you copied the qualified name and got some thing like:
"[tons of crap]/src/main/java/com/hk/testing/grenademod/GrenadeClient.java"
Only put from the com forward and replace all the '/' with '.', Also get rid of the .java, like this:
"com.hk.testing.grenademod.GrenadeClient"
Same thing for the GrenadeCommon. Fix the Qualified Name and put that name in serverSide="[pastehere]"
Now if you run it, when you right click with the grenade in your hand, you will see a little grenade fly out and just disappear into the ground. If you copied the "Entity Landed" too. When it hits the floor, you will see that in the console.
HOORAY!
Now onto the Explodey Part! Back to the Entity Class!
Insert this into the onImpact() method of the class:
//If this hit's a block, continue
if(mop.typeOfHit == MovingObjectType.BLOCK)
{
/*
* You might be wondering what
* all these case and break are
* These are use to switch the number
* mop.sideHit
*
* Example:
* If mop.sideHit == 3 whatever is in
* case 3 Happens!
*/
switch(mop.sideHit)
{
case 0: //BOTTOM
mop.blockY--;
break;
case 1: //TOP
mop.blockY++;
break;
case 2: //EAST
mop.blockZ--;
break;
case 3: //WEST
mop.blockZ++;
break;
case 4: //NORTH
mop.blockX--;
break;
case 5: //SOUTH
mop.blockX++;
break;
}
/* This method creates the explosion!
* It uses the entity (Can be null)
* the three coordinates, the strength
* and if it should spawn smoke particles
* around after exploding, the last parameter
* is if it should set neighboring blocks on fire
*/
this.worldObj.newExplosion(this, mop.blockX, mop.blockY, mop.blockZ, 2.0F, true, true);
}
//If the Server is online and works, kill this entity
if (!this.worldObj.isRemote)
{
this.setDead();
}
This creates the explosion on impact and also kills the entity.
So At the end all of you're classes should look like this:
GrenadeMod.java
package com.hk.testing.grenademod;
import net.minecraft.item.Item;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;@Mod(name = "Grenade Mod", modid = GrenadeMod.MODID, version = GrenadeMod.VERSION)
public class GrenadeMod
{
/*
* Necessities- START
*/
@SidedProxy(clientSide = "com.hk.testing.grenademod.GrenadeClient", serverSide = "com.hk.testing.proxies.GrenadeCommon")
public static GrenadeCommon proxy;
public static final String MODID = "grenadeMod";
public static final String VERSION = "1.0";
/*
* Necessities- END
*/
//Define the Item that we will use
public static Item grenade;
@EventHandler
/**
* This is called when Forge setting up.
*
* @param event the Event
*/
public void preInit(FMLPreInitializationEvent event)
{
//Initiate the Grenade
grenade = new ItemGrenade();
}
@EventHandler
/**
* This is called when Forge is done setting up and ready to initiate mods
*
* @param event the Event
*/
public void init(FMLInitializationEvent event)
{
GameRegistry.registerItem(grenade, grenade.getUnlocalizedName());
//Register the given class so Forge can use it
EntityRegistry.registerModEntity(EntityGrenade.class, "Grenade", 4, this, 80, 3, true);
proxy.registerRenderThings();
proxy.registerSounds();
}
@EventHandler
/**
* This is called when Forge is done setting up and ready to initiate mods
*
* @param event the Event
*/
public void postInit(FMLPostInitializationEvent event) {}
}
ItemGrenade.java
package com.hk.testing.grenademod;
import com.hk.testing.Main;
import com.hk.testing.entities.EntityEntityOrb;import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemGrenade extends Item
{
public ItemGrenade()
{
this.setUnlocalizedName("grenade"); //Sets the name of this item, Has to be unique!
this.setCreativeTab(CreativeTabs.tabCombat); //This Item will be in the Combat Creative Tab!
this.setTextureName(GrenadeMod.MODID + ":" + "grenade"); //The texture for this item is the Grenade!
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
//This if statement is here to check that the Server is working
if (!par2World.isRemote)
{
/* This method in World spawn in an entity,
* You can use with anything that extends
* the Entity class, in this case it's
* the EntityGrenade class
*/
par2World.spawnEntityInWorld(new EntityGrenade(par2World, par3EntityPlayer));
//Decrease an item from the stack because you used it!
--par1ItemStack.stackSize;
} return par1ItemStack;
}
/**
* Render Pass sensitive version of hasEffect()
*/
public boolean hasEffect(ItemStack par1ItemStack, int pass)
{
//This means it will look "special" in the inventory
return true;
}
}
EntityGrenade.java
package com.hk.testing.grenademod;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.world.World;public class EntityGrenade extends EntityThrowable
{
/*
* If you're wondering why I have all of
* these constructors for no reason, It's
* used by Forge to use this class, If you
* don't have these, your minecraft is going
* to crash!
*/
public EntityGrenade(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public EntityGrenade(World par1World, EntityLivingBase par2EntityLivingBase)
{
super(par1World, par2EntityLivingBase);
}public EntityGrenade(World par1World)
{
super(par1World);
}
@Override
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition mop)
{
//If this hit's a block, continue
if(mop.typeOfHit == MovingObjectType.BLOCK)
{
/*
* You might be wondering what
* all these case and break are
* These are use to switch the number
* mop.sideHit
*
* Example:
* If mop.sideHit == 3 whatever is in
* case 3 Happens!
*/
switch(mop.sideHit)
{
case 0: //BOTTOM
mop.blockY--;
break;
case 1: //TOP
mop.blockY++;
break;
case 2: //EAST
mop.blockZ--;
break;
case 3: //WEST
mop.blockZ++;
break;
case 4: //NORTH
mop.blockX--;
break;
case 5: //SOUTH
mop.blockX++;
break;
}
/* This method creates the explosion!
* It uses the entity (Can be null)
* the three coordinates, the strength
* and if it should spawn smoke particles
* around after exploding, the last parameter
* is if it should set neighboring blocks on fire
*/
this.worldObj.newExplosion(this, mop.blockX, mop.blockY, mop.blockZ, 2.0F, true, true);
} //If the Server is online and works, kill this entity
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
}
GrenadeCommon.java
package com.hk.testing.grenademod;
public class GrenadeCommon
{
public void registerRenderThings() {}
public void registerSounds() {}
}
GrenadeClient.java
package com.hk.testing.grenademod;
import net.minecraft.client.renderer.entity.RenderSnowball;
import cpw.mods.fml.client.registry.RenderingRegistry;public class GrenadeClient extends GrenadeCommon
{
@Override
public void registerRenderThings()
{
RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(GrenadeMod.grenade));
}
@Override
public void registerSounds() {}
}
If there's anything you missed, check now and fix it, but make sure you understand it!
Now if you run it, when the grenade item is right clicked, you will see a grenade fly out, hit the floor and explode! Also, if you're in survival, you will lose a grenade!
I will leave other things like Crafting Recipes, Textures up to you. Here are some pictures of what should happen:
The Meaning of Life, the Universe, and Everything.
Join Date:
10/9/2012
Posts:
274
Location:
The City of New Townsville
Minecraft:
SyntaxError73
Member Details
YESS, will be using this.
Rollback Post to RevisionRollBack
Now for a limited time you can try Mirkwood for free for a month. Mirkwood is not for everyone, especially children, women who are pregnant, or may become pregnant. Side effects include: nausea, vomiting, loss of bowel control, urges to speak German at random moments, explosive radiation poisoning, mutation, itchy, watery eyes, protein denaturalization, high fever, gooifying, potty-mouth, loss of charisma, and death. You must be 18 or over to be eligible to take Mirkwood. Ask your doctor if Mirkwood is right for you.
Alright, I'm going to have to see some code, please. You might not have registered the Renderer, like I showed. It's alright! I just need to see some code.
Alright, I'm going to have to see some code, please. You might not have registered the Renderer, like I showed. It's alright! I just need to see some code.
i added that to my ClientProxy AKA GrenadeClient and got this error code
[18:47:47] [main/INFO] [GradleStart]: Extra: []
[18:47:47] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --accessToken, {REDACTED}, --assetIndex, 1.7.10, --assetsDir, C:/Users/Celo/.gradle/caches/minecraft/assets, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker]
[18:47:47] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[18:47:47] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[18:47:47] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[18:47:47] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
[18:47:47] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1230 for Minecraft 1.7.10 loading
[18:47:47] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_67, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jre7
[18:47:47] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[18:47:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[18:47:48] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin
[18:47:48] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[18:47:48] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:47:48] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
[18:47:48] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:47:48] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:47:48] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
[18:47:48] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
[18:47:50] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[18:47:50] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
[18:47:50] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
[18:47:51] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker
[18:47:51] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker
[18:47:51] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[18:47:52] [main/INFO]: Setting user: Player187
[18:47:54] [Client thread/INFO]: LWJGL Version: 2.9.1
[18:47:55] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
[18:47:55] [Client thread/INFO] [FML]: MinecraftForge v10.13.2.1230 Initialized
[18:47:55] [Client thread/INFO] [FML]: Replaced 182 ore recipies
[18:47:55] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
[18:47:55] [Client thread/INFO] [FML]: Searching C:\Users\Celo\Desktop\Minecraft Mods\Mod Testing\eclipse\mods for mods
[18:47:58] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
[18:47:59] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, testmod] at CLIENT
[18:47:59] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, testmod] at SERVER
[18:47:59] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Test Mod
[18:47:59] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
[18:47:59] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations
[18:47:59] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[18:47:59] [Client thread/INFO] [FML]: Applying holder lookups
[18:47:59] [Client thread/INFO] [FML]: Holder lookups applied
[18:47:59] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue
[18:47:59] [Client thread/ERROR] [FML]:
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized
Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized
testmod{0.1} [Test Mod] (bin) Unloaded->Constructed->Errored
[18:47:59] [Client thread/ERROR] [FML]: The following problems were captured during this phase
[18:47:59] [Client thread/ERROR] [FML]: Caught exception from testmod
java.lang.NullPointerException
at cpw.mods.fml.common.registry.EntityRegistry.doModEntityRegistration(EntityRegistry.java:164) ~[forgeSrc-1.7.10-10.13.2.1230.jar:?]
at cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityRegistry.java:150) ~[forgeSrc-1.7.10-10.13.2.1230.jar:?]
at com.celo44.main.ClientProxy.registerRenderThings(ClientProxy.java:21) ~[bin/:?]
at com.celo44.main.MainRegistry.PreLoad(MainRegistry.java:28) ~[bin/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forgeSrc-1.7.10-10.13.2.1230.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[forgeSrc-1.7.10-10.13.2.1230.jar:?]
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[forgeSrc-1.7.10-10.13.2.1230.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) [Loader.class:?]
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?]
[18:47:59] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
// Oh - I know what I did wrong!
Time: 12/21/14 6:47 PM
Description: Initializing game
java.lang.NullPointerException: Initializing game
at cpw.mods.fml.common.registry.EntityRegistry.doModEntityRegistration(EntityRegistry.java:164)
at cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityRegistry.java:150)
at com.celo44.main.ClientProxy.registerRenderThings(ClientProxy.java:21)
at com.celo44.main.MainRegistry.PreLoad(MainRegistry.java:28)
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:513)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
at net.minecraft.client.Minecraft.run(Minecraft.java:931)
at net.minecraft.client.main.Main.main(Main.java:164)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at cpw.mods.fml.common.registry.EntityRegistry.doModEntityRegistration(EntityRegistry.java:164)
at cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityRegistry.java:150)
at com.celo44.main.ClientProxy.registerRenderThings(ClientProxy.java:21)
at com.celo44.main.MainRegistry.PreLoad(MainRegistry.java:28)
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:513)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:931)
at net.minecraft.client.main.Main.main(Main.java:164)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.7.0_67, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 926706792 bytes (883 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized
Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized
testmod{0.1} [Test Mod] (bin) Unloaded->Constructed->Errored
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: Intel(R) HD Graphics 2500 GL version 4.0.0 - Build 10.18.10.3262, Intel
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
[18:47:59] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Celo\Desktop\Minecraft Mods\Mod Testing\eclipse\.\crash-reports\crash-2014-12-21_18.47.59-client.txt
However i created another error whic says that the ID is already taken but it says that FOR ANY ID I TRY no matter how big or how small or random the number is
RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(GrenadeMod.grenade));
When I put this in my ClientProxy, it causes an error.
I use a custom Render though, but it's the same as a snowball.
I change my EntityGrenade.class to what my entity is, my own render, and changed GrenadeMod.grenade to Mymod.myitem
It simply causes an error, as it needs 3 items, not just the Item.
However if I leave that line out, it shoots a nice white block.
Hey, very new to modding Minecraft and coding in Java, and for some reason par2World and par3EntityPlayer isn't being resolved to a variable. It also seems to have an issue with the brackets. I took a screenshot so you can see where the errors are here: http://i.imgur.com/u2vo1r3.png
and here's the code for the class that seems to be the offender (main ball/grenade class):
package noahc3.MaterialBlobs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemDirtBlob extends Item
{
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityDirtBlob(par2World, par3EntityPlayer));
--par1ItemStack.stackSize;
}
}
To get our mod to work, we need a mod File! How about: GrenadeMod.java! PERFECT!
Now to start building out initial file with our first methods.
Simple mod file! We will use this as out base of operations!
I will start off with a simple item file: ItemGrenade.java
Pretty simple Item class.
To register this newly built item: We have to go to out main file, and make a field like so:
now, in the preInit() method, we will define it:
Then! In the init() method, register it:
If you run the game right now, you will have nothing but an item in the Combat tab! Not very useful is it...
Now we will work on adding the "throwing" ability to the item!
This alone won't do anything explodey! You have to add this in the method
Now, if you're in eclipse, you will get an error, No Class like EntityGrenade… We will fix that.
In eclipse, hover over the error and create the class. Make sure it extends EntityThrowable!
Now the class:
If you run the game from here, when you right click the entity, it will most probably crash or nothing will happen for a few seconds then you will see "Entity Landed" in the console.
Before we give this entity the ability to suicide bomb for our pleasure, we need to register it too!
Now this might be hard for some of you guys, so I will try to explain it the best I can.
You will have to create two new files! One for the Client and one for the Server. You can do what I did and/or name it what I did, but it will probably look really strange! Here what they should look like:
The GrenadeCommon should have nothing but this:
But the GrenadeClient should look like this:
If ran from here, nothing different will happen. The next few steps are all in the Main file
Just like everything else in modding, You have to register the proxies (The two new files you created). Here's how you would do that:
If you have had a problem with this before, If you're in eclipse, all you need to do is right click on the GrenadeClient file and click "Copy Qualified Name" and then paste in where it says clientSide="[pastehere]"
Don't leave it like that, only where it's up to you're package.
If you copied the qualified name and got some thing like:
"[tons of crap]/src/main/java/com/hk/testing/grenademod/GrenadeClient.java"
Only put from the com forward and replace all the '/' with '.', Also get rid of the .java, like this:
"com.hk.testing.grenademod.GrenadeClient"
Same thing for the GrenadeCommon. Fix the Qualified Name and put that name in serverSide="[pastehere]"
Now in your init() method, put this:
Now if you run it, when you right click with the grenade in your hand, you will see a little grenade fly out and just disappear into the ground. If you copied the "Entity Landed" too. When it hits the floor, you will see that in the console.
Now onto the Explodey Part! Back to the Entity Class!
This creates the explosion on impact and also kills the entity.
So At the end all of you're classes should look like this:
ItemGrenade.java
EntityGrenade.java
GrenadeCommon.java
GrenadeClient.java
If there's anything you missed, check now and fix it, but make sure you understand it!
Now if you run it, when the grenade item is right clicked, you will see a grenade fly out, hit the floor and explode! Also, if you're in survival, you will lose a grenade!
I will leave other things like Crafting Recipes, Textures up to you. Here are some pictures of what should happen:
Hello!
Now for a limited time you can try Mirkwood for free for a month. Mirkwood is not for everyone, especially children, women who are pregnant, or may become pregnant. Side effects include: nausea, vomiting, loss of bowel control, urges to speak German at random moments, explosive radiation poisoning, mutation, itchy, watery eyes, protein denaturalization, high fever, gooifying, potty-mouth, loss of charisma, and death. You must be 18 or over to be eligible to take Mirkwood. Ask your doctor if Mirkwood is right for you.
and only hours later do i realize the title says, "1.7.x"...... O.O
Hello!
Let me know what else you want a tutorial of and I'll try my best to do one about it!
Hello!
Hello!
i have another thread where i posted my code http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2304724-need-help-please-custom-grenade-not-rendering-when#c2
Hello!
i added that to my ClientProxy AKA GrenadeClient and got this error code
[18:47:47] [main/INFO] [GradleStart]: Extra: []
[18:47:47] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --accessToken, {REDACTED}, --assetIndex, 1.7.10, --assetsDir, C:/Users/Celo/.gradle/caches/minecraft/assets, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker]
[18:47:47] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[18:47:47] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[18:47:47] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[18:47:47] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
[18:47:47] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1230 for Minecraft 1.7.10 loading
[18:47:47] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_67, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jre7
[18:47:47] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[18:47:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[18:47:48] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin
[18:47:48] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[18:47:48] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:47:48] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
[18:47:48] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:47:48] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:47:48] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
[18:47:48] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
[18:47:50] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[18:47:50] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
[18:47:50] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
[18:47:51] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker
[18:47:51] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker
[18:47:51] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[18:47:52] [main/INFO]: Setting user: Player187
[18:47:54] [Client thread/INFO]: LWJGL Version: 2.9.1
[18:47:55] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
[18:47:55] [Client thread/INFO] [FML]: MinecraftForge v10.13.2.1230 Initialized
[18:47:55] [Client thread/INFO] [FML]: Replaced 182 ore recipies
[18:47:55] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
[18:47:55] [Client thread/INFO] [FML]: Searching C:\Users\Celo\Desktop\Minecraft Mods\Mod Testing\eclipse\mods for mods
[18:47:58] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
[18:47:59] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, testmod] at CLIENT
[18:47:59] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, testmod] at SERVER
[18:47:59] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Test Mod
[18:47:59] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
[18:47:59] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations
[18:47:59] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[18:47:59] [Client thread/INFO] [FML]: Applying holder lookups
[18:47:59] [Client thread/INFO] [FML]: Holder lookups applied
[18:47:59] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue
[18:47:59] [Client thread/ERROR] [FML]:
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized
Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized
testmod{0.1} [Test Mod] (bin) Unloaded->Constructed->Errored
[18:47:59] [Client thread/ERROR] [FML]: The following problems were captured during this phase
[18:47:59] [Client thread/ERROR] [FML]: Caught exception from testmod
java.lang.NullPointerException
at cpw.mods.fml.common.registry.EntityRegistry.doModEntityRegistration(EntityRegistry.java:164) ~[forgeSrc-1.7.10-10.13.2.1230.jar:?]
at cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityRegistry.java:150) ~[forgeSrc-1.7.10-10.13.2.1230.jar:?]
at com.celo44.main.ClientProxy.registerRenderThings(ClientProxy.java:21) ~[bin/:?]
at com.celo44.main.MainRegistry.PreLoad(MainRegistry.java:28) ~[bin/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forgeSrc-1.7.10-10.13.2.1230.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[forgeSrc-1.7.10-10.13.2.1230.jar:?]
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[forgeSrc-1.7.10-10.13.2.1230.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) [Loader.class:?]
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?]
[18:47:59] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
// Oh - I know what I did wrong!
Time: 12/21/14 6:47 PM
Description: Initializing game
java.lang.NullPointerException: Initializing game
at cpw.mods.fml.common.registry.EntityRegistry.doModEntityRegistration(EntityRegistry.java:164)
at cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityRegistry.java:150)
at com.celo44.main.ClientProxy.registerRenderThings(ClientProxy.java:21)
at com.celo44.main.MainRegistry.PreLoad(MainRegistry.java:28)
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:513)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
at net.minecraft.client.Minecraft.run(Minecraft.java:931)
at net.minecraft.client.main.Main.main(Main.java:164)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at cpw.mods.fml.common.registry.EntityRegistry.doModEntityRegistration(EntityRegistry.java:164)
at cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityRegistry.java:150)
at com.celo44.main.ClientProxy.registerRenderThings(ClientProxy.java:21)
at com.celo44.main.MainRegistry.PreLoad(MainRegistry.java:28)
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:513)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:931)
at net.minecraft.client.main.Main.main(Main.java:164)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.7.0_67, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 926706792 bytes (883 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized
Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized
testmod{0.1} [Test Mod] (bin) Unloaded->Constructed->Errored
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: Intel(R) HD Graphics 2500 GL version 4.0.0 - Build 10.18.10.3262, Intel
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
[18:47:59] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Celo\Desktop\Minecraft Mods\Mod Testing\eclipse\.\crash-reports\crash-2014-12-21_18.47.59-client.txt
EntityRegistry.registerGlobalEntityID(EntityFragGrenade.class, "FGrenade",4096);
However i created another error whic says that the ID is already taken but it says that FOR ANY ID I TRY no matter how big or how small or random the number is
So I've done everything except:
When I put this in my ClientProxy, it causes an error.
I use a custom Render though, but it's the same as a snowball.
I change my EntityGrenade.class to what my entity is, my own render, and changed GrenadeMod.grenade to Mymod.myitem
It simply causes an error, as it needs 3 items, not just the Item.
However if I leave that line out, it shoots a nice white block.
There are a few things I would like from you though. A: May I see the error. B: May I also see your custom rendering class? These are very important.
Hello!
Hello!
Great tut, you're awesome!!! I was looking all over for a throwable entity tut that was up to date
Always blame JRE.
Thanks a lot! No worries! Glad to help! Happy Modding!
Hello!
Hey, very new to modding Minecraft and coding in Java, and for some reason par2World and par3EntityPlayer isn't being resolved to a variable. It also seems to have an issue with the brackets. I took a screenshot so you can see where the errors are here: http://i.imgur.com/u2vo1r3.png
and here's the code for the class that seems to be the offender (main ball/grenade class):
And here's the crash log if that can tell you more info (though I doubt it): http://pastebin.com/Nmxifk6x
Running Forge 1340 MC 1.7.10
I'm not too familiar with how variables work in Java so I can't really help myself. :/