Can someone help me, I'm Materials for some Swords I'd like to add to the game. But I want to add the Materials without adding them to the EnumToolMaterial.class, so I made my own version called EnumToolEsc hoping that would make it so it would work. If anyone knows how to add new Materials using ModLoader could you please tell me? Anyways heres my code and the file names if anyone can help me I'd really appreciate it.
mod_Esc
package net.minecraft.src;
public class mod_Esc extends BaseMod
{
public static EnumToolEsc Draconian;
public static final Item DraconianSword = new ItemDraconianSword(5000, Draconian).setItemName("DraconianSword");
public void load()
{
DraconianSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/gui/Draconian.png");
ModLoader.addName(DraconianSword, "In-Game Name Here");
ModLoader.addRecipe(new ItemStack(DraconianSword, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.3";
}
}
ItemDraconianSword
package net.minecraft.src;
public class ItemDraconianSword extends Item
{
private int weaponDamage;
private final EnumToolEsc toolMaterial;
public ItemDraconianSword(int par1, EnumToolEsc par2EnumToolEsc)
{
super(par1);
this.toolMaterial = par2EnumToolEsc;
this.maxStackSize = 1;
this.setMaxDamage(par2EnumToolEsc.getMaxUses());
this.setTabToDisplayOn(CreativeTabs.tabCombat);
this.weaponDamage = 4 + par2EnumToolEsc.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID == Block.web.blockID ? 15.0F : 1.5F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean func_77660_a(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)
{
if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
{
par1ItemStack.damageItem(2, par7EntityLiving);
}
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return this.weaponDamage;
}
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.block;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
/**
* 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)
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
return par1Block.blockID == Block.web.blockID;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return this.toolMaterial.getEnchantability();
}
public String func_77825_f()
{
return this.toolMaterial.toString();
}
}
EnumToolEsc
package net.minecraft.src;
public enum EnumToolEsc
{
Draconian(3, 7500, 8.0F, 5, 15);
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
private final int harvestLevel;
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
private final int maxUses;
/**
* The strength of this tool material against blocks which it is effective against.
*/
private final float efficiencyOnProperMaterial;
/** Damage versus entities. */
private final int damageVsEntity;
/** Defines the natural enchantability factor of the material. */
private final int enchantability;
private EnumToolEsc(int par3, int par4, float par5, int par6, int par7)
{
this.harvestLevel = par3;
this.maxUses = par4;
this.efficiencyOnProperMaterial = par5;
this.damageVsEntity = par6;
this.enchantability = par7;
}
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
public int getMaxUses()
{
return this.maxUses;
}
/**
* The strength of this tool material against blocks which it is effective against.
*/
public float getEfficiencyOnProperMaterial()
{
return this.efficiencyOnProperMaterial;
}
/**
* Damage versus entities.
*/
public int getDamageVsEntity()
{
return this.damageVsEntity;
}
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
public int getHarvestLevel()
{
return this.harvestLevel;
}
/**
* Return the natural enchantability factor of the material.
*/
public int getEnchantability()
{
return this.enchantability;
}
}
Eclipse shows all the code to be working perfectly fine, but when I go to run my client it will crash and give me this Error, and I can't Figure out what it means, I would really appreciate some help someone please?
---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3
Time: 8/6/12 7:46 PM
Description: Exception occured in ModLoader
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:353)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1344)
at net.minecraft.src.ModLoader.init(ModLoader.java:919)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:161)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:86)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:404)
at net.minecraft.client.Minecraft.run(Minecraft.java:724)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
at net.minecraft.src.ItemDraconianSword.<init>(ItemDraconianSword.java:13)
at net.minecraft.src.mod_Esc.<clinit>(mod_Esc.java:6)
... 15 more
Relevant Details:
- Minecraft Version: 1.3.1
- Operating System: Windows 7 (amd64) version 6.1
- Java Version: 1.7.0_03, Oracle Corporation
- Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
- Memory: 955764424 bytes (911 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
- JVM Flags: 3 total; -Xincgc -Xms1024M -Xmx1024M
- ModLoader: Mods loaded: 1
ModLoader 1.3.1
Can someone help me, I'm Materials for some Swords I'd like to add to the game. But I want to add the Materials without adding them to the EnumToolMaterial.class, so I made my own version called EnumToolEsc hoping that would make it so it would work. If anyone knows how to add new Materials using ModLoader could you please tell me? Anyways heres my code and the file names if anyone can help me I'd really appreciate it.
mod_Esc
package net.minecraft.src;
public class mod_Esc extends BaseMod
{
public static EnumToolEsc Draconian;
public static final Item DraconianSword = new ItemDraconianSword(5000, Draconian).setItemName("DraconianSword");
public void load()
{
DraconianSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/gui/Draconian.png");
ModLoader.addName(DraconianSword, "In-Game Name Here");
ModLoader.addRecipe(new ItemStack(DraconianSword, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.3";
}
}
ItemDraconianSword
package net.minecraft.src;
public class ItemDraconianSword extends Item
{
private int weaponDamage;
private final EnumToolEsc toolMaterial;
public ItemDraconianSword(int par1, EnumToolEsc par2EnumToolEsc)
{
super(par1);
this.toolMaterial = par2EnumToolEsc;
this.maxStackSize = 1;
this.setMaxDamage(par2EnumToolEsc.getMaxUses());
this.setTabToDisplayOn(CreativeTabs.tabCombat);
this.weaponDamage = 4 + par2EnumToolEsc.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID == Block.web.blockID ? 15.0F : 1.5F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean func_77660_a(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)
{
if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
{
par1ItemStack.damageItem(2, par7EntityLiving);
}
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return this.weaponDamage;
}
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.block;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
/**
* 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)
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
return par1Block.blockID == Block.web.blockID;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return this.toolMaterial.getEnchantability();
}
public String func_77825_f()
{
return this.toolMaterial.toString();
}
}
EnumToolEsc
package net.minecraft.src;
public enum EnumToolEsc
{
Draconian(3, 7500, 8.0F, 5, 15);
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
private final int harvestLevel;
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
private final int maxUses;
/**
* The strength of this tool material against blocks which it is effective against.
*/
private final float efficiencyOnProperMaterial;
/** Damage versus entities. */
private final int damageVsEntity;
/** Defines the natural enchantability factor of the material. */
private final int enchantability;
private EnumToolEsc(int par3, int par4, float par5, int par6, int par7)
{
this.harvestLevel = par3;
this.maxUses = par4;
this.efficiencyOnProperMaterial = par5;
this.damageVsEntity = par6;
this.enchantability = par7;
}
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
public int getMaxUses()
{
return this.maxUses;
}
/**
* The strength of this tool material against blocks which it is effective against.
*/
public float getEfficiencyOnProperMaterial()
{
return this.efficiencyOnProperMaterial;
}
/**
* Damage versus entities.
*/
public int getDamageVsEntity()
{
return this.damageVsEntity;
}
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
public int getHarvestLevel()
{
return this.harvestLevel;
}
/**
* Return the natural enchantability factor of the material.
*/
public int getEnchantability()
{
return this.enchantability;
}
}
Eclipse shows all the code to be working perfectly fine, but when I go to run my client it will crash and give me this Error, and I can't Figure out what it means, I would really appreciate some help someone please?
---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3
Time: 8/6/12 7:46 PM
Description: Exception occured in ModLoader
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:353)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1344)
at net.minecraft.src.ModLoader.init(ModLoader.java:919)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:161)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:86)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:404)
at net.minecraft.client.Minecraft.run(Minecraft.java:724)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
at net.minecraft.src.ItemDraconianSword.<init>(ItemDraconianSword.java:13)
at net.minecraft.src.mod_Esc.<clinit>(mod_Esc.java:6)
... 15 more
Relevant Details:
- Minecraft Version: 1.3.1
- Operating System: Windows 7 (amd64) version 6.1
- Java Version: 1.7.0_03, Oracle Corporation
- Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
- Memory: 955764424 bytes (911 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
- JVM Flags: 3 total; -Xincgc -Xms1024M -Xmx1024M
- ModLoader: Mods loaded: 1
ModLoader 1.3.1
im not sure, but i think you have to make EnumToolEsc extend EnumToolMaterial.
When rightclick on grass/dirt it happens nothing.
Is the code for an working hoe or just for an hoe?
Same with the Sword. I cant Block.
and the Weapons dont get damage.
Pls Help
Hoe:
package net.minecraft.src;
public class ItemCoHoe extends Item
{
public ItemCoHoe(int par1, EnumCoToolMaterial par2EnumCoToolMaterial)
{
super(par1);
maxStackSize = 1;
setMaxDamage(par2EnumCoToolMaterial.getMaxUses());
}
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
int j = par3World.getBlockId(par4, par5 + 1, par6);
if (par7 != 0 && j == 0 && i == Block.grass.blockID || i == Block.dirt.blockID)
{
Block block = Block.tilledField;
par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (par3World.isRemote)
{
return true;
}
else
{
par3World.setBlockWithNotify(par4, par5, par6, block.blockID);
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}
else
{
return false;
}
}
public boolean isFull3D()
{
return true;
}
}
Sword:
package net.minecraft.src;
public class ItemCoSword extends Item
{
private int weaponDamage;
private final EnumCoToolMaterial toolMaterial;
public ItemCoSword(int par1, EnumCoToolMaterial par2EnumCoToolMaterial)
{
super(par1);
toolMaterial = par2EnumCoToolMaterial;
maxStackSize = 1;
setMaxDamage(par2EnumCoToolMaterial.getMaxUses());
weaponDamage = 10 + par2EnumCoToolMaterial.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID != Block.web.blockID ? 1.5F : 15F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(2, par6EntityLiving);
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return weaponDamage;
}
}
There was probably a change in the 1.3.1 update I didn't see when updating. I should have a fix uploaded within 12 hours.
Can someone help me, I'm Materials for some Swords I'd like to add to the game. But I want to add the Materials without adding them to the EnumToolMaterial.class, so I made my own version called EnumToolEsc hoping that would make it so it would work. If anyone knows how to add new Materials using ModLoader could you please tell me? Anyways heres my code and the file names if anyone can help me I'd really appreciate it.
mod_Esc
package net.minecraft.src;
public class mod_Esc extends BaseMod
{
public static EnumToolEsc Draconian;
public static final Item DraconianSword = new ItemDraconianSword(5000, Draconian).setItemName("DraconianSword");
public void load()
{
DraconianSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/gui/Draconian.png");
ModLoader.addName(DraconianSword, "In-Game Name Here");
ModLoader.addRecipe(new ItemStack(DraconianSword, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.3";
}
}
ItemDraconianSword
package net.minecraft.src;
public class ItemDraconianSword extends Item
{
private int weaponDamage;
private final EnumToolEsc toolMaterial;
public ItemDraconianSword(int par1, EnumToolEsc par2EnumToolEsc)
{
super(par1);
this.toolMaterial = par2EnumToolEsc;
this.maxStackSize = 1;
this.setMaxDamage(par2EnumToolEsc.getMaxUses());
this.setTabToDisplayOn(CreativeTabs.tabCombat);
this.weaponDamage = 4 + par2EnumToolEsc.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID == Block.web.blockID ? 15.0F : 1.5F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean func_77660_a(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)
{
if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
{
par1ItemStack.damageItem(2, par7EntityLiving);
}
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return this.weaponDamage;
}
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.block;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
/**
* 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)
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
return par1Block.blockID == Block.web.blockID;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return this.toolMaterial.getEnchantability();
}
public String func_77825_f()
{
return this.toolMaterial.toString();
}
}
EnumToolEsc
package net.minecraft.src;
public enum EnumToolEsc
{
Draconian(3, 7500, 8.0F, 5, 15);
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
private final int harvestLevel;
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
private final int maxUses;
/**
* The strength of this tool material against blocks which it is effective against.
*/
private final float efficiencyOnProperMaterial;
/** Damage versus entities. */
private final int damageVsEntity;
/** Defines the natural enchantability factor of the material. */
private final int enchantability;
private EnumToolEsc(int par3, int par4, float par5, int par6, int par7)
{
this.harvestLevel = par3;
this.maxUses = par4;
this.efficiencyOnProperMaterial = par5;
this.damageVsEntity = par6;
this.enchantability = par7;
}
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
public int getMaxUses()
{
return this.maxUses;
}
/**
* The strength of this tool material against blocks which it is effective against.
*/
public float getEfficiencyOnProperMaterial()
{
return this.efficiencyOnProperMaterial;
}
/**
* Damage versus entities.
*/
public int getDamageVsEntity()
{
return this.damageVsEntity;
}
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
public int getHarvestLevel()
{
return this.harvestLevel;
}
/**
* Return the natural enchantability factor of the material.
*/
public int getEnchantability()
{
return this.enchantability;
}
}
Eclipse shows all the code to be working perfectly fine, but when I go to run my client it will crash and give me this Error, and I can't Figure out what it means, I would really appreciate some help someone please?
---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3
Time: 8/6/12 7:46 PM
Description: Exception occured in ModLoader
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:353)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1344)
at net.minecraft.src.ModLoader.init(ModLoader.java:919)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:161)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:86)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:404)
at net.minecraft.client.Minecraft.run(Minecraft.java:724)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
at net.minecraft.src.ItemDraconianSword.<init>(ItemDraconianSword.java:13)
at net.minecraft.src.mod_Esc.<clinit>(mod_Esc.java:6)
... 15 more
Relevant Details:
- Minecraft Version: 1.3.1
- Operating System: Windows 7 (amd64) version 6.1
- Java Version: 1.7.0_03, Oracle Corporation
- Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
- Memory: 955764424 bytes (911 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
- JVM Flags: 3 total; -Xincgc -Xms1024M -Xmx1024M
- ModLoader: Mods loaded: 1
ModLoader 1.3.1
You need to set the material inside the Enum. Do it like this instead:
public static final Item DraconianSword = new ItemDraconianSword(5000, EnumToolEsc.Draconian).setItemName("DraconianSword");
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
When rightclick on grass/dirt it happens nothing.
Is the code for an working hoe or just for an hoe?
Same with the Sword. I cant Block.
and the Weapons dont get damage.
Pls Help
Hoe:
package net.minecraft.src;
public class ItemCoHoe extends Item
{
public ItemCoHoe(int par1, EnumCoToolMaterial par2EnumCoToolMaterial)
{
super(par1);
maxStackSize = 1;
setMaxDamage(par2EnumCoToolMaterial.getMaxUses());
}
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
int j = par3World.getBlockId(par4, par5 + 1, par6);
if (par7 != 0 && j == 0 && i == Block.grass.blockID || i == Block.dirt.blockID)
{
Block block = Block.tilledField;
par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (par3World.isRemote)
{
return true;
}
else
{
par3World.setBlockWithNotify(par4, par5, par6, block.blockID);
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}
else
{
return false;
}
}
public boolean isFull3D()
{
return true;
}
}
Sword:
package net.minecraft.src;
public class ItemCoSword extends Item
{
private int weaponDamage;
private final EnumCoToolMaterial toolMaterial;
public ItemCoSword(int par1, EnumCoToolMaterial par2EnumCoToolMaterial)
{
super(par1);
toolMaterial = par2EnumCoToolMaterial;
maxStackSize = 1;
setMaxDamage(par2EnumCoToolMaterial.getMaxUses());
weaponDamage = 10 + par2EnumCoToolMaterial.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID != Block.web.blockID ? 1.5F : 15F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(2, par6EntityLiving);
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return weaponDamage;
}
}
You have to update your tool classes (ItemwhateverAxe, etc.) with the updated code and change it as needed (copy/paste and change as you see fit). I had the problem you're having but that solved my problem. The new 1.3.1 tool code is actually a lot smaller.
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
Thank you guys for the help ! it seems to work perfectly now ^-^
Edit: Uhm... so I made the sword, and now when i try to hold it it crashes and gives me this error.
Im still using the same code, but changed what TechGuy said for me to change. This error seems to be something wrong with the rendering.
*Note* Okay, so it will crash my game when im in FirstPerson, but when im in 3rd person... the sword will litterally look like im holding a bunch of entities that rapidly change in my hand... O_o
Heres a Screenshot
You have to update your tool classes (ItemwhateverAxe, etc.) with the updated code and change it as needed (copy/paste and change as you see fit). I had the problem you're having but that solved my problem. The new 1.3.1 tool code is actually a lot smaller.
In ItemTool, ItemAxe, ItemPickaxe, ItemSword, ItemHoe, and ItemSpade. You would copy and paste the code from those files into yours respectively (i.e. ItemAxe goes in your ItemAxe file).
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
In ItemTool, ItemAxe, ItemPickaxe, ItemSword, ItemHoe, and ItemSpade. You would copy and paste the code from those files into yours respectively (i.e. ItemAxe goes in your ItemAxe file).
Swords works
Damage works
Hoe works not
I updated all my Codes with the new one.
Rightclick and damage doesn't work for the hoe.
package net.minecraft.src;
public class ItemCoHoe extends Item
{
public ItemCoHoe(int par1, EnumCoToolMaterial par2EnumCoToolMaterial)
{
super(par1);
maxStackSize = 1;
setMaxDamage(par2EnumCoToolMaterial.getMaxUses());
}
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
int j = par3World.getBlockId(par4, par5 + 1, par6);
if (par7 != 0 && j == 0 && i == Block.grass.blockID || i == Block.dirt.blockID)
{
Block block = Block.tilledField;
par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (par3World.isRemote)
{
return true;
}
else
{
par3World.setBlockWithNotify(par4, par5, par6, block.blockID);
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}
else
{
return false;
}
}
public boolean isFull3D()
{
return true;
}
}
And when i want to make a Bow, i can just copy the ItemBow code and change it?
Hey techguy, I was wondering how I could make some Items appear in different places in the Inventory menu (creative)
I'm wondering how because most items dont appear there. Thanks
Hey techguy, I was wondering how I could make some Items appear in different places in the Inventory menu (creative)
I'm wondering how because most items dont appear there. Thanks
There are two ways to do this. One is to add .setTabToDisplayOn(CreativeTabs.tabName) at the end of your item declaration, the other is more complex but can come in handy if multiple items are an instance of the same class.
package net.minecraft.src;
public class ItemCoHoe extends Item
{
public ItemCoHoe(int par1, EnumCoToolMaterial par2EnumCoToolMaterial)
{
super(par1);
maxStackSize = 1;
setMaxDamage(par2EnumCoToolMaterial.getMaxUses());
}
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
int j = par3World.getBlockId(par4, par5 + 1, par6);
if (par7 != 0 && j == 0 && i == Block.grass.blockID || i == Block.dirt.blockID)
{
Block block = Block.tilledField;
par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (par3World.isRemote)
{
return true;
}
else
{
par3World.setBlockWithNotify(par4, par5, par6, block.blockID);
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}
else
{
return false;
}
}
public boolean isFull3D()
{
return true;
}
}
And when i want to make a Bow, i can just copy the ItemBow code and change it?
It's not that simple, no...
But try making your hoe class extend ItemHoe, then change the super line to
super(par1, EnumToolMaterial.EMERALD);
The EnumToolMaterial.EMERALD section doesn't do anything except makes it possible to extend ItemHoe.
If that doesn't work, tell me and I'll try something else.
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
Thanks, but i already tried that and it did'nt work. Ingame, nothing is generated. The generated code does not take blockid's like expected. I don't know how it all works.
My structure is actually not that big, so i could do it without the help of such programs, but it has a bunch of stair blocks, and they all face the incorrect direction, My question is how to set the correct direction for them.
You are trying to make stairs generate in your structure, yes? What you will want to do is use some code like this (from techguys tutorial):
Then you just change the 1 at the end, and it will generate your stair in one of the eight different ways (east, west, north, south, upside down east, upside down west, upside down north, and upside down south (not necessarily in that order)) so you will have to play with it till you get it right, and remember: Everytime that you change your design in your WorldGenNamehere class, or the density of it in the generateSurface method in mod_, you need to create a new world to see it.
It's not that simple, no...
But try making your hoe class extend ItemHoe, then change the super line to
super(par1, EnumToolMaterial.EMERALD);
The EnumToolMaterial.EMERALD section doesn't do anything except makes it possible to extend ItemHoe.
If that doesn't work, tell me and I'll try something else.
If you bothered to read the red bold text on my post with about 10 replies on it near the top of page 185, you would see that I am working on a fix for it.
I tinkered around a bit, and I have a half solution.
Get rid of super in
super.getCollidingBoundingBoxes
for every single time it has that
The only problem is that you can't walk up them, and they are quite glitchy. But other than that, they work!
Can someone help me? D: For some reason my new ores won't generate in the world. I thought it might have something to do with one thing or another being outdated so I deleted everything and reinstalled all of it fresh. I tried everything again, and still it won't generate! T_T Could somebody please help me?
TTL;DR New ores won't generate. Tried everything. Need Help.
Codes are below
mod_CrystalOre
package net.minecraft.src;
import java.util.Random;
public class mod_CrystalOre extends BaseMod
{
public static final Block crystalore = new Block(160, 0, Material.wood).setBlockName("crystalore").setHardness(3F).setResistance(10F).setLightValue(0.25F);
public void load()
{
crystalore.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/crystalore.png");
ModLoader.registerBlock(crystalore);
ModLoader.addName(crystalore, "Crystal Ore");
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 7; i++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(crystalore.blockID, 25)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
public String getVersion()
{
return "1.3.1";
}
}
BlockCrystalOre
package net.minecraft.src;
import java.util.Random;
public class BlockCrystalOre extends Block
{
public BlockCrystalOre(int i, int j)
{
super(i, j, Material.wood);
}
public int idDropped(int i, Random random, int j)
{
return mod_CrystalOre.crystalore.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
Try this.
public void generateSurface(World world, Random random, int i, int j)
{
for(int k = 0; k < 7; k++)
{
int randPosX = i + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = j + random.nextInt(16);
(new WorldGenMinable(crystalore.blockID, 3)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
@b0mbshellAntics, got an error code, just added about 7 achievements... it wouldnt be that would it??
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader init
FINE: ModLoader 1.2.5 Initializing...
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader readFromClassPath
FINER: Adding mods from C:\Users\Theo\Desktop\mcp\src\minecraft
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader readFromClassPath
FINER: Directory found.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRHelmet.png,38). 84 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRChest.png,102). 83 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRPants.png,118). 82 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRBoots.png,119). 81 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addMod
FINE: Failed to load mod from "mod_Spot.class"
Aug 06, 2012 9:20:19 PM ModLoader addMod
FINER: THROW
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:287)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1279)
at net.minecraft.src.ModLoader.init(ModLoader.java:849)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.(RenderManager.java:85)
at net.minecraft.src.RenderManager.(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
at net.minecraft.src.ItemStack.(ItemStack.java:43)
at net.minecraft.src.Achievement.(Achievement.java:46)
at net.minecraft.src.mod_Spot.(mod_Spot.java:31)
... 15 more
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addAllRenderers
FINE: Initialized
Post your code.
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
mod_Esc
package net.minecraft.src; public class mod_Esc extends BaseMod { public static EnumToolEsc Draconian; public static final Item DraconianSword = new ItemDraconianSword(5000, Draconian).setItemName("DraconianSword"); public void load() { DraconianSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/gui/Draconian.png"); ModLoader.addName(DraconianSword, "In-Game Name Here"); ModLoader.addRecipe(new ItemStack(DraconianSword, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt}); } public String getVersion() { return "1.3"; } }ItemDraconianSword
package net.minecraft.src; public class ItemDraconianSword extends Item { private int weaponDamage; private final EnumToolEsc toolMaterial; public ItemDraconianSword(int par1, EnumToolEsc par2EnumToolEsc) { super(par1); this.toolMaterial = par2EnumToolEsc; this.maxStackSize = 1; this.setMaxDamage(par2EnumToolEsc.getMaxUses()); this.setTabToDisplayOn(CreativeTabs.tabCombat); this.weaponDamage = 4 + par2EnumToolEsc.getDamageVsEntity(); } /** * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if * sword */ public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) { return par2Block.blockID == Block.web.blockID ? 15.0F : 1.5F; } /** * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise * the damage on the stack. */ public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par1ItemStack.damageItem(1, par3EntityLiving); return true; } public boolean func_77660_a(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving) { if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D) { par1ItemStack.damageItem(2, par7EntityLiving); } return true; } /** * Returns the damage against a given entity. */ public int getDamageVsEntity(Entity par1Entity) { return this.weaponDamage; } /** * Returns True is the item is renderer in full 3D when hold. */ public boolean isFull3D() { return true; } /** * returns the action that specifies what animation to play when the items is being used */ public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; } /** * How long it takes to use or consume an item */ public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 72000; } /** * 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) { par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); return par1ItemStack; } /** * Returns if the item (tool) can harvest results from the block type. */ public boolean canHarvestBlock(Block par1Block) { return par1Block.blockID == Block.web.blockID; } /** * Return the enchantability factor of the item, most of the time is based on material. */ public int getItemEnchantability() { return this.toolMaterial.getEnchantability(); } public String func_77825_f() { return this.toolMaterial.toString(); } }EnumToolEsc
package net.minecraft.src; public enum EnumToolEsc { Draconian(3, 7500, 8.0F, 5, 15); /** * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD) */ private final int harvestLevel; /** * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32) */ private final int maxUses; /** * The strength of this tool material against blocks which it is effective against. */ private final float efficiencyOnProperMaterial; /** Damage versus entities. */ private final int damageVsEntity; /** Defines the natural enchantability factor of the material. */ private final int enchantability; private EnumToolEsc(int par3, int par4, float par5, int par6, int par7) { this.harvestLevel = par3; this.maxUses = par4; this.efficiencyOnProperMaterial = par5; this.damageVsEntity = par6; this.enchantability = par7; } /** * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32) */ public int getMaxUses() { return this.maxUses; } /** * The strength of this tool material against blocks which it is effective against. */ public float getEfficiencyOnProperMaterial() { return this.efficiencyOnProperMaterial; } /** * Damage versus entities. */ public int getDamageVsEntity() { return this.damageVsEntity; } /** * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD) */ public int getHarvestLevel() { return this.harvestLevel; } /** * Return the natural enchantability factor of the material. */ public int getEnchantability() { return this.enchantability; } }Eclipse shows all the code to be working perfectly fine, but when I go to run my client it will crash and give me this Error, and I can't Figure out what it means, I would really appreciate some help someone please?
im not sure, but i think you have to make EnumToolEsc extend EnumToolMaterial.
Yes. I am going to be making more tutorials in about a week. Explosives will be second on my list after GUIs.
There was probably a change in the 1.3.1 update I didn't see when updating. I should have a fix uploaded within 12 hours.
You need to set the material inside the Enum. Do it like this instead:
public static final Item DraconianSword = new ItemDraconianSword(5000, EnumToolEsc.Draconian).setItemName("DraconianSword");together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Retired StaffYou have to update your tool classes (ItemwhateverAxe, etc.) with the updated code and change it as needed (copy/paste and change as you see fit). I had the problem you're having but that solved my problem. The new 1.3.1 tool code is actually a lot smaller.
Edit: Uhm... so I made the sword, and now when i try to hold it it crashes and gives me this error.
Im still using the same code, but changed what TechGuy said for me to change. This error seems to be something wrong with the rendering.
*Note* Okay, so it will crash my game when im in FirstPerson, but when im in 3rd person... the sword will litterally look like im holding a bunch of entities that rapidly change in my hand... O_o
Heres a Screenshot
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumWhere can i find the updated code?
-
View User Profile
-
View Posts
-
Send Message
Retired StaffIn ItemTool, ItemAxe, ItemPickaxe, ItemSword, ItemHoe, and ItemSpade. You would copy and paste the code from those files into yours respectively (i.e. ItemAxe goes in your ItemAxe file).
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumSwords works
Damage works
Hoe works not
I updated all my Codes with the new one.
Rightclick and damage doesn't work for the hoe.
package net.minecraft.src; public class ItemCoHoe extends Item { public ItemCoHoe(int par1, EnumCoToolMaterial par2EnumCoToolMaterial) { super(par1); maxStackSize = 1; setMaxDamage(par2EnumCoToolMaterial.getMaxUses()); } public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7) { if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6)) { return false; } int i = par3World.getBlockId(par4, par5, par6); int j = par3World.getBlockId(par4, par5 + 1, par6); if (par7 != 0 && j == 0 && i == Block.grass.blockID || i == Block.dirt.blockID) { Block block = Block.tilledField; par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); if (par3World.isRemote) { return true; } else { par3World.setBlockWithNotify(par4, par5, par6, block.blockID); par1ItemStack.damageItem(1, par2EntityPlayer); return true; } } else { return false; } } public boolean isFull3D() { return true; } }And when i want to make a Bow, i can just copy the ItemBow code and change it?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumModLoader.addRecipe(new ItemStack(NetherBar, 1), <--- try this
ModLoader.addRecipe(new ItemStack(NetherBar.shiftedIndex, 1), <--- Without the .shiftIndex
it should work because, i use it too.
I'm wondering how because most items dont appear there. Thanks
-
View User Profile
-
View Posts
-
Send Message
Retired StaffThere are two ways to do this. One is to add .setTabToDisplayOn(CreativeTabs.tabName) at the end of your item declaration, the other is more complex but can come in handy if multiple items are an instance of the same class.
It's not that simple, no...
But try making your hoe class extend ItemHoe, then change the super line to
super(par1, EnumToolMaterial.EMERALD);
The EnumToolMaterial.EMERALD section doesn't do anything except makes it possible to extend ItemHoe.
If that doesn't work, tell me and I'll try something else.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou are trying to make stairs generate in your structure, yes? What you will want to do is use some code like this (from techguys tutorial):
Then you just change the 1 at the end, and it will generate your stair in one of the eight different ways (east, west, north, south, upside down east, upside down west, upside down north, and upside down south (not necessarily in that order)) so you will have to play with it till you get it right, and remember: Everytime that you change your design in your WorldGenNamehere class, or the density of it in the generateSurface method in mod_, you need to create a new world to see it.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumIt works thx
I tinkered around a bit, and I have a half solution.
Get rid of super in
for every single time it has that
The only problem is that you can't walk up them, and they are quite glitchy. But other than that, they work!
I lied. Decompiling didn't work. So I still need help after all! Anyone?
-
View User Profile
-
View Posts
-
Send Message
Retired StaffTry this.
public void generateSurface(World world, Random random, int i, int j) { for(int k = 0; k < 7; k++) { int randPosX = i + random.nextInt(16); int randPosY = random.nextInt(128); int randPosZ = j + random.nextInt(16); (new WorldGenMinable(crystalore.blockID, 3)).generate(world, random, randPosX, randPosY, randPosZ); } }Please make a tutorial on creating armor
-
View User Profile
-
View Posts
-
Send Message
Retired StaffPost your code.