Basic arrows

This commit is contained in:
mDiyo committed 2013-07-10 04:39:53 -07:00
1 parent b40106b3e9
commit cdeece329a
165 files changed
+3511 -518

No files matched your search

+117 -90
View File
@@ -11,101 +11,128 @@ import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Pattern extends CraftingItem
implements IPattern
public class Pattern extends CraftingItem implements IPattern
{
public Pattern(int id, String partType, String patternType, String folder)
{
super(id, patternName, getPatternNames(patternType), folder);
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setContainerItem(this);
this.setMaxStackSize(1);
}
private static String[] getPatternNames (String partType)
{
String[] names = new String[patternName.length];
for (int i = 0; i < patternName.length; i++)
names[i] = partType+patternName[i];
return names;
}
public Pattern(int id, String partType, String patternType, String folder)
{
super(id, patternName, getPatternNames(patternType), folder);
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setContainerItem(this);
this.setMaxStackSize(1);
}
public static final String[] patternName = new String[] {
"ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel", "largerod", "toughbinding", "largeplate",
"broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "bowstring" };
protected static String[] getPatternNames (String partType)
{
String[] names = new String[patternName.length];
for (int i = 0; i < patternName.length; i++)
names[i] = partType + patternName[i];
return names;
}
public void getSubItems (int id, CreativeTabs tab, List list)
{
for (int i = 1; i < patternName.length; i++)
{
//if (i != 23)
list.add(new ItemStack(id, 1, i));
}
}
private static final String[] patternName = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign",
"knifeblade", "chisel", "largerod", "toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "bowstring", "fletching", "arrowhead" };
public ItemStack getContainerItemStack (ItemStack stack)
{
return stack;
}
public void getSubItems (int id, CreativeTabs tab, List list)
{
for (int i = 1; i < patternName.length; i++)
{
//if (i != 23)
list.add(new ItemStack(id, 1, i));
}
}
public boolean doesContainerItemLeaveCraftingGrid (ItemStack stack)
{
return false;
}
/* Tags and information about the pattern */
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
float cost = getPatternCost(stack) / 2f;
if (cost > 0)
{
if (cost - (int)cost < 0.1)
list.add("Material Cost: "+(int)cost);
else
list.add("Material Cost: "+cost);
}
}
public ItemStack getContainerItemStack (ItemStack stack)
{
return stack;
}
//2 for full material, 1 for half.
@Override
public int getPatternCost (ItemStack pattern)
{
switch (pattern.getItemDamage())
{
case 0: return 2;
case 1: return 1;
case 2: return 2;
case 3: return 2;
case 4: return 2;
case 5: return 2;
case 6: return 1;
case 7: return 1;
case 8: return 1;
case 9: return 1;
case 10: return 2;
case 11: return 2;
case 12: return 1;
case 13: return 1;
case 14: return 6;
case 15: return 6;
case 16: return 16;
case 17: return 16;
case 18: return 16;
case 19: return 16;
case 20: return 16;
case 21: return 16;
case 22: return 6;
default: return 0;
}
}
public boolean doesContainerItemLeaveCraftingGrid (ItemStack stack)
{
return false;
}
@Override
public ItemStack getPatternOutput (ItemStack stack, ItemStack input, MaterialSet set)
{
return TConstructRegistry.getPartMapping(this.itemID, stack.getItemDamage(), set.materialID);
}
/* Tags and information about the pattern */
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
float cost = getPatternCost(stack) / 2f;
if (cost > 0)
{
if (cost - (int) cost < 0.1)
list.add("Material Cost: " + (int) cost);
else
list.add("Material Cost: " + cost);
}
}
//2 for full material, 1 for half.
@Override
public int getPatternCost (ItemStack pattern)
{
switch (pattern.getItemDamage())
{
case 0:
return 2;
case 1:
return 1;
case 2:
return 2;
case 3:
return 2;
case 4:
return 2;
case 5:
return 2;
case 6:
return 1;
case 7:
return 1;
case 8:
return 1;
case 9:
return 1;
case 10:
return 2;
case 11:
return 2;
case 12:
return 1;
case 13:
return 1;
case 14:
return 6;
case 15:
return 6;
case 16:
return 16;
case 17:
return 16;
case 18:
return 16;
case 19:
return 16;
case 20:
return 16;
case 21:
return 16;
case 22:
return 6;
case 23:
return 6;
case 24:
return 2;
case 25:
return 2;
default:
return 0;
}
}
@Override
public ItemStack getPatternOutput (ItemStack stack, ItemStack input, MaterialSet set)
{
return TConstructRegistry.getPartMapping(this.itemID, stack.getItemDamage(), set.materialID);
}
}