Put it in publicvoid load()//mod code goes in here
{ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< }
Does that help?
Everytime i put the
ModLoader.addName(test8, "Ruby");
anywhere near public void load() even in the brackets anywhere, it gives me more errors
and there is no empty
{
}
for me to put any code in, i am very confused
EDIT
I got everything to work, but the texture for my item is not working
there is nothing in the code you gave me that links to my item texture.
Everytime i put the
ModLoader.addName(test8, "Ruby");
anywhere near public void load() even in the brackets anywhere, it gives me more errors
and there is no empty
{
}
for me to put any code in, i am very confused
EDIT
I got everything to work, but the texture for my item is not working
there is nothing in the code you gave me that links to my item texture.
Did you replace "ruby" in the .setUnlocalizedName("ruby")? and replace it with the name of your image, it has to be a .png file but dont put it in the .setUnlocalizedNAme thing, it automatically does it, after you have your texture open the mcp folder and open the jars folder open bin and then minecraft.jar and put the texture under texture/items and it should work
first of all: great turorials! But I got a huge Problem. The " Advanced Item " tut does not work. Please help me. Here is my code:
mod_maxTest.java
package net.minecraft.src;
import net.minecraft.client.Minecraft;
public class mod_maxTest extends BaseMod {
public String getVersion() {return null;}
public static final Item test = new Item(1037).setCreativeTab(CreativeTabs.tabTools).setUnlocalizedName("test");
public void load() {
// TODO Auto-generated method stub
ModLoader.addName(test, "test");
}
}
ItemTest.java
package net.minecraft.src;[/b]
public class ItemTest extends Item
{
protected ItemExpIngot(int i)
{
super(i);
maxStackSize = 1;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
entityplayer.health = 4;
return itemstack;
}
}
Try this:
public static final Item test = new ItemTest(1037).setCreativeTab(CreativeTabs.tabTools).setUnlocalizedName("test");
HHHHEEEEELLLLLLLPPPPPPPPPPPPPPP!!!!!!!!!!!!!!1
I am trying to make a chocolate cake mod, but for some reason it always CRASHES!!!!!!!
PLEASE HELP ME!!!!!!!!!!!!!!
BlockChocolateCake:
package net.minecraft.src;
import java.util.Random;
public class BlockChocolateCake extends Block
{
private Icon field_94383_a;
private Icon field_94381_b;
private Icon field_94382_c;
protected BlockChocolateCake(int par1)
{
super(par1, Material.cake);
this.setTickRandomly(true);
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
float var6 = 0.0625F;
float var7 = (float)(1 + var5 * 2) / 16.0F;
float var8 = 0.5F;
this.setBlockBounds(var7, 0.0F, var6, 1.0F - var6, var8, 1.0F - var6);
}
/**
* Sets the block's bounds for rendering it as an item
*/
public void setBlockBoundsForItemRender()
{
float var1 = 0.0625F;
float var2 = 0.5F;
this.setBlockBounds(var1, 0.0F, var1, 1.0F - var1, var2, 1.0F - var1);
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
float var6 = 0.0625F;
float var7 = (float)(1 + var5 * 2) / 16.0F;
float var8 = 0.5F;
return AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var7), (double)par3, (double)((float)par4 + var6), (double)((float)(par2 + 1) - var6), (double)((float)par3 + var8 - var6), (double)((float)(par4 + 1) - var6));
}
/**
* Returns the bounding box of the wired rectangular prism to render.
*/
public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
float var6 = 0.0625F;
float var7 = (float)(1 + var5 * 2) / 16.0F;
float var8 = 0.5F;
return AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var7), (double)par3, (double)((float)par4 + var6), (double)((float)(par2 + 1) - var6), (double)((float)par3 + var8), (double)((float)(par4 + 1) - var6));
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{
return par1 == 1 ? this.field_94383_a : (par1 == 0 ? this.field_94381_b : (par2 > 0 && par1 == 4 ? this.field_94382_c : this.blockIcon));
}
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("cake_sideC");
this.field_94382_c = par1IconRegister.registerIcon("cake_innerC");
this.field_94383_a = par1IconRegister.registerIcon("cake_topC");
this.field_94381_b = par1IconRegister.registerIcon("cake_bottomC");
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* Is this block (a) opaque and (B) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
this.eatCakeSlice(par1World, par2, par3, par4, par5EntityPlayer);
return true;
}
/**
* Called when the block is clicked by a player. Args: x, y, z, entityPlayer
*/
public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
{
this.eatCakeSlice(par1World, par2, par3, par4, par5EntityPlayer);
}
/**
* Heals the player and removes a slice from the cake.
*/
private void eatCakeSlice(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
{
if (par5EntityPlayer.canEat(false))
{
par5EntityPlayer.getFoodStats().addStats(3, 0.1F);
int var6 = par1World.getBlockMetadata(par2, par3, par4) + 1;
if (var6 >= 6)
{
par1World.setBlockToAir(par2, par3, par4);
}
else
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2);
}
}
}
/**
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
return !super.canPlaceBlockAt(par1World, par2, par3, par4) ? false : this.canBlockStay(par1World, par2, par3, par4);
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
if (!this.canBlockStay(par1World, par2, par3, par4))
{
par1World.setBlockToAir(par2, par3, par4);
}
}
/**
* Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
*/
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
return par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random par1Random)
{
return 0;
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return 0;
}
/**
* only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
*/
public int idPicked(World par1World, int par2, int par3, int par4)
{
return Item.cake.itemID;
}
}
And here is my mod file
mod_cake:
package net.minecraft.src;
import java.util.Random;
import java.util.List;
public class mod_cake extends BaseMod
{
public static final Block ChocolateCake = new BlockChocolateCake(300).setHardness(0.5F).getIndirectPowerOutput("ChocolateCake").disableStats();
public void load()
{
ModLoader.registerBlock(ChocolateCake);
ModLoader.addName(ChocolateCake, "Chocolate Cake");
ModLoader.addRecipe(new ItemStack(ChocolateCake, 1), new Object [] {"#@#", "$!$", "^^^", Character.valueOf('#'), Item.bucketMilk.itemID, Character.valueOf('$'), Item.sugar.itemID, Character.valueOf('!'), Item.egg.itemID, Character.valueOf('^'), Item.wheat.itemID, Character.valueOf('@'), new ItemStack(Item.dyePowder, 1, 3)});
}
public String getVersion()
{
return "1.5.1";
}
}
Here is my error report:
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; ModLoader has failed to initialize.
A full error report has been saved to C:\Users\hanna\AppData\Roaming\.minecraft\crash-reports\crash-2013-04-17_15.55.32-client.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash
--- BEGIN ERROR REPORT 39ece280 --------
Full report at:
C:\Users\hanna\AppData\Roaming\.minecraft\crash-reports\crash-2013-04-17_15.55.32-client.txt
Please show that file to Mojang, NOT just this screen!
Generated 4/17/13 3:55 PM
-- System Details --
Details:
Minecraft Version: 1.5.1
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_07, Oracle Corporation
Java VM Version: Java HotSpotâ„¢ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 393536480 bytes (375 MB) / 514523136 bytes (490 MB) up to 954466304 bytes (910 MB)
JVM Flags: 2 total; -Xms512m -Xmx1024m
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: ModLoader, EntityRendererProxy, BaseMod, ...]
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
ModLoader: Mods loaded: 2
ModLoader 1.5.1
mod_cake 1.5.1
java.lang.NullPointerException
at yk.a(SourceFile:741)
at ModLoader.addRecipe(ModLoader.java:412)
at mod_cake.load(mod_cake.java:17)
at ModLoader.init(ModLoader.java:742)
at ModLoader.addAllRenderers(ModLoader.java:205)
at bgz.<init>(RenderManager.java:97)
at bgz.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.a(SourceFile:261)
at avv.a(SourceFile:56)
at net.minecraft.client.Minecraft.run(SourceFile:507)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 8ff06396 ----------
HHHHEEEEELLLLLLLPPPPPPPPPPPPPPP!!!!!!!!!!!!!!1
I am trying to make a chocolate cake mod, but for some reason it always CRASHES!!!!!!!
PLEASE HELP ME!!!!!!!!!!!!!!
BlockChocolateCake:
package net.minecraft.src;
import java.util.Random;
public class BlockChocolateCake extends Block
{
private Icon field_94383_a;
private Icon field_94381_b;
private Icon field_94382_c;
protected BlockChocolateCake(int par1)
{
super(par1, Material.cake);
this.setTickRandomly(true);
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
float var6 = 0.0625F;
float var7 = (float)(1 + var5 * 2) / 16.0F;
float var8 = 0.5F;
this.setBlockBounds(var7, 0.0F, var6, 1.0F - var6, var8, 1.0F - var6);
}
/**
* Sets the block's bounds for rendering it as an item
*/
public void setBlockBoundsForItemRender()
{
float var1 = 0.0625F;
float var2 = 0.5F;
this.setBlockBounds(var1, 0.0F, var1, 1.0F - var1, var2, 1.0F - var1);
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
float var6 = 0.0625F;
float var7 = (float)(1 + var5 * 2) / 16.0F;
float var8 = 0.5F;
return AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var7), (double)par3, (double)((float)par4 + var6), (double)((float)(par2 + 1) - var6), (double)((float)par3 + var8 - var6), (double)((float)(par4 + 1) - var6));
}
/**
* Returns the bounding box of the wired rectangular prism to render.
*/
public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
float var6 = 0.0625F;
float var7 = (float)(1 + var5 * 2) / 16.0F;
float var8 = 0.5F;
return AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var7), (double)par3, (double)((float)par4 + var6), (double)((float)(par2 + 1) - var6), (double)((float)par3 + var8), (double)((float)(par4 + 1) - var6));
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{
return par1 == 1 ? this.field_94383_a : (par1 == 0 ? this.field_94381_b : (par2 > 0 && par1 == 4 ? this.field_94382_c : this.blockIcon));
}
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("cake_sideC");
this.field_94382_c = par1IconRegister.registerIcon("cake_innerC");
this.field_94383_a = par1IconRegister.registerIcon("cake_topC");
this.field_94381_b = par1IconRegister.registerIcon("cake_bottomC");
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* Is this block (a) opaque and (B) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
this.eatCakeSlice(par1World, par2, par3, par4, par5EntityPlayer);
return true;
}
/**
* Called when the block is clicked by a player. Args: x, y, z, entityPlayer
*/
public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
{
this.eatCakeSlice(par1World, par2, par3, par4, par5EntityPlayer);
}
/**
* Heals the player and removes a slice from the cake.
*/
private void eatCakeSlice(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
{
if (par5EntityPlayer.canEat(false))
{
par5EntityPlayer.getFoodStats().addStats(3, 0.1F);
int var6 = par1World.getBlockMetadata(par2, par3, par4) + 1;
if (var6 >= 6)
{
par1World.setBlockToAir(par2, par3, par4);
}
else
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2);
}
}
}
/**
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
return !super.canPlaceBlockAt(par1World, par2, par3, par4) ? false : this.canBlockStay(par1World, par2, par3, par4);
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
if (!this.canBlockStay(par1World, par2, par3, par4))
{
par1World.setBlockToAir(par2, par3, par4);
}
}
/**
* Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
*/
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
return par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random par1Random)
{
return 0;
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return 0;
}
/**
* only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
*/
public int idPicked(World par1World, int par2, int par3, int par4)
{
return Item.cake.itemID;
}
}
And here is my mod file
mod_cake:
package net.minecraft.src;
import java.util.Random;
import java.util.List;
public class mod_cake extends BaseMod
{
public static final Block ChocolateCake = new BlockChocolateCake(300).setHardness(0.5F).getIndirectPowerOutput("ChocolateCake").disableStats();
public void load()
{
ModLoader.registerBlock(ChocolateCake);
ModLoader.addName(ChocolateCake, "Chocolate Cake");
ModLoader.addRecipe(new ItemStack(ChocolateCake, 1), new Object [] {"#@#", "$!$", "^^^", Character.valueOf('#'), Item.bucketMilk.itemID, Character.valueOf('$'), Item.sugar.itemID, Character.valueOf('!'), Item.egg.itemID, Character.valueOf('^'), Item.wheat.itemID, Character.valueOf('@'), new ItemStack(Item.dyePowder, 1, 3)});
}
public String getVersion()
{
return "1.5.1";
}
}
Here is my error report:
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; ModLoader has failed to initialize.
A full error report has been saved to C:\Users\hanna\AppData\Roaming\.minecraft\crash-reports\crash-2013-04-17_15.55.32-client.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash
--- BEGIN ERROR REPORT 39ece280 --------
Full report at:
C:\Users\hanna\AppData\Roaming\.minecraft\crash-reports\crash-2013-04-17_15.55.32-client.txt
Please show that file to Mojang, NOT just this screen!
Generated 4/17/13 3:55 PM
-- System Details --
Details:
Minecraft Version: 1.5.1
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_07, Oracle Corporation
Java VM Version: Java HotSpotâ„¢ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 393536480 bytes (375 MB) / 514523136 bytes (490 MB) up to 954466304 bytes (910 MB)
JVM Flags: 2 total; -Xms512m -Xmx1024m
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: ModLoader, EntityRendererProxy, BaseMod, ...]
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
ModLoader: Mods loaded: 2
ModLoader 1.5.1
mod_cake 1.5.1
java.lang.NullPointerException
at yk.a(SourceFile:741)
at ModLoader.addRecipe(ModLoader.java:412)
at mod_cake.load(mod_cake.java:17)
at ModLoader.init(ModLoader.java:742)
at ModLoader.addAllRenderers(ModLoader.java:205)
at bgz.<init>(RenderManager.java:97)
at bgz.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.a(SourceFile:261)
at avv.a(SourceFile:56)
at net.minecraft.client.Minecraft.run(SourceFile:507)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 8ff06396 ----------
THANK YOU AND PLEASE HELP!!!!!!!
In BlockChocolateCake remove the chocolate, it will act like regular cake but it will have ur texture
I mean replace this: public static final Block ChocolateCake = new BlockChocolateCake ( 300 ). setHardness ( 0.5F ). getIndirectPowerOutput ( "ChocolateCake" ). disableStats (); With this: public static final Block ChocolateCake = new BlockCake (300).getIndirectPowerOutput("ChocolateCake");I shud workIt*
what exactly is that saying? I'm still not sure where to put the second line of code :/
Put that last line of code right after public class mod_test extends BaseMod?
public void load()//mod code goes in here
{ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}Does that help?
Everytime i put the
ModLoader.addName(test8, "Ruby");
anywhere near public void load() even in the brackets anywhere, it gives me more errors
and there is no empty
{
}
for me to put any code in, i am very confused
EDIT
I got everything to work, but the texture for my item is not working
there is nothing in the code you gave me that links to my item texture.
Try this:
public static final Item test = new ItemTest(1037).setCreativeTab(CreativeTabs.tabTools).setUnlocalizedName("test");I am trying to make a chocolate cake mod, but for some reason it always CRASHES!!!!!!!
PLEASE HELP ME!!!!!!!!!!!!!!
BlockChocolateCake:
package net.minecraft.src; import java.util.Random; public class BlockChocolateCake extends Block { private Icon field_94383_a; private Icon field_94381_b; private Icon field_94382_c; protected BlockChocolateCake(int par1) { super(par1, Material.cake); this.setTickRandomly(true); } /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); float var6 = 0.0625F; float var7 = (float)(1 + var5 * 2) / 16.0F; float var8 = 0.5F; this.setBlockBounds(var7, 0.0F, var6, 1.0F - var6, var8, 1.0F - var6); } /** * Sets the block's bounds for rendering it as an item */ public void setBlockBoundsForItemRender() { float var1 = 0.0625F; float var2 = 0.5F; this.setBlockBounds(var1, 0.0F, var1, 1.0F - var1, var2, 1.0F - var1); } /** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { int var5 = par1World.getBlockMetadata(par2, par3, par4); float var6 = 0.0625F; float var7 = (float)(1 + var5 * 2) / 16.0F; float var8 = 0.5F; return AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var7), (double)par3, (double)((float)par4 + var6), (double)((float)(par2 + 1) - var6), (double)((float)par3 + var8 - var6), (double)((float)(par4 + 1) - var6)); } /** * Returns the bounding box of the wired rectangular prism to render. */ public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { int var5 = par1World.getBlockMetadata(par2, par3, par4); float var6 = 0.0625F; float var7 = (float)(1 + var5 * 2) / 16.0F; float var8 = 0.5F; return AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var7), (double)par3, (double)((float)par4 + var6), (double)((float)(par2 + 1) - var6), (double)((float)par3 + var8), (double)((float)(par4 + 1) - var6)); } /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata */ public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return par1 == 1 ? this.field_94383_a : (par1 == 0 ? this.field_94381_b : (par2 > 0 && par1 == 4 ? this.field_94382_c : this.blockIcon)); } /** * When this method is called, your block should register all the icons it needs with the given IconRegister. This * is the only chance you get to register icons. */ public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("cake_sideC"); this.field_94382_c = par1IconRegister.registerIcon("cake_innerC"); this.field_94383_a = par1IconRegister.registerIcon("cake_topC"); this.field_94381_b = par1IconRegister.registerIcon("cake_bottomC"); } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } /** * Is this block (a) opaque and (B) a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * Called upon block activation (right click on the block.) */ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { this.eatCakeSlice(par1World, par2, par3, par4, par5EntityPlayer); return true; } /** * Called when the block is clicked by a player. Args: x, y, z, entityPlayer */ public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) { this.eatCakeSlice(par1World, par2, par3, par4, par5EntityPlayer); } /** * Heals the player and removes a slice from the cake. */ private void eatCakeSlice(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) { if (par5EntityPlayer.canEat(false)) { par5EntityPlayer.getFoodStats().addStats(3, 0.1F); int var6 = par1World.getBlockMetadata(par2, par3, par4) + 1; if (var6 >= 6) { par1World.setBlockToAir(par2, par3, par4); } else { par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2); } } } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z */ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { return !super.canPlaceBlockAt(par1World, par2, par3, par4) ? false : this.canBlockStay(par1World, par2, par3, par4); } /** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor blockID */ public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { if (!this.canBlockStay(par1World, par2, par3, par4)) { par1World.setBlockToAir(par2, par3, par4); } } /** * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. */ public boolean canBlockStay(World par1World, int par2, int par3, int par4) { return par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid(); } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random par1Random) { return 0; } /** * Returns the ID of the items to drop on destruction. */ public int idDropped(int par1, Random par2Random, int par3) { return 0; } /** * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) */ public int idPicked(World par1World, int par2, int par3, int par4) { return Item.cake.itemID; } }And here is my mod file
mod_cake:
package net.minecraft.src; import java.util.Random; import java.util.List; public class mod_cake extends BaseMod { public static final Block ChocolateCake = new BlockChocolateCake(300).setHardness(0.5F).getIndirectPowerOutput("ChocolateCake").disableStats(); public void load() { ModLoader.registerBlock(ChocolateCake); ModLoader.addName(ChocolateCake, "Chocolate Cake"); ModLoader.addRecipe(new ItemStack(ChocolateCake, 1), new Object [] {"#@#", "$!$", "^^^", Character.valueOf('#'), Item.bucketMilk.itemID, Character.valueOf('$'), Item.sugar.itemID, Character.valueOf('!'), Item.egg.itemID, Character.valueOf('^'), Item.wheat.itemID, Character.valueOf('@'), new ItemStack(Item.dyePowder, 1, 3)}); } public String getVersion() { return "1.5.1"; } }Here is my error report:
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; ModLoader has failed to initialize.
A full error report has been saved to C:\Users\hanna\AppData\Roaming\.minecraft\crash-reports\crash-2013-04-17_15.55.32-client.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash
--- BEGIN ERROR REPORT 39ece280 --------
Full report at:
C:\Users\hanna\AppData\Roaming\.minecraft\crash-reports\crash-2013-04-17_15.55.32-client.txt
Please show that file to Mojang, NOT just this screen!
Generated 4/17/13 3:55 PM
-- System Details --
Details:
Minecraft Version: 1.5.1
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_07, Oracle Corporation
Java VM Version: Java HotSpotâ„¢ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 393536480 bytes (375 MB) / 514523136 bytes (490 MB) up to 954466304 bytes (910 MB)
JVM Flags: 2 total; -Xms512m -Xmx1024m
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: ModLoader, EntityRendererProxy, BaseMod, ...]
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
ModLoader: Mods loaded: 2
ModLoader 1.5.1
mod_cake 1.5.1
java.lang.NullPointerException
at yk.a(SourceFile:741)
at ModLoader.addRecipe(ModLoader.java:412)
at mod_cake.load(mod_cake.java:17)
at ModLoader.init(ModLoader.java:742)
at ModLoader.addAllRenderers(ModLoader.java:205)
at bgz.<init>(RenderManager.java:97)
at bgz.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.a(SourceFile:261)
at avv.a(SourceFile:56)
at net.minecraft.client.Minecraft.run(SourceFile:507)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 8ff06396 ----------
THANK YOU AND PLEASE HELP!!!!!!!
Did you get this to work on your computer!?!?!?!