General Question - Has the modding process for adding new items changed in 1.4? I have a template downloaded from 1.3.2 that i use and i get errors about the creative tabs...
General Question - Has the modding process for adding new items changed in 1.4? I have a template downloaded from 1.3.2 that i use and i get errors about the creative tabs...
package net.minecraft.src;
import java.util.Random;
public class mod_*** extends BaseMod
{
public static final Block NAMEHERE = new BlockNAME(160, 0).setStepSound(Block.soundStoneFootstep).setBlockName("NAME").setHardness(4.5F).setResistance(5F).setLightValue(0.0F);
public void load()
{
NAME.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "DIRECTORYHERE");
ModLoader.registerBlock(NAME);
ModLoader.addName(NAME, "IGN NAME");
}
public String getVersion()
{
return "1.3.2";
}
}
Item Template
// Goes under public class mod_*** extends BaseMod
public static final Item NAMEHERE = new ItemNAMEHERE(ITEM ID).setItemName("NAMEHERE");
// Goes in public void load()
NAMEHERE.iconIndex = ModLoader.addOverride("/gui/items.png", "PATH HERE");
ModLoader.addName(NAMEHERE, "IGN NAME");
NAMEHERE.setTabToDisplayOn(CreativeTabs.tabMaterials);
Block Template
package net.minecraft.src;
import java.util.Random;
public class BlockNAME extends Block
{
public BlockNAME(int par1, int par2)
{
super(par1, par2, Material.rock);
this.setCreativeTab(CreativeTabs.tabBlock);
}
public int quantityDropped(int par1)
{
return (1);
}
public int idDropped(int par1, Random par2Random, int par3)
{
return mod_NAME.BLOCKNAME.shiftedIndex;
}
}
I am no longer using the item template since i worked a way around adding a simple item. But the one problem i have is when after i add the modloader and block templates. After filling them out, I recompile with no errors but when I test the client, it crashes with the error, "Modloader failed to initialize" The Modloader version is 1.4.4 but MCP says that the client version is 1.4.5. Would that make a huge difference? Also here is the crash report from testing the client...
---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3
Time: 11/18/12 9:01 PM
Description: ModLoader has failed to initialize.
java.lang.ArrayIndexOutOfBoundsException: 4000
at net.minecraft.src.ModLoader.initStats(ModLoader.java:1010)
at net.minecraft.src.ModLoader.init(ModLoader.java:983)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:190)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:92)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:421)
at net.minecraft.client.Minecraft.run(Minecraft.java:741)
at java.lang.Thread.run(Thread.java:722)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.4.4
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_09, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 963632320 bytes (918 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xms1024M -Xmx1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: Start[net.minecraft.src.IPlayerUsage, MinecraftFakeLauncher, ThreadShutdown, ...]
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
ModLoader: Mods loaded: 2
ModLoader 1.4.4
mod_AdobeMod 1.4.5
What do you mean by this? The code I used is common for adding blocks. Eclipse gives me no errors and neither does recompiling. Here is the code I wrote for it.
Here is the block code
package net.minecraft.src;
import java.util.Random;
public class BlockMudBlock extends Block
{
public BlockMudBlock(int par1, int par2)
{
super(par1, par2, Material.ground);
this.setCreativeTab(CreativeTabs.tabBlock);
}
public int quantityDropped(int par1)
{
return (1);
}
public int idDropped(int par1, Random par2Random, int par3)
{
return mod_AdobeMod.mudBlock.blockID;
}
}
And the general modloader mod code
package net.minecraft.src;
import java.util.Random;
public class mod_AdobeMod extends BaseMod
{
public static final Block mudBlock = new BlockMudBlock(4000, 0).setStepSound(Block.soundSandFootstep).setBlockName("mudBlock").setHardness(0.5F).setResistance(1F).setLightValue(0.0F);
public void load()
{
mudBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MudBlock.png");
ModLoader.registerBlock(mudBlock);
ModLoader.addName(mudBlock, "Mud");
}
public String getVersion()
{
return "1.4.5";
}
}
Any ideas why modloader would crash like that? I havent seen this happen when installing downloaded mods, only mods I have made.
NOTE: I forgot to mention that I am new to modding and this is my first time, I have used a youtube tutorial for this code formatting. which was posted just before 1.4 was released
ADDITION: if the formatting looks off, its because of the forum formatting...
I also have another crash report after I updated mcp, modloader, and my client.
---- Minecraft Crash Report ----
// I'm sorry, Dave.
Time: 11/20/12 6:23 PM
Description: ModLoader has failed to initialize.
java.lang.ArrayIndexOutOfBoundsException: 4000
at net.minecraft.src.ModLoader.initStats(ModLoader.java:1010)
at net.minecraft.src.ModLoader.init(ModLoader.java:983)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:190)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:92)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:421)
at net.minecraft.client.Minecraft.run(Minecraft.java:741)
at java.lang.Thread.run(Thread.java:722)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.4.5
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_09, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 958046776 bytes (913 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xms1024M -Xmx1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: Start[net.minecraft.src.IPlayerUsage, MinecraftFakeLauncher, ThreadShutdown, ...]
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
ModLoader: Mods loaded: 2
ModLoader 1.4.5
mod_AdobeMod 1.4.5
Does this mean that my item id is too high where it talks about it being an array index out of bounds exception?
I'm adding a new mob, an evil snowman, that will attack players with snowballs. I'm getting no errors with any of my files except the entity file for my mob. Here's the code.
package net.minecraft.src;
import java.util.Random;
public class EntityEvilSnowman extends EntityGolem implements IRangedAttackMob
{
public EntityEvilSnowman(World world)
{
super(world);
texture = "/items/EvilSnowman.png";
this.setSize(0.4F, 1.8F);
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(1, new EntityAIArrowAttack(this, 0.25F, 20, 10.0F));
this.tasks.addTask(2, new EntityAIWander(this, 0.2F));
this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.tasks.addTask(4, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityLiving.class, 16.0F, 0, true, false, IMob.mobSelector));
}
public boolean isAIEnabled()
{
return true;
}
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
super.writeEntityToNBT(nbttagcompound); // this saves the mob to disk
}
public void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
super.readEntityFromNBT(nbttagcompound); // this loads the mob from disk
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
return "mob.pig";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.cow";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.cowhurt";
}
/**
* Returns the volume for the sounds this mob makes.
*/
protected float getSoundVolume()
{
return 0.4F;
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return Item.snowball.shiftedIndex;
}
@Override
public int getMaxHealth() {
// TODO Auto-generated method stub
return 10;
}
}
I copied the tasks of a snow golem and changed it so that it would attack a player. The errors I'm getting are at the, "public class EntityEvilSnowman". The error is, "The type EntityEvilSnowman must implement the inherited abstract method EntityAgeable.func_90011_a(EntityAgeable)". Can someone explain to me what this error means and any possible solutions? I haven't changed the sounds yet so dont freak out on me cuz my snowman may sound like a pig/cow thing.
EDIT: Nevermind guys i fixed it! I had to do a complete code overhaul since apparantly the code template I was using was for 1.2.5. I guess I really need to check those things, thanks though.
Hey,
can you please post your template here?
Thanks
Modloader Template
Item Template
Block Template
I am no longer using the item template since i worked a way around adding a simple item. But the one problem i have is when after i add the modloader and block templates. After filling them out, I recompile with no errors but when I test the client, it crashes with the error, "Modloader failed to initialize" The Modloader version is 1.4.4 but MCP says that the client version is 1.4.5. Would that make a huge difference? Also here is the crash report from testing the client...
Thanks so much,
GoldDog58
What do you mean by this? The code I used is common for adding blocks. Eclipse gives me no errors and neither does recompiling. Here is the code I wrote for it.
Here is the block code
And the general modloader mod code
Any ideas why modloader would crash like that? I havent seen this happen when installing downloaded mods, only mods I have made.
NOTE: I forgot to mention that I am new to modding and this is my first time, I have used a youtube tutorial for this code formatting. which was posted just before 1.4 was released
ADDITION: if the formatting looks off, its because of the forum formatting...
I also have another crash report after I updated mcp, modloader, and my client.
Does this mean that my item id is too high where it talks about it being an array index out of bounds exception?
Thanks
That should work, be sure to add the onRightClick method.
Yeah
I'll try to write one up today/tomorrow.
Thanks
I'm adding a new mob, an evil snowman, that will attack players with snowballs. I'm getting no errors with any of my files except the entity file for my mob. Here's the code.
I copied the tasks of a snow golem and changed it so that it would attack a player. The errors I'm getting are at the, "public class EntityEvilSnowman". The error is, "The type EntityEvilSnowman must implement the inherited abstract method EntityAgeable.func_90011_a(EntityAgeable)". Can someone explain to me what this error means and any possible solutions? I haven't changed the sounds yet so dont freak out on me cuz my snowman may sound like a pig/cow thing.
EDIT: Nevermind guys i fixed it! I had to do a complete code overhaul since apparantly the code template I was using was for 1.2.5. I guess I really need to check those things, thanks though.
I was about to help, and then I saw your edit xD
Well, I hoped this help. Good luck with your mod
How would I add that onRightClick Method?
It wasn't directed to you, the onRightClick is for something to interact with a right-click, like throwing a potion.
Oh ok. But can you tell me my problem here. I have the code it a seperate java file but its not making the drinking animation.
CODE:
If so, it should work. If not, try doing that.