Added Scythes

This commit is contained in:
Adubbz G 2013-06-18 18:59:00 +10:00
parent 1d013451f8
commit 70d33a8f8b
9 changed files with 386 additions and 7 deletions

View file

@ -28,6 +28,14 @@ public class Items
public static Optional<? extends Item> chestplateAmethyst = Optional.absent();
public static Optional<? extends Item> leggingsAmethyst = Optional.absent();
public static Optional<? extends Item> bootsAmethyst = Optional.absent();
public static Optional<? extends Item> scytheWood = Optional.absent();
public static Optional<? extends Item> scytheStone = Optional.absent();
public static Optional<? extends Item> scytheIron = Optional.absent();
public static Optional<? extends Item> scytheGold = Optional.absent();
public static Optional<? extends Item> scytheDiamond = Optional.absent();
public static Optional<? extends Item> scytheMud = Optional.absent();
public static Optional<? extends Item> scytheAmethyst = Optional.absent();
public static Optional<? extends Item> ancientStaff = Optional.absent();
public static Optional<? extends Item> enderporter = Optional.absent();

View file

@ -85,6 +85,7 @@ public class BOPBlocks {
registerTileEntities();
//Shears VS Blocks
Blocks.shearBlockIds.put(Block.leaves.blockID, 15.0F);
Blocks.shearBlockIds.put(Blocks.leaves1.get().blockID, 15.0F);
Blocks.shearBlockIds.put(Blocks.leaves2.get().blockID, 15.0F);
Blocks.shearBlockIds.put(Blocks.leavesColorized.get().blockID, 15.0F);

View file

@ -237,7 +237,6 @@ public class BOPConfiguration {
public static int leggingsMudID;
public static int bootsMudID;
public static int swordAmethystID;
public static int shovelAmethystID;
public static int pickaxeAmethystID;
@ -247,6 +246,14 @@ public class BOPConfiguration {
public static int chestplateAmethystID;
public static int leggingsAmethystID;
public static int bootsAmethystID;
public static int scytheWoodID;
public static int scytheStoneID;
public static int scytheIronID;
public static int scytheGoldID;
public static int scytheDiamondID;
public static int scytheMudID;
public static int scytheAmethystID;
public static int flowerBandID;
@ -799,6 +806,15 @@ public class BOPConfiguration {
bopBucketID = config.getItem("Spring Water Bucket ID", 21079, null).getInt();
soulManipulatorID = config.getItem("Soul Manipulator ID", 21080).getInt();
scytheWoodID = config.getItem("Wood Scythe ID", 21081).getInt();
scytheStoneID = config.getItem("Stone Scythe ID", 21082).getInt();
scytheIronID = config.getItem("Iron Scythe ID", 21083).getInt();
scytheGoldID = config.getItem("Gold Scythe ID", 21084).getInt();
scytheDiamondID = config.getItem("Diamond Scythe ID", 21085).getInt();
scytheMudID = config.getItem("Mud Scythe ID", 21086).getInt();
scytheAmethystID = config.getItem("Amethyst Scythe ID", 21087).getInt();
//Liquid Ids
springWaterStillID = config.get("Liquid IDs", "Spring Water Still ID (ID before this must be free!)", 1971, null).getInt();

View file

@ -155,6 +155,15 @@ public class BOPCrafting
// GameRegistry.addRecipe(new ItemStack(Blocks.planks.get(), 1, 10), new Object[] {"###", "###", "###", '#', Blocks.bamboo.get()});
GameRegistry.addRecipe(new ItemStack(Block.cobblestoneMossy, 1, 0), new Object[] {"MMM", "MCM", "MMM", 'M', Blocks.moss.get(), 'C', Block.cobblestone});
GameRegistry.addRecipe(new ItemStack(Block.stoneBrick, 1, 1), new Object[] {"MMM", "MSM", "MMM", 'M', Blocks.moss.get(), 'S', Block.stoneBrick});
//Scythes
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.scytheWood.get(), 1), new Object [] {"MMS", "XSX", "SXX", Character.valueOf('M'), "plankWood", Character.valueOf('S'), "stickWood" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.scytheStone.get(), 1), new Object [] {"MMS", "XSX", "SXX", Character.valueOf('M'), Block.cobblestone, Character.valueOf('S'), "stickWood" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.scytheIron.get(), 1), new Object [] {"MMS", "XSX", "SXX", Character.valueOf('M'), Item.ingotIron, Character.valueOf('S'), "stickWood" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.scytheGold.get(), 1), new Object [] {"MMS", "XSX", "SXX", Character.valueOf('M'), Item.ingotGold, Character.valueOf('S'), "stickWood" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.scytheDiamond.get(), 1), new Object [] {"MMS", "XSX", "SXX", Character.valueOf('M'), Item.diamond, Character.valueOf('S'), "stickWood" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.scytheMud.get(), 1), new Object [] {"MMS", "XSX", "SXX", Character.valueOf('M'), Items.mudball.get(), Character.valueOf('S'), "stickWood" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.scytheAmethyst.get(), 1), new Object [] {"MMS", "XSX", "SXX", Character.valueOf('M'), new ItemStack(Items.miscItems.get(), 1, 2), Character.valueOf('S'), "stickWood" }));
//Mud Tools and Armor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.pickaxeMud.get(), 1), new Object [] {"###", " X ", " X ", Character.valueOf('#'), Items.mudball.get(), Character.valueOf('X'), "stickWood" }));

View file

@ -23,6 +23,7 @@ import biomesoplenty.items.ItemBOPMudball;
import biomesoplenty.items.ItemBOPPickaxe;
import biomesoplenty.items.ItemBOPRecord;
import biomesoplenty.items.ItemBOPRecordMud;
import biomesoplenty.items.ItemBOPScythe;
import biomesoplenty.items.ItemBOPSpade;
import biomesoplenty.items.ItemBOPSword;
import biomesoplenty.items.ItemBerries;
@ -141,6 +142,14 @@ public class BOPItems {
Items.chestplateAmethyst = Optional.of((new ArmorAmethyst(BOPConfiguration.chestplateAmethystID, EnumArmorMaterialAmethyst, BiomesOPlenty.proxy.addArmor("amethyst"), 1)).setUnlocalizedName("bop.chestplateAmethyst"));
Items.leggingsAmethyst = Optional.of((new ArmorAmethyst(BOPConfiguration.leggingsAmethystID, EnumArmorMaterialAmethyst, BiomesOPlenty.proxy.addArmor("amethyst"), 2)).setUnlocalizedName("bop.leggingsAmethyst"));
Items.bootsAmethyst = Optional.of((new ArmorAmethyst(BOPConfiguration.bootsAmethystID, EnumArmorMaterialAmethyst, BiomesOPlenty.proxy.addArmor("amethyst"), 3)).setUnlocalizedName("bop.bootsAmethyst"));
Items.scytheWood = Optional.of((new ItemBOPScythe(BOPConfiguration.scytheWoodID, 2, EnumToolMaterial.WOOD, 0).setUnlocalizedName("bop.scytheWood")));
Items.scytheStone = Optional.of((new ItemBOPScythe(BOPConfiguration.scytheStoneID, 2, EnumToolMaterial.STONE, 1).setUnlocalizedName("bop.scytheStone")));
Items.scytheIron = Optional.of((new ItemBOPScythe(BOPConfiguration.scytheIronID, 2, EnumToolMaterial.IRON, 2).setUnlocalizedName("bop.scytheIron")));
Items.scytheGold = Optional.of((new ItemBOPScythe(BOPConfiguration.scytheGoldID, 2, EnumToolMaterial.GOLD, 3).setUnlocalizedName("bop.scytheGold")));
Items.scytheDiamond = Optional.of((new ItemBOPScythe(BOPConfiguration.scytheDiamondID, 2, EnumToolMaterial.EMERALD, 4).setUnlocalizedName("bop.scytheDiamond")));
Items.scytheMud = Optional.of((new ItemBOPScythe(BOPConfiguration.scytheMudID, 2, EnumToolMaterialMud, 5).setUnlocalizedName("bop.scytheMud")));
Items.scytheAmethyst = Optional.of((new ItemBOPScythe(BOPConfiguration.scytheAmethystID, 2, EnumToolMaterialAmethyst, 6).setUnlocalizedName("bop.scytheAmethyst")));
Items.flowerBand = Optional.of((new ArmorFlowerBand(BOPConfiguration.flowerBandID, EnumArmorMaterialFlowerBand, BiomesOPlenty.proxy.addArmor("flowerBand"), 0)).setCreativeTab(BiomesOPlenty.tabBiomesOPlenty).setUnlocalizedName("bop.flowerBand"));
}

View file

@ -9,29 +9,42 @@ import biomesoplenty.api.Items;
public class ItemBOPPickaxe extends ItemPickaxe
{
public int TextureID = 0;
public int textureID = 0;
public ItemBOPPickaxe(int par1, EnumToolMaterial par2, int texture)
{
super(par1, par2);
TextureID = texture;
textureID = texture;
setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{
if (TextureID == 1 && par2ItemStack.itemID == Items.miscItems.get().itemID && par2ItemStack.getItemDamage() == 2)
if (textureID == 1 && par2ItemStack.itemID == Items.miscItems.get().itemID && par2ItemStack.getItemDamage() == 2)
{
return true;
}
else
{
return false;
}
}
@Override
public void registerIcons(IconRegister iconRegister)
{
if(TextureID==0){ itemIcon = iconRegister.registerIcon("BiomesOPlenty:mudpickaxe"); }
else if(TextureID==1){ itemIcon = iconRegister.registerIcon("BiomesOPlenty:amethystpickaxe"); }
else { itemIcon = iconRegister.registerIcon("BiomesOPlenty:mudball"); }
if (textureID == 0)
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:mudpickaxe");
}
else if (textureID == 1)
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:amethystpickaxe");
}
else
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:mudball");
}
}
}

View file

@ -0,0 +1,313 @@
package biomesoplenty.items;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.Blocks;
import biomesoplenty.api.Items;
import biomesoplenty.configuration.BOPItems;
public class ItemBOPScythe extends Item
{
public int textureID = 0;
public int damageVsEntity;
protected EnumToolMaterial toolMaterial;
public ItemBOPScythe(int id, int damage, EnumToolMaterial enumtoolmat, int texture)
{
super(id);
this.toolMaterial = enumtoolmat;
this.maxStackSize = 1;
this.setMaxDamage(enumtoolmat.getMaxUses());
textureID = texture;
this.damageVsEntity = damage + enumtoolmat.getDamageVsEntity();
setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
}
public boolean onBlockDestroyed(ItemStack itemstack, World world, int meta, int x, int y, int z, EntityLiving entity)
{
Block block = Block.blocksList[world.getBlockId(x, y, z)];
int radius = 1;
int height = 3;
if (toolMaterial == EnumToolMaterial.IRON || toolMaterial == EnumToolMaterial.GOLD)
{
radius = 2;
}
else if (toolMaterial == EnumToolMaterial.EMERALD)
{
radius = 3;
}
else if (toolMaterial == BOPItems.EnumToolMaterialAmethyst)
{
radius = 4;
}
if (block != null)
{
if (block.isLeaves(world, x, y, z))
{
trimLeaves(world, x, y, z, height, radius);
itemstack.damageItem(1, entity);
return true;
}
else
{
trimCutCorner(world, x, y, z, height, radius);
if (world.rand.nextInt(3) == 0)
{
trim(world, x, y, z, height, radius - 1);
itemstack.damageItem(1, entity);
return true;
}
}
}
return false;
}
@Override
public int getDamageVsEntity(Entity par1Entity)
{
return this.damageVsEntity;
}
public void trim(World world, int x, int y, int z, int height, int radius)
{
for (int aX = -radius; aX <= radius; aX++)
{
for (int aY = 0; aY <= radius; aY++)
{
for (int aZ = -radius; aZ <= radius; aZ++)
{
Block block = Block.blocksList[world.getBlockId(x + aX, y + aY, z + aZ)];
int meta = world.getBlockMetadata(x + aX, y + aY, z + aZ);
if (block != null)
{
if (block.blockID == Blocks.foliage.get().blockID && (meta == 1 || meta == 2 || meta == 6))
{
if (meta == 1)
{
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlockToAir(x + aX, y + aY, z + aZ);
}
else if (meta == 2)
{
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlock(x + aX, y + aY, z + aZ, Blocks.foliage.get().blockID, 1, 2);
}
else if (meta == 6)
{
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlockToAir(x + aX, y + aY, z + aZ);
}
}
else if (block.blockID == Block.tallGrass.blockID)
{
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlock(x + aX, y + aY, z + aZ, Blocks.foliage.get().blockID, 2, 2);
}
else if (block.blockID != Block.waterlily.blockID && block instanceof BlockFlower)
{
System.out.println(block.getBlockDropped(world, x + aX, y + aY, z + aZ, meta, 1));
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlockToAir(x + aX, y + aY, z + aZ);
}
}
}
}
}
}
public void trimLeaves(World world, int x, int y, int z, int height, int radius)
{
for (int aX = -radius; aX <= radius; aX++)
{
for (int aY = -radius; aY <= radius; aY++)
{
for (int aZ = -radius; aZ <= radius; aZ++)
{
Block block = Block.blocksList[world.getBlockId(x + aX, y + aY, z + aZ)];
int meta = world.getBlockMetadata(x + aX, y + aY, z + aZ);
if (block != null)
{
if (block.isLeaves(world, x + aX, y + aY, z + aZ))
{
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlockToAir(x + aX, y + aY, z + aZ);
}
}
}
}
}
}
public void trimCutCorner(World world, int x, int y, int z, int height, int radius)
{
for (int aX = -radius; aX <= radius; aX++)
{
for (int aY = 0; aY <= radius; aY++)
{
for (int aZ = -radius; aZ <= radius; aZ++)
{
if ((aX + aZ < radius * 2) && (-aX + aZ < radius * 2) && (aX + -aZ < radius * 2) && (-aX + -aZ < radius * 2))
{
Block block = Block.blocksList[world.getBlockId(x + aX, y + aY, z + aZ)];
int meta = world.getBlockMetadata(x + aX, y + aY, z + aZ);
if (block != null)
{
if (block.blockID == Blocks.foliage.get().blockID && (meta == 1 || meta == 2 || meta == 6))
{
if (meta == 1)
{
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlockToAir(x + aX, y + aY, z + aZ);
}
else if (meta == 2)
{
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlock(x + aX, y + aY, z + aZ, Blocks.foliage.get().blockID, 1, 2);
}
else if (meta == 6)
{
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlockToAir(x + aX, y + aY, z + aZ);
}
}
else if (block.blockID == Block.tallGrass.blockID)
{
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlock(x + aX, y + aY, z + aZ, Blocks.foliage.get().blockID, 2, 2);
}
else if (block.blockID != Block.waterlily.blockID && block instanceof BlockFlower)
{
block.dropBlockAsItem(world, x + aX, y + aY, z + aZ, meta, 0);
world.setBlockToAir(x + aX, y + aY, z + aZ);
}
}
}
}
}
}
}
@Override
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
float strength = 0;
if (Blocks.shearBlockIds.get(par2Block.blockID) != null)
{
strength = Float.parseFloat(Blocks.shearBlockIds.get(par2Block.blockID).toString());
}
else
{
strength = super.getStrVsBlock(par1ItemStack, par2Block);
}
return strength;
}
@Override
public int getItemEnchantability()
{
return this.toolMaterial.getEnchantability();
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{
if (textureID == 0 && par2ItemStack.itemID == Block.wood.blockID)
{
return true;
}
if (textureID == 1 && par2ItemStack.itemID == Block.cobblestone.blockID)
{
return true;
}
if (textureID == 2 && par2ItemStack.itemID == Item.ingotIron.itemID)
{
return true;
}
if (textureID == 3 && par2ItemStack.itemID == Item.ingotGold.itemID)
{
return true;
}
if (textureID == 4 && par2ItemStack.itemID == Item.diamond.itemID)
{
return true;
}
if (textureID == 6 && par2ItemStack.itemID == Items.miscItems.get().itemID && par2ItemStack.getItemDamage() == 2)
{
return true;
}
else
{
return false;
}
}
@Override
public boolean isFull3D()
{
return true;
}
@Override
public void registerIcons(IconRegister iconRegister)
{
if (textureID == 0)
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:woodscythe");
}
else if (textureID == 1)
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:stonescythe");
}
else if (textureID == 2)
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:ironscythe");
}
else if (textureID == 3)
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:goldscythe");
}
else if (textureID == 4)
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:diamondscythe");
}
else if (textureID == 5)
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:mudscythe");
}
else if (textureID == 6)
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:amethystscythe");
}
else
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:mudball");
}
}
}

View file

@ -85,6 +85,8 @@ public class ItemSoulManipulator extends Item
}
//entityvillager.playLivingSound();
return true;
}
}
else

View file

@ -310,6 +310,14 @@
<entry key="item.bop.chestplateAmethyst.name">Amethyst Chestplate</entry>
<entry key="item.bop.leggingsAmethyst.name">Amethyst Leggings</entry>
<entry key="item.bop.bootsAmethyst.name">Amethyst Boots</entry>
<entry key="item.bop.scytheWood.name">Wooden Scythe</entry>
<entry key="item.bop.scytheStone.name">Stone Scythe</entry>
<entry key="item.bop.scytheIron.name">Iron Scythe</entry>
<entry key="item.bop.scytheGold.name">Gold Scythe</entry>
<entry key="item.bop.scytheDiamond.name">Diamond Scythe</entry>
<entry key="item.bop.scytheMud.name">Mud Scythe</entry>
<entry key="item.bop.scytheAmethyst.name">Amethyst Scythe</entry>
<entry key="item.bop.ancientStaff.ancientstaff.name">Ancient Staff</entry>
<entry key="item.bop.ancientStaff.staffhandle.name">Ancient Staff Handle</entry>