I would like to make crafting tables that could be specific to chemistry (Making alloys), or for moe high-tech usages (Circuits), or just for bigger crafting tables. It would be more challenging in a mod for someone to have to make a better crafting table before they can craft complex items.
I know it can be done, as they are in several different mods, but I just can't figure out how to make one myself. I know that BlockWorkbench loads the GUI from EntityPlayer, and I am trying to learn how the slots work. Once I have that done, all I need to do is make a new GUI, new slots, and new recipes files for the table. I may also need a tile entity if this is like furnaces, which I have made.
As for chests, I would like chests with more capacity, or, built-in features. (Crafting, smelting, etc.)
So ive had my mod since may 2011 never had ore gen problem till 1.2. Followed your tut. it works a little only 2 of my 16 ores generate I have no problems with my nether generation only the regular world heres the paste bin not sure what im doing wrong
I would like to make crafting tables that could be specific to chemistry (Making alloys), or for moe high-tech usages (Circuits), or just for bigger crafting tables. It would be more challenging in a mod for someone to have to make a better crafting table before they can craft complex items.
I know it can be done, as they are in several different mods, but I just can't figure out how to make one myself. I know that BlockWorkbench loads the GUI from EntityPlayer, and I am trying to learn how the slots work. Once I have that done, all I need to do is make a new GUI, new slots, and new recipes files for the table. I may also need a tile entity if this is like furnaces, which I have made.
As for chests, I would like chests with more capacity, or, built-in features. (Crafting, smelting, etc.)
im not too experienced with guis yet, but when i learn some more i will be sure to make a tutorial on it
When I add one more item on two items I get this error:
Public string out of range.
I repeated everything again but it doesn't work.
Please help
make sure you change the item id's so they are not the same or they are not already occupied and that you change certain stuff that they wont be the same example:
public static final Item Namehere = new Item(30000).setItemName("Namehere");
Change "30000"(itemid) because 2 items cannot occupy the same id.
Also change ("Namehere") "Namhere" to something else, so if one is "magic rod" change the other one to something else!
also make sure you properly define the item!
make sure you change the item id's so they are not the same or they are not already occupied and that you change certain stuff that they wont be the same example:
public static final Item Namehere = new Item(30000).setItemName("Namehere");
Change "30000"(itemid) because 2 items cannot occupy the same id.
Also change ("Namehere") "Namhere" to something else, so if one is "magic rod" change the other one to something else!
also make sure you properly define the item!
My mod only works in eclipse not minecraft itself...
package net.minecraft.src;
import java.util.Random;
public class mod_BasicSword extends BaseMod
{
public static final Item Pinesword = new ItemSword (3000, EnumToolMaterial.Pine).setItemName("damn");
public static final Item Uniquesword = new ItemSword (3001, EnumToolMaterial.Unique).setItemName("poop");
public static final Item Slimesword = new ItemSword (3002, EnumToolMaterial.Slime).setItemName("flar");
public static final Item Endersword = new ItemSword (3003, EnumToolMaterial.Slime).setItemName("fnor");
public void load()
{
Pinesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/BasicSword.png");
ModLoader.addName(Pinesword, "Pine Sword");
ModLoader.addRecipe(new ItemStack(Pinesword, 1), new Object[]{
" W ", " C ", " S ", Character.valueOf('W'), Block.planks, Character.valueOf('C'), Block.cobblestone, Character.valueOf('S'), Item.stick
});
Uniquesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Unique.png");
ModLoader.addName(Uniquesword, "Unique Sword");
ModLoader.addRecipe(new ItemStack(Uniquesword, 1), new Object[]{
" G "," O "," S ", Character.valueOf('G'), Item.ingotGold, Character.valueOf('O'), Block.obsidian, Character.valueOf('S'), Item.stick
});
Slimesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Slimesword.png");
ModLoader.addName(Slimesword, "Slime Sword");
ModLoader.addRecipe(new ItemStack(Pinesword, 1), new Object[]{
" B ", " B ", " S ", Character.valueOf('B'), Item.slimeBall, Character.valueOf('S'), Item.stick
});
Endersword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Endersword.png");
ModLoader.addName(Endersword, "Ender Sword");
ModLoader.addRecipe(new ItemStack(Endersword, 1), new Object[]{
" E ", " E ", " S ", Character.valueOf('E'), Item.enderPearl, Character.valueOf('S'), Item.stick
});
}
public String getVersion()
{
return "v5";
}
heres enumtoolmaterial:
package net.minecraft.src;
public enum EnumToolMaterial
{
WOOD(0, 59, 2.0F, 0, 15),
STONE(1, 131, 4F, 1, 5),
IRON(2, 250, 6F, 2, 14),
EMERALD(3, 1561, 8F, 3, 10),
GOLD(0, 32, 12F, 0, 22),
Pine(2, 200, 6F, 5, 10000),
Unique(2, 500, 100F, 7, 10000),
Slime(2, 400, 200F, 7, 10000),
Lapis(2, 1765, 9F, 4, 10000);
/**
* 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 EnumToolMaterial(int par3, int par4, float par5, int par6, int par7)
{
harvestLevel = par3;
maxUses = par4;
efficiencyOnProperMaterial = par5;
damageVsEntity = par6;
enchantability = par7;
}
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
public int getMaxUses()
{
return maxUses;
}
/**
* The strength of this tool material against blocks which it is effective against.
*/
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
/**
* Damage versus entities.
*/
public int getDamageVsEntity()
{
return damageVsEntity;
}
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
public int getHarvestLevel()
{
return harvestLevel;
}
/**
* Return the natural enchantability factor of the material.
*/
public int getEnchantability()
{
return enchantability;
}
}
My mod only works in eclipse not minecraft itself...
package net.minecraft.src;
import java.util.Random;
public class mod_BasicSword extends BaseMod
{
public static final Item Pinesword = new ItemSword (3000, EnumToolMaterial.Pine).setItemName("damn");
public static final Item Uniquesword = new ItemSword (3001, EnumToolMaterial.Unique).setItemName("poop");
public static final Item Slimesword = new ItemSword (3002, EnumToolMaterial.Slime).setItemName("flar");
public static final Item Endersword = new ItemSword (3003, EnumToolMaterial.Slime).setItemName("fnor");
public void load()
{
Pinesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/BasicSword.png");
ModLoader.addName(Pinesword, "Pine Sword");
ModLoader.addRecipe(new ItemStack(Pinesword, 1), new Object[]{
" W ", " C ", " S ", Character.valueOf('W'), Block.planks, Character.valueOf('C'), Block.cobblestone, Character.valueOf('S'), Item.stick
});
Uniquesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Unique.png");
ModLoader.addName(Uniquesword, "Unique Sword");
ModLoader.addRecipe(new ItemStack(Uniquesword, 1), new Object[]{
" G "," O "," S ", Character.valueOf('G'), Item.ingotGold, Character.valueOf('O'), Block.obsidian, Character.valueOf('S'), Item.stick
});
Slimesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Slimesword.png");
ModLoader.addName(Slimesword, "Slime Sword");
ModLoader.addRecipe(new ItemStack(Pinesword, 1), new Object[]{
" B ", " B ", " S ", Character.valueOf('B'), Item.slimeBall, Character.valueOf('S'), Item.stick
});
Endersword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Endersword.png");
ModLoader.addName(Endersword, "Ender Sword");
ModLoader.addRecipe(new ItemStack(Endersword, 1), new Object[]{
" E ", " E ", " S ", Character.valueOf('E'), Item.enderPearl, Character.valueOf('S'), Item.stick
});
}
public String getVersion()
{
return "v5";
}
heres enumtoolmaterial:
package net.minecraft.src;
public enum EnumToolMaterial
{
WOOD(0, 59, 2.0F, 0, 15),
STONE(1, 131, 4F, 1, 5),
IRON(2, 250, 6F, 2, 14),
EMERALD(3, 1561, 8F, 3, 10),
GOLD(0, 32, 12F, 0, 22),
Pine(2, 200, 6F, 5, 10000),
Unique(2, 500, 100F, 7, 10000),
Slime(2, 400, 200F, 7, 10000),
Lapis(2, 1765, 9F, 4, 10000);
/**
* 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 EnumToolMaterial(int par3, int par4, float par5, int par6, int par7)
{
harvestLevel = par3;
maxUses = par4;
efficiencyOnProperMaterial = par5;
damageVsEntity = par6;
enchantability = par7;
}
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
public int getMaxUses()
{
return maxUses;
}
/**
* The strength of this tool material against blocks which it is effective against.
*/
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
/**
* Damage versus entities.
*/
public int getDamageVsEntity()
{
return damageVsEntity;
}
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
public int getHarvestLevel()
{
return harvestLevel;
}
/**
* Return the natural enchantability factor of the material.
*/
public int getEnchantability()
{
return enchantability;
}
}
here, i don't even wanna go through your code lol
A) Swords extend item not Itemtool.... so you dont need to modify EnumToolMaterial
your materials HAVE to be capital...
C) all your materials have the same ids....(2)
D)
the "7", "7", and "4" are not harvest levels.... the max is 3....
F)you forgot a "}" at the end of your mod_ file
G)you dont need those random spaces in your crafing recipes
H)Dont need those random spaces
I) heres the new code, if you still dont get it ask me and i will help you out again
SwordEnumToolMaterial
package net.minecraft.src;
public enum SwordEnumToolMaterial
{
PINE("CARBON", 5, 2, 200, 7F, 3, 50),
UNIQUE("CARBON", 6, 2, 500, 10F, 3, 50),
SLIME("CARBON", 7, 2, 400, 15F, 3, 50),
LAPIS("CARBON", 8, 2, 1765, 9F, 3, 50);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private static final SwordEnumToolMaterial allToolMaterials[];
private SwordEnumToolMaterial(String s, int i, int j, int k, float f, int l, int i1)
{
harvestLevel = j;
maxUses = k;
efficiencyOnProperMaterial = f;
damageVsEntity = l;
enchantability = i1;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getHarvestLevel()
{
return harvestLevel;
}
public int getEnchantability()
{
return enchantability;
}
static
{
allToolMaterials = (new SwordEnumToolMaterial[] {
PINE,UNIQUE,LAPIS,SLIME
});
}
}
SwordItemTool
package net.minecraft.src;
import java.util.Arrays;
public class SwordItemTool extends Item
{
private Block blocksEffectiveAgainst[];
public float efficiencyOnProperMaterial;
public int damageVsEntity;
protected CarbonOreEnumToolMaterial toolMaterial;
protected SwordItemTool(int i, int j, SwordEnumToolMaterial enumtoolmaterial, Block ablock[])
{
super(i);
efficiencyOnProperMaterial = 4F;
toolMaterial = enumtoolmaterial;
blocksEffectiveAgainst = ablock;
maxStackSize = 1;
setMaxDamage(enumtoolmaterial.getMaxUses());
efficiencyOnProperMaterial = enumtoolmaterial.getEfficiencyOnProperMaterial();
damageVsEntity = j + enumtoolmaterial.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack itemstack, Block block)
{
for(int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if(blocksEffectiveAgainst[i] == block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);
return true;
}
public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
{
itemstack.damageItem(1, entityliving);
return true;
}
public int getDamageVsEntity(Entity entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
Pine Sword
package net.minecraft.src;
public class PineItemSword extends Item
{
private int weaponDamage;
private final SwordEnumToolMaterial toolMaterial;
public PineItemSword(int par1, SwordEnumToolMaterial enumToolMaterial)
{
super(par1);
toolMaterial = enumToolMaterial;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
weaponDamage = 4 + enumToolMaterial.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;
}
/**
* 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 0x11940;
}
/**
* 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, 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 toolMaterial.getEnchantability();
}
}
Unique Sword
package net.minecraft.src;
public class UniqueItemSword extends Item
{
private int weaponDamage;
private final SwordEnumToolMaterial toolMaterial;
public UniqueItemSword(int par1, SwordEnumToolMaterial enumToolMaterial)
{
super(par1);
toolMaterial = enumToolMaterial;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
weaponDamage = 4 + enumToolMaterial.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;
}
/**
* 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 0x11940;
}
/**
* 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, 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 toolMaterial.getEnchantability();
}
}
Lapis Sword
package net.minecraft.src;
public class LapisItemSword extends Item
{
private int weaponDamage;
private final SwordEnumToolMaterial toolMaterial;
public LapisItemSword(int par1, SwordEnumToolMaterial enumToolMaterial)
{
super(par1);
toolMaterial = enumToolMaterial;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
weaponDamage = 4 + enumToolMaterial.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;
}
/**
* 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 0x11940;
}
/**
* 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, 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 toolMaterial.getEnchantability();
}
}
Slime Sword
package net.minecraft.src;
public class SlimeItemSword extends Item
{
private int weaponDamage;
private final SwordEnumToolMaterial toolMaterial;
public SlimeItemSword(int par1, SwordEnumToolMaterial enumToolMaterial)
{
super(par1);
toolMaterial = enumToolMaterial;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
weaponDamage = 4 + enumToolMaterial.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;
}
/**
* 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 0x11940;
}
/**
* 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, 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 toolMaterial.getEnchantability();
}
}
mod_Sword
package net.minecraft.src;
import java.util.Random;
public class mod_Sword extends BaseMod
{
public static final Item Pinesword = new PineItemSword (3000, EnumToolMaterial.PINE).setItemName("Pinesword");
public static final Item Uniquesword = new UniqueItemSword (3001, EnumToolMaterial.UNIQUE).setItemName("UniqueSword");
public static final Item Slimesword = new SlimeItemSword (3002, EnumToolMaterial.SLIME).setItemName("Slimesword");
public static final Item Lapissword = new LapisItemSword (3003, EnumToolMaterial.LAPIS).setItemName("Lapissword");
public void load()
{
Pinesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/BasicSword.png");
ModLoader.addName(Pinesword, "Pine Sword");
ModLoader.addRecipe(new ItemStack(Pinesword, 1), new Object[]{
"W", "C", "S", Character.valueOf('W'), Block.planks, Character.valueOf('C'), Block.cobblestone, Character.valueOf('S'), Item.stick
});
Uniquesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Unique.png");
ModLoader.addName(Uniquesword, "Unique Sword");
ModLoader.addRecipe(new ItemStack(Uniquesword, 1), new Object[]{
"G","O","S", Character.valueOf('G'), Item.ingotGold, Character.valueOf('O'), Block.obsidian, Character.valueOf('S'), Item.stick
});
Slimesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Slimesword.png");
ModLoader.addName(Slimesword, "Slime Sword");
ModLoader.addRecipe(new ItemStack(Pinesword, 1), new Object[]{
"B", "B", "S", Character.valueOf('B'), Item.slimeBall, Character.valueOf('S'), Item.stick
});
Lapissword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Endersword.png");
ModLoader.addName(Lapissword, "Lapis Sword");
ModLoader.addRecipe(new ItemStack(Lapissword, 1), new Object[]{
"E", "E", "S", Character.valueOf('E'), Item.enderPearl, Character.valueOf('S'), Item.stick
});
}
public String getVersion()
{
return "v5";
}
}
here, i don't even wanna go through your code lol
A) Swords extend item not Itemtool.... so you dont need to modify EnumToolMaterial
your materials HAVE to be capital...
C) all your materials have the same ids....(2)
D)
the "7", "7", and "4" are not harvest levels.... the max is 3....
F)you forgot a "}" at the end of your mod_ file
G)you dont need those random spaces in your crafing recipes
H)Dont need those random spaces
I) heres the new code, if you still dont get it ask me and i will help you out again
SwordEnumToolMaterial
package net.minecraft.src;
public enum SwordEnumToolMaterial
{
PINE("CARBON", 5, 2, 200, 7F, 3, 50),
UNIQUE("CARBON", 6, 2, 500, 10F, 3, 50),
SLIME("CARBON", 7, 2, 400, 15F, 3, 50),
LAPIS("CARBON", 8, 2, 1765, 9F, 3, 50);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private static final SwordEnumToolMaterial allToolMaterials[];
private SwordEnumToolMaterial(String s, int i, int j, int k, float f, int l, int i1)
{
harvestLevel = j;
maxUses = k;
efficiencyOnProperMaterial = f;
damageVsEntity = l;
enchantability = i1;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getHarvestLevel()
{
return harvestLevel;
}
public int getEnchantability()
{
return enchantability;
}
static
{
allToolMaterials = (new SwordEnumToolMaterial[] {
PINE,UNIQUE,LAPIS,SLIME
});
}
}
SwordItemTool
package net.minecraft.src;
import java.util.Arrays;
public class SwordItemTool extends Item
{
private Block blocksEffectiveAgainst[];
public float efficiencyOnProperMaterial;
public int damageVsEntity;
protected CarbonOreEnumToolMaterial toolMaterial;
protected SwordItemTool(int i, int j, SwordEnumToolMaterial enumtoolmaterial, Block ablock[])
{
super(i);
efficiencyOnProperMaterial = 4F;
toolMaterial = enumtoolmaterial;
blocksEffectiveAgainst = ablock;
maxStackSize = 1;
setMaxDamage(enumtoolmaterial.getMaxUses());
efficiencyOnProperMaterial = enumtoolmaterial.getEfficiencyOnProperMaterial();
damageVsEntity = j + enumtoolmaterial.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack itemstack, Block block)
{
for(int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if(blocksEffectiveAgainst[i] == block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);
return true;
}
public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
{
itemstack.damageItem(1, entityliving);
return true;
}
public int getDamageVsEntity(Entity entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
Pine Sword
package net.minecraft.src;
public class PineItemSword extends Item
{
private int weaponDamage;
private final SwordEnumToolMaterial toolMaterial;
public PineItemSword(int par1, SwordEnumToolMaterial enumToolMaterial)
{
super(par1);
toolMaterial = enumToolMaterial;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
weaponDamage = 4 + enumToolMaterial.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;
}
/**
* 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 0x11940;
}
/**
* 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, 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 toolMaterial.getEnchantability();
}
}
Unique Sword
package net.minecraft.src;
public class UniqueItemSword extends Item
{
private int weaponDamage;
private final SwordEnumToolMaterial toolMaterial;
public UniqueItemSword(int par1, SwordEnumToolMaterial enumToolMaterial)
{
super(par1);
toolMaterial = enumToolMaterial;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
weaponDamage = 4 + enumToolMaterial.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;
}
/**
* 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 0x11940;
}
/**
* 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, 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 toolMaterial.getEnchantability();
}
}
Lapis Sword
package net.minecraft.src;
public class LapisItemSword extends Item
{
private int weaponDamage;
private final SwordEnumToolMaterial toolMaterial;
public LapisItemSword(int par1, SwordEnumToolMaterial enumToolMaterial)
{
super(par1);
toolMaterial = enumToolMaterial;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
weaponDamage = 4 + enumToolMaterial.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;
}
/**
* 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 0x11940;
}
/**
* 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, 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 toolMaterial.getEnchantability();
}
}
Slime Sword
package net.minecraft.src;
public class SlimeItemSword extends Item
{
private int weaponDamage;
private final SwordEnumToolMaterial toolMaterial;
public SlimeItemSword(int par1, SwordEnumToolMaterial enumToolMaterial)
{
super(par1);
toolMaterial = enumToolMaterial;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
weaponDamage = 4 + enumToolMaterial.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;
}
/**
* 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 0x11940;
}
/**
* 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, 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 toolMaterial.getEnchantability();
}
}
mod_Sword
package net.minecraft.src;
import java.util.Random;
public class mod_Sword extends BaseMod
{
public static final Item Pinesword = new PineItemSword (3000, EnumToolMaterial.PINE).setItemName("Pinesword");
public static final Item Uniquesword = new UniqueItemSword (3001, EnumToolMaterial.UNIQUE).setItemName("UniqueSword");
public static final Item Slimesword = new SlimeItemSword (3002, EnumToolMaterial.SLIME).setItemName("Slimesword");
public static final Item Lapissword = new LapisItemSword (3003, EnumToolMaterial.LAPIS).setItemName("Lapissword");
public void load()
{
Pinesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/BasicSword.png");
ModLoader.addName(Pinesword, "Pine Sword");
ModLoader.addRecipe(new ItemStack(Pinesword, 1), new Object[]{
"W", "C", "S", Character.valueOf('W'), Block.planks, Character.valueOf('C'), Block.cobblestone, Character.valueOf('S'), Item.stick
});
Uniquesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Unique.png");
ModLoader.addName(Uniquesword, "Unique Sword");
ModLoader.addRecipe(new ItemStack(Uniquesword, 1), new Object[]{
"G","O","S", Character.valueOf('G'), Item.ingotGold, Character.valueOf('O'), Block.obsidian, Character.valueOf('S'), Item.stick
});
Slimesword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Slimesword.png");
ModLoader.addName(Slimesword, "Slime Sword");
ModLoader.addRecipe(new ItemStack(Pinesword, 1), new Object[]{
"B", "B", "S", Character.valueOf('B'), Item.slimeBall, Character.valueOf('S'), Item.stick
});
Lapissword.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/Endersword.png");
ModLoader.addName(Lapissword, "Lapis Sword");
ModLoader.addRecipe(new ItemStack(Lapissword, 1), new Object[]{
"E", "E", "S", Character.valueOf('E'), Item.enderPearl, Character.valueOf('S'), Item.stick
});
}
public String getVersion()
{
return "v5";
}
}
Any suggestions on what tutorial i should add next?
If there is not a tutorial on the "To Do" list you guys could always recommend some!
Could u do the crop tut next? I have looked around and the only crop tuts are either outdated or don't work. So many people say they will make a crop tut, but so few actually do. A suggestion is that when u make the custom mob tut, include how to add a walking animation to it. I haven't really found a tut on that. If u could do any of those tuts, that would be great!
Could u do the crop tut next? I have looked around and the only crop tuts are either outdated or don't work. So many people say they will make a crop tut, but so few actually do. A suggestion is that when u make the custom mob tut, include how to add a walking animation to it. I haven't really found a tut on that. If u could do any of those tuts, that would be great!
crop tutorial sure, but walking tutorial? i have no clue what you mean by that!
I have never made a mod before or anything like that and I don't understand a thing I really want to make a wand mod where its like a bow except looks like a stick and shoots red 'fire' balls that catch things on fire
Rollback Post to RevisionRollBack
I havevoicesin my head...... And they don't likeYOU!
I have never made a mod before or anything like that and I don't understand a thing I really want to make a wand mod where its like a bow except looks like a stick and shoots red 'fire' balls that catch things on fire
I would like to make crafting tables that could be specific to chemistry (Making alloys), or for moe high-tech usages (Circuits), or just for bigger crafting tables. It would be more challenging in a mod for someone to have to make a better crafting table before they can craft complex items.
I know it can be done, as they are in several different mods, but I just can't figure out how to make one myself. I know that BlockWorkbench loads the GUI from EntityPlayer, and I am trying to learn how the slots work. Once I have that done, all I need to do is make a new GUI, new slots, and new recipes files for the table. I may also need a tile entity if this is like furnaces, which I have made.
As for chests, I would like chests with more capacity, or, built-in features. (Crafting, smelting, etc.)
try re writing the code, delete it and re-write it.... it sometimes works for me like that
edit: try removing
for(int z = 0; z <21; z++)
im not too experienced with guis yet, but when i learn some more i will be sure to make a tutorial on it
http://pastebin.com/qbWGZqdb
thats good!
im probably going to add new tutorials later on this week
Public string out of range.
I repeated everything again but it doesn't work.
Please help
make sure you change the item id's so they are not the same or they are not already occupied and that you change certain stuff that they wont be the same example:
Change "30000"(itemid) because 2 items cannot occupy the same id.
Also change ("Namehere") "Namhere" to something else, so if one is "magic rod" change the other one to something else!
also make sure you properly define the item!
Thanks i had two of the same id's
no problem!
heres enumtoolmaterial:
here, i don't even wanna go through your code lol
A) Swords extend item not Itemtool.... so you dont need to modify EnumToolMaterial
your materials HAVE to be capital...
C) all your materials have the same ids....(2)
D) you forgot the "F" after the "5"
E)
the "7", "7", and "4" are not harvest levels.... the max is 3....
F)you forgot a "}" at the end of your mod_ file
G)you dont need those random spaces in your crafing recipes
H)Dont need those random spaces
I) heres the new code, if you still dont get it ask me and i will help you out again
SwordEnumToolMaterial
SwordItemTool
Pine Sword
Unique Sword
Lapis Sword
Slime Sword
mod_Sword
HOPE THIS HELPED! enjoy
-tehdduewhotreyd
cool ill try
np!
If there is not a tutorial on the "To Do" list you guys could always recommend some!
Be sure to check out my texture pack: Easy Ores!
crop tutorial sure, but walking tutorial? i have no clue what you mean by that!
well okay than