mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-23 21:49:45 +00:00
1.6.2 test - Finished liquids, added connected textures on glass
This commit is contained in:
1 parent
40c6f445a2
commit
a80fcbce86
704 files changed
+60909
No files matched your search
@@ -0,0 +1,49 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.util.IToolPart;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Bowstring extends CraftingItem implements IToolPart
|
||||
{
|
||||
public Bowstring(int id)
|
||||
{
|
||||
super(id, toolMaterialNames, buildTextureNames("_bowstring"), "parts/");
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
private static String[] buildTextureNames (String textureType)
|
||||
{
|
||||
String[] names = new String[toolMaterialNames.length];
|
||||
for (int i = 0; i < toolMaterialNames.length; i++)
|
||||
{
|
||||
if (toolTextureNames[i].equals(""))
|
||||
names[i] = "";
|
||||
else
|
||||
names[i] = toolTextureNames[i] + textureType;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public static final String[] toolMaterialNames = new String[] { "string", "enchantedfabric" };
|
||||
|
||||
public static final String[] toolTextureNames = new String[] { "string", "magicfabric" };
|
||||
|
||||
@Override
|
||||
public int getMaterialID (ItemStack stack)
|
||||
{
|
||||
return stack.getItemDamage();
|
||||
}
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
list.add(new ItemStack(id, 1, 0));
|
||||
if (TContent.thaumcraftAvailable)
|
||||
list.add(new ItemStack(id, 1, 1));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CraftingItem extends Item
|
||||
{
|
||||
public String[] textureNames;
|
||||
public String[] unlocalizedNames;
|
||||
public String folder;
|
||||
public Icon[] icons;
|
||||
|
||||
public CraftingItem(int id, String[] names, String[] tex, String folder)
|
||||
{
|
||||
super(id);
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
this.textureNames = tex;
|
||||
this.unlocalizedNames = names;
|
||||
this.folder = folder;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage (int meta)
|
||||
{
|
||||
int arr = MathHelper.clamp_int(meta, 0, unlocalizedNames.length);
|
||||
return icons[arr];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.icons = new Icon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
if (!(textureNames[i].equals("")))
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length);
|
||||
return getUnlocalizedName() + "." + unlocalizedNames[arr];
|
||||
}
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < unlocalizedNames.length; i++)
|
||||
if (!(textureNames[i].equals("")))
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class DiamondApple extends ItemFood
|
||||
{
|
||||
public Icon[] icons;
|
||||
public String[] textureNames = new String[] { "apple_diamond" };
|
||||
public String[] itemNames = new String[] { "apple.diamond" };
|
||||
|
||||
public DiamondApple(int id)
|
||||
{
|
||||
super(id, 4, 2.0F, false);
|
||||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
this.setAlwaysEdible();
|
||||
}
|
||||
|
||||
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
int duration = 0;
|
||||
PotionEffect potion;
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.resistance);
|
||||
if (potion != null)
|
||||
duration = potion.duration;
|
||||
player.addPotionEffect(new PotionEffect(Potion.resistance.id, duration + 60 * 20, 0));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.digSpeed);
|
||||
if (potion != null)
|
||||
duration = potion.duration;
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, duration + 60 * 20, 0));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.damageBoost);
|
||||
if (potion != null)
|
||||
duration = potion.duration;
|
||||
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, duration + 60 * 20, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Icon getIconFromDamage (int meta)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.icons = new Icon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Name override */
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
return (new StringBuilder()).append("item.food.").append(itemNames[itemstack.getItemDamage()]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.blocks.logic.LiquidTextureLogic;
|
||||
import tconstruct.common.TContent;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class FilledBucket extends ItemBucket
|
||||
{
|
||||
|
||||
public FilledBucket(int id)
|
||||
{
|
||||
super(id, 0);
|
||||
//setTextureFile(TContent.craftingTexture);
|
||||
//setIconIndex(224);
|
||||
setUnlocalizedName("tconstruct.bucket");
|
||||
setContainerItem(Item.bucketEmpty);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
float var4 = 1.0F;
|
||||
double trueX = player.prevPosX + (player.posX - player.prevPosX) * (double) var4;
|
||||
double trueY = player.prevPosY + (player.posY - player.prevPosY) * (double) var4 + 1.62D - (double) player.yOffset;
|
||||
double trueZ = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) var4;
|
||||
boolean wannabeFull = false;
|
||||
MovingObjectPosition position = this.getMovingObjectPositionFromPlayer(world, player, wannabeFull);
|
||||
|
||||
if (position == null)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*FillBucketEvent event = new FillBucketEvent(player, stack, world, position);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (event.getResult() == Event.Result.ALLOW)
|
||||
{
|
||||
if (player.capabilities.isCreativeMode)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (--stack.stackSize <= 0)
|
||||
{
|
||||
return event.result;
|
||||
}
|
||||
|
||||
if (!player.inventory.addItemStackToInventory(event.result))
|
||||
{
|
||||
player.dropPlayerItem(event.result);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}*/
|
||||
|
||||
if (position.typeOfHit == EnumMovingObjectType.TILE)
|
||||
{
|
||||
int clickX = position.blockX;
|
||||
int clickY = position.blockY;
|
||||
int clickZ = position.blockZ;
|
||||
|
||||
if (!world.canMineBlock(player, clickX, clickY, clickZ))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (position.sideHit == 0)
|
||||
{
|
||||
--clickY;
|
||||
}
|
||||
|
||||
if (position.sideHit == 1)
|
||||
{
|
||||
++clickY;
|
||||
}
|
||||
|
||||
if (position.sideHit == 2)
|
||||
{
|
||||
--clickZ;
|
||||
}
|
||||
|
||||
if (position.sideHit == 3)
|
||||
{
|
||||
++clickZ;
|
||||
}
|
||||
|
||||
if (position.sideHit == 4)
|
||||
{
|
||||
--clickX;
|
||||
}
|
||||
|
||||
if (position.sideHit == 5)
|
||||
{
|
||||
++clickX;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(clickX, clickY, clickZ, position.sideHit, stack))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (this.tryPlaceContainedLiquid(world, clickX, clickY, clickZ, stack.getItemDamage()) && !player.capabilities.isCreativeMode)
|
||||
{
|
||||
return new ItemStack(Item.bucketEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tryPlaceContainedLiquid (World world, int clickX, int clickY, int clickZ, int meta)
|
||||
{
|
||||
if (!world.isAirBlock(clickX, clickY, clickZ) && world.getBlockMaterial(clickX, clickY, clickZ).isSolid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int id = 0;
|
||||
world.setBlock(clickX, clickY, clickZ, TContent.fluidBlocks[meta].blockID, 7, 3); //TODO: Merge liquids
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
|
||||
public Icon[] icons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage (int meta)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.icons = new Icon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:materials/bucket_" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, materialNames.length);
|
||||
return getUnlocalizedName() + "." + materialNames[arr];
|
||||
}
|
||||
|
||||
public static final String[] materialNames = new String[] { "Iron", "Gold", "Copper", "Tin", "Aluminum", "Cobalt", "Ardite", "Bronze", "AluBrass", "Manyullyn", "Alumite", "Obsidian", "Steel",
|
||||
"Glass", "Stone", "Villager", "Cow" };
|
||||
|
||||
public static final String[] textureNames = new String[] { "iron", "gold", "copper", "tin", "aluminum", "cobalt", "ardite", "bronze", "alubrass", "manyullyn", "alumite", "obsidian", "steel",
|
||||
"glass", "stone", "emerald", "blood" };
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import tconstruct.library.util.IToolPart;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Fletching extends CraftingItem implements IToolPart
|
||||
{
|
||||
public Fletching(int id)
|
||||
{
|
||||
super(id, toolMaterialNames, buildTextureNames("_fletching"), "parts/");
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
private static String[] buildTextureNames (String textureType)
|
||||
{
|
||||
String[] names = new String[toolMaterialNames.length];
|
||||
for (int i = 0; i < toolMaterialNames.length; i++)
|
||||
{
|
||||
if (toolTextureNames[i].equals(""))
|
||||
names[i] = "";
|
||||
else
|
||||
names[i] = toolTextureNames[i] + textureType;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public static final String[] toolMaterialNames = new String[] { "feather", "leaf", "slime", "blueslime" };
|
||||
|
||||
public static final String[] toolTextureNames = new String[] { "feather", "leaf", "slime", "blueslime" };
|
||||
|
||||
@Override
|
||||
public int getMaterialID (ItemStack stack)
|
||||
{
|
||||
return stack.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class GoldenHead extends ItemFood
|
||||
{
|
||||
public GoldenHead(int par1, int par2, float par3, boolean par4)
|
||||
{
|
||||
super(par1, par2, par3, par4);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect (ItemStack par1ItemStack)
|
||||
{
|
||||
return par1ItemStack.getItemDamage() > 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Return an item rarity from EnumRarity
|
||||
*/
|
||||
public EnumRarity getRarity (ItemStack par1ItemStack)
|
||||
{
|
||||
return par1ItemStack.getItemDamage() == 0 ? EnumRarity.rare : EnumRarity.epic;
|
||||
}
|
||||
|
||||
protected void onFoodEaten (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
if (par1ItemStack.getItemDamage() > 0)
|
||||
{
|
||||
if (!par2World.isRemote)
|
||||
{
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 3));
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0));
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.onFoodEaten(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubItems (int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:skull_char_gold");
|
||||
/*this.icons = new Icon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:"+textureNames[i]);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Manual extends CraftingItem
|
||||
{
|
||||
static String[] name = new String[] { "beginner", "toolstation", "smeltery" };
|
||||
static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation", "tinkerbook_smeltery" };
|
||||
|
||||
public Manual(int id)
|
||||
{
|
||||
super(id, name, textureName, "");
|
||||
setUnlocalizedName("tconstruct.manual");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
player.openGui(TConstruct.instance, TConstruct.proxy.manualGuiID, world, 0, 0, 0);
|
||||
/*Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
if (side.isClient())
|
||||
FMLClientHandler.instance().displayGuiScreen(player, new GuiManual(player.getCurrentEquippedItem(), getManualFromStack(stack)));*/
|
||||
return stack;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
list.add("\u00a7oBy: Skyla");
|
||||
break;
|
||||
case 1:
|
||||
list.add("\u00a7oBy: Skyla");
|
||||
break;
|
||||
case 2:
|
||||
list.add("\u00a7oBy: Thruul M'gon");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package tconstruct.items;
|
||||
|
||||
public class MaterialItem extends CraftingItem
|
||||
{
|
||||
|
||||
public MaterialItem(int id)
|
||||
{
|
||||
super(id, materialNames, getTextures(), "materials/");
|
||||
}
|
||||
|
||||
private static String[] getTextures ()
|
||||
{
|
||||
String[] names = new String[craftingTextures.length];
|
||||
for (int i = 0; i < craftingTextures.length; i++)
|
||||
names[i] = "material_" + craftingTextures[i];
|
||||
return names;
|
||||
}
|
||||
|
||||
static String[] materialNames = new String[] { "PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot", "ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone",
|
||||
"CopperIngot", "TinIngot", "AluminumIngot", "RawAluminum", "BronzeIngot", "AluBrassIngot", "AlumiteIngot", "SteelIngot", "BlueSlimeCrystal", "ObsidianIngot", "IronNugget", "CopperNugget",
|
||||
"TinNugget", "AluminumNugget", "EssenceCrystal", "AluBrassNugget", "SilkyCloth", "SilkyJewel", "ObsidianNugget", "CobaltNugget", "ArditeNugget", "ManyullynNugget", "BronzeNugget",
|
||||
"AlumiteNugget", "SteelNugget" };
|
||||
|
||||
static String[] craftingTextures = new String[] { "paperstack", "slimecrystal", "searedbrick", "cobaltingot", "arditeingot", "manyullyningot", "mossball", "lavacrystal", "necroticbone",
|
||||
"copperingot", "tiningot", "aluminumingot", "aluminumraw", "bronzeingot", "alubrassingot", "alumiteingot", "steelingot", "blueslimecrystal", "obsidianingot", "nugget_iron",
|
||||
"nugget_copper", "nugget_tin", "nugget_aluminum", "essencecrystal", "nugget_alubrass", "silkycloth", "silkyjewel", "nugget_obsidian", "nugget_cobalt", "nugget_ardite", "nugget_manyullyn",
|
||||
"nugget_bronze", "nugget_alumite", "nugget_steel" };
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MetalPattern extends Pattern
|
||||
{
|
||||
|
||||
public MetalPattern(int id, String partType, String patternType, String folder)
|
||||
{
|
||||
super(id, partType, patternType, folder);
|
||||
}
|
||||
|
||||
protected static String[] getPatternNames (String partType)
|
||||
{
|
||||
String[] names = new String[patternName.length];
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
if (!(patternName[i].equals("")))
|
||||
names[i] = partType + patternName[i];
|
||||
return names;
|
||||
}
|
||||
|
||||
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", "", "", "arrowhead" };
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
if (!(patternName[i].equals("")))
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class OreBerries extends CraftingItem
|
||||
{
|
||||
static String[] names = new String[] { "iron", "gold", "copper", "tin", "aluminum", "essence" };
|
||||
static String[] tex = new String[] { "oreberry_iron", "oreberry_gold", "oreberry_copper", "oreberry_tin", "oreberry_aluminum", "oreberry_essence" };
|
||||
|
||||
public OreBerries(int id)
|
||||
{
|
||||
super(id, names, tex, "oreberries/");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
list.add("Sweet Irony");
|
||||
break;
|
||||
case 1:
|
||||
list.add("Pure Luster");
|
||||
break;
|
||||
case 2:
|
||||
list.add("Tastes like metal");
|
||||
break;
|
||||
case 3:
|
||||
list.add("Tin Man");
|
||||
break;
|
||||
case 4:
|
||||
list.add("White Chocolate");
|
||||
break;
|
||||
case 5:
|
||||
list.add("Tastes like Creeper");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (stack.getItemDamage() == 5)
|
||||
{
|
||||
EntityXPOrb entity = new EntityXPOrb(world, player.posX, player.posY + 1, player.posZ, itemRand.nextInt(4) + 3);
|
||||
spawnEntity(player.posX, player.posY + 1, player.posZ, entity, world, player);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
stack.stackSize--;
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static void spawnEntity (double x, double y, double z, Entity entity, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.PatternBuilder.MaterialSet;
|
||||
import tconstruct.library.util.IPattern;
|
||||
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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 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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 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 ItemStack getContainerItemStack (ItemStack stack)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class RedstoneBallRepeaterItem extends Item
|
||||
{
|
||||
public RedstoneBallRepeaterItem(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.setCreativeTab(CreativeTabs.tabRedstone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
|
||||
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
|
||||
*/
|
||||
public boolean onItemUse (ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if (par3World.getBlockId(par4, par5, par6) != Block.snow.blockID)
|
||||
{
|
||||
if (par7 == 0)
|
||||
{
|
||||
--par5;
|
||||
}
|
||||
|
||||
if (par7 == 1)
|
||||
{
|
||||
++par5;
|
||||
}
|
||||
|
||||
if (par7 == 2)
|
||||
{
|
||||
--par6;
|
||||
}
|
||||
|
||||
if (par7 == 3)
|
||||
{
|
||||
++par6;
|
||||
}
|
||||
|
||||
if (par7 == 4)
|
||||
{
|
||||
--par4;
|
||||
}
|
||||
|
||||
if (par7 == 5)
|
||||
{
|
||||
++par4;
|
||||
}
|
||||
|
||||
if (!par3World.isAirBlock(par4, par5, par6))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Block.redstoneWire.canPlaceBlockAt(par3World, par4, par5, par6))
|
||||
{
|
||||
--par1ItemStack.stackSize;
|
||||
par3World.setBlock(par4, par5, par6, TContent.redstoneBallRepeater.blockID);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:redstoneball");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SpecialFood extends ItemFood
|
||||
{
|
||||
int[] hunger;
|
||||
float[] saturation;
|
||||
String[] unlocalizedNames;
|
||||
String[] iconNames;
|
||||
Icon[] icons;
|
||||
|
||||
public SpecialFood(int id, int[] hunger, float[] saturation, String[] textureNames, String[] iconNames)
|
||||
{
|
||||
super(id, 0, 0, false);
|
||||
this.hunger = hunger;
|
||||
this.saturation = saturation;
|
||||
this.unlocalizedNames = textureNames;
|
||||
this.iconNames = iconNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
stack.stackSize--;
|
||||
int damage = stack.getItemDamage();
|
||||
player.getFoodStats().addStats(hunger[damage], saturation[damage]);
|
||||
world.playSoundAtEntity(player, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F);
|
||||
this.onFoodEaten(stack, world, player);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage (int meta)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.icons = new Icon[iconNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + iconNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length);
|
||||
return getUnlocalizedName() + "." + unlocalizedNames[arr];
|
||||
}
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < unlocalizedNames.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class StrangeFood extends SpecialFood
|
||||
{
|
||||
public StrangeFood(int id)
|
||||
{
|
||||
super(id, new int[] { 2 }, new float[] { 1f }, new String[] { "edibleslime" }, new String[] { "edibleslime" });
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
list.add("\u00a7b\u00a7oIt smells terrible, but if you");
|
||||
list.add("\u00a7b\u00a7ohave nothing else to eat...");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.entity.BlueSlime;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingData;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TitleIcon extends Item
|
||||
{
|
||||
int[] primaryColor = { 0x66BBE8, 0x66BBE8 };
|
||||
int[] secondaryColor = { 0x1567BF, 0xFFEC6E };
|
||||
String[] mobNames = { "TConstruct.EdibleSlime", "TConstruct.KingSlime" };
|
||||
|
||||
public TitleIcon(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.setCreativeTab(CreativeTabs.tabMisc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
ToolCore.blankSprite = iconRegister.registerIcon("tinker:blanksprite");
|
||||
TProxyClient.metalBall = iconRegister.registerIcon("tinker:metalball");
|
||||
itemIcon = iconRegister.registerIcon("tinker:tparts");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamageForRenderPass (int par1, int par2)
|
||||
{
|
||||
if (par1 == 255)
|
||||
return itemIcon;
|
||||
return Item.monsterPlacer.getIconFromDamageForRenderPass(par1, par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemDisplayName (ItemStack par1ItemStack)
|
||||
{
|
||||
String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim();
|
||||
String s1 = mobNames[par1ItemStack.getItemDamage()];
|
||||
|
||||
if (s1 != null)
|
||||
{
|
||||
s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name");
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < mobNames.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack (ItemStack stack, int pass)
|
||||
{
|
||||
int damage = stack.getItemDamage();
|
||||
if (damage == 255)
|
||||
return 0xffffff;
|
||||
return pass == 0 ? primaryColor[damage] : secondaryColor[damage];
|
||||
}
|
||||
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int posX, int posY, int posZ, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
int i1 = world.getBlockId(posX, posY, posZ);
|
||||
posX += Facing.offsetsXForSide[par7];
|
||||
posY += Facing.offsetsYForSide[par7];
|
||||
posZ += Facing.offsetsZForSide[par7];
|
||||
double d0 = 0.0D;
|
||||
|
||||
if (par7 == 1 && Block.blocksList[i1] != null && Block.blocksList[i1].getRenderType() == 11)
|
||||
{
|
||||
d0 = 0.5D;
|
||||
}
|
||||
|
||||
int damage = stack.getItemDamage();
|
||||
switch (damage)
|
||||
{
|
||||
case 0:
|
||||
spawnEntity(posX, posY, posZ, new BlueSlime(world), world, player);
|
||||
break;
|
||||
case 1:
|
||||
spawnBossSlime(posX, posY, posZ, new BlueSlime(world), world, player);
|
||||
break;
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
--stack.stackSize;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static EntityLiving activateSpawnEgg (ItemStack stack, World world, double posX, double posY, double posZ, int par7)
|
||||
{
|
||||
int i1 = world.getBlockId((int) posX, (int) posY, (int) posZ);
|
||||
posX += Facing.offsetsXForSide[par7];
|
||||
posY += Facing.offsetsYForSide[par7];
|
||||
posZ += Facing.offsetsZForSide[par7];
|
||||
double d0 = 0.0D;
|
||||
|
||||
if (par7 == 1 && Block.blocksList[i1] != null && Block.blocksList[i1].getRenderType() == 11)
|
||||
{
|
||||
d0 = 0.5D;
|
||||
}
|
||||
|
||||
int damage = stack.getItemDamage();
|
||||
EntityLiving entity = null;
|
||||
switch (damage)
|
||||
{
|
||||
case 0:
|
||||
entity = new BlueSlime(world);
|
||||
spawnEntity(posX, posY, posZ, entity, world);
|
||||
break;
|
||||
case 1:
|
||||
entity = new BlueSlime(world);
|
||||
spawnBossSlime(posX, posY, posZ, new BlueSlime(world), world);
|
||||
break;
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static void spawnEntity (double x, double y, double z, Entity entity, World world)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setPosition(x, y, z);
|
||||
((EntityLiving) entity).func_110161_a((EntityLivingData)null);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnEntity (double x, double y, double z, Entity entity, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setPosition(x, y, z);
|
||||
entity.setAngles(player.cameraYaw, player.cameraYaw);
|
||||
((EntityLiving) entity).func_110161_a((EntityLivingData)null);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnBossSlime (double x, double y, double z, BlueSlime entity, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setPosition(x, y, z);
|
||||
entity.setAngles(player.cameraYaw, player.cameraYaw);
|
||||
entity.setSlimeSize(8);
|
||||
entity.func_110161_a((EntityLivingData)null);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnBossSlime (double x, double y, double z, BlueSlime entity, World world)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setPosition(x, y, z);
|
||||
entity.setSlimeSize(8);
|
||||
entity.func_110161_a((EntityLivingData)null);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.util.IToolPart;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ToolPart extends CraftingItem implements IToolPart
|
||||
{
|
||||
public ToolPart(int id, String textureType)
|
||||
{
|
||||
super(id, toolMaterialNames, buildTextureNames(textureType), "parts/");
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
private static String[] buildTextureNames (String textureType)
|
||||
{
|
||||
String[] names = new String[toolMaterialNames.length];
|
||||
for (int i = 0; i < toolMaterialNames.length; i++)
|
||||
{
|
||||
if (toolTextureNames[i].equals(""))
|
||||
names[i] = "";
|
||||
else
|
||||
names[i] = toolTextureNames[i] + textureType;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public static final String[] toolMaterialNames = new String[] { "Wood", "Stone", "Iron", "Flint", "Cactus", "Bone", "Obsidian", "Netherrack", "Slime", "Paper", "Cobalt", "Ardite", "Manyullyn",
|
||||
"Copper", "Bronze", "Alumite", "Steel", "Blue Slime", "", "", "", "", "", "", "", "", "", "", "", "", "", "Thaumium" };
|
||||
|
||||
public static final String[] toolTextureNames = new String[] { "wood", "stone", "iron", "flint", "cactus", "bone", "obsidian", "netherrack", "slime", "paper", "cobalt", "ardite", "manyullyn",
|
||||
"copper", "bronze", "alumite", "steel", "blueslime", "", "", "", "", "", "", "", "", "", "", "", "", "", "thaumium" };
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < 17; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
||||
if (TContent.thaumcraftAvailable)
|
||||
list.add(new ItemStack(id, 1, 31));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaterialID (ItemStack stack)
|
||||
{
|
||||
return stack.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
||||
public class ToolPartHidden extends ToolPart
|
||||
{
|
||||
|
||||
public ToolPartHidden(int id, String textureType)
|
||||
{
|
||||
super(id, textureType);
|
||||
}
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ToolShard extends ToolPart
|
||||
{
|
||||
|
||||
public ToolShard(int id, String tex)
|
||||
{
|
||||
super(id, tex);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
private static String[] buildTextureNames (String textureType)
|
||||
{
|
||||
String[] names = new String[toolMaterialNames.length];
|
||||
for (int i = 0; i < toolMaterialNames.length; i++)
|
||||
names[i] = toolTextureNames[i] + textureType;
|
||||
return names;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.icons = new Icon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
}
|
||||
icons[5] = icons[4];
|
||||
for (int i = 6; i < 9; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
}
|
||||
icons[9] = icons[8];
|
||||
for (int i = 10; i < icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 1; i < 5; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
for (int i = 6; i < 9; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
for (int i = 10; i < 17; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
||||
if (TContent.thaumcraftAvailable)
|
||||
list.add(new ItemStack(id, 1, 31));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package tconstruct.items.armor;
|
||||
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Glove extends Item
|
||||
{
|
||||
public Glove(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("tinker:armor/dirthand");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package tconstruct.items.armor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.items.CraftingItem;
|
||||
import tconstruct.util.player.ArmorExtended;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class HeartCanister extends CraftingItem
|
||||
{
|
||||
|
||||
public HeartCanister(int id)
|
||||
{
|
||||
super(id, new String[] { "empty", "miniheart.red", "heart" }, new String[] { "canister_empty", "miniheart_red", "canister_heart" }, "");
|
||||
this.setMaxStackSize(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote && stack.getItemDamage() == 2)
|
||||
{
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
if (stats != null)
|
||||
{
|
||||
ArmorExtended armor = stats.armor;
|
||||
ItemStack slotStack = armor.getStackInSlot(6);
|
||||
if (slotStack == null)// || slotStack.getItem() == this)
|
||||
{
|
||||
armor.setInventorySlotContents(6, new ItemStack(this, 1, 2));
|
||||
stack.stackSize--;
|
||||
}
|
||||
else if (slotStack.getItem() == this && slotStack.stackSize < this.maxStackSize)
|
||||
{
|
||||
slotStack.stackSize++;
|
||||
stack.stackSize--;
|
||||
}
|
||||
armor.recalculateHealth(player, stats);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
list.add("Crafting Item");
|
||||
break;
|
||||
case 1:
|
||||
list.add("Crafting Item");
|
||||
list.add("Part of low-level Heart Canisters");
|
||||
break;
|
||||
case 2:
|
||||
list.add("Accessory");
|
||||
list.add("Permanent health increase");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package tconstruct.items.armor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.items.CraftingItem;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Knapsack extends CraftingItem
|
||||
{
|
||||
|
||||
public Knapsack(int id)
|
||||
{
|
||||
super(id, new String[] { "knapsack" }, new String[] { "knapsack" }, "armor/");
|
||||
this.setMaxStackSize(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
list.add("A Knapsack to hold your things.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package tconstruct.items.armor;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TArmorBase extends ItemArmor
|
||||
//implements ISpecialArmor
|
||||
{
|
||||
Icon[] icons;
|
||||
String[] iconNames = { "wood_boots" };
|
||||
|
||||
//static Minecraft mc = Minecraft.getMinecraft();
|
||||
//private ModelBiped modelArmor;
|
||||
|
||||
public TArmorBase(int id, int armorSlot)
|
||||
{
|
||||
super(id, EnumArmorMaterial.CLOTH, 0, armorSlot);
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(100);
|
||||
setNoRepair();
|
||||
canRepair = false;
|
||||
this.setCreativeTab(CreativeTabs.tabMisc);
|
||||
//this.modelArmor = new ModelBiped(0.75F);
|
||||
//this.setCreativeTab(TConstructRegistry.toolTab);
|
||||
}
|
||||
|
||||
public void onArmorTickUpdate (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by RenderBiped and RenderPlayer to determine the armor texture that
|
||||
* should be use for the currently equiped item.
|
||||
* This will only be called on instances of ItemArmor.
|
||||
*
|
||||
* Returning null from this function will use the default value.
|
||||
*
|
||||
* @param stack ItemStack for the equpt armor
|
||||
* @param entity The entity wearing the armor
|
||||
* @param slot The slot the armor is in
|
||||
* @param layer The render layer, either 1 or 2, 2 is only used for CLOTH armor by default
|
||||
* @return Path of texture to bind, or null to use default
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, int layer)
|
||||
{
|
||||
return "/mods/tinker/textures/armor/wood_1.png";
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to have an item handle its own armor rendering.
|
||||
*
|
||||
* @param entityLiving The entity wearing the armor
|
||||
* @param itemStack The itemStack to render the model of
|
||||
* @param armorSlot 0=head, 1=torso, 2=legs, 3=feet
|
||||
*
|
||||
* @return A ModelBiped to render instead of the default
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase par1EntityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Icon getIconFromDamage (int meta)
|
||||
{
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.icons = new Icon[iconNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:armor/" + iconNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public ArmorProperties getProperties (EntityLiving player, ItemStack armor, DamageSource source, double damage, int slot)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay (EntityPlayer player, ItemStack armor, int slot)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor (EntityLiving entity, ItemStack stack, DamageSource source, int damage, int slot)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CraftedSoilItemBlock extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "Slime", "Grout", "BlueSlime", "GraveyardSoil", "ConsecratedSoil" };
|
||||
|
||||
public CraftedSoilItemBlock(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("CraftedSoil.").append(blockType[pos]).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 3:
|
||||
list.add("Heals Undead");
|
||||
break;
|
||||
case 4:
|
||||
list.add("Harmful to Undead");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class GlassBlockItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "glass.pure"};//, "glass.soul", "glass.soul.pure" };
|
||||
|
||||
public GlassBlockItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class GlassPaneItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "glass.pure", "glass.soul", "glass.soul.pure" };
|
||||
|
||||
public GlassPaneItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.").append(blockType[pos]).append(".pane").toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class GravelOreItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "iron", "gold", "copper", "tin", "aluminum", "cobalt" };
|
||||
|
||||
public GravelOreItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.ore.gravel.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class LavaTankItemBlock extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "Tank", "Gague", "Window" };
|
||||
|
||||
public LavaTankItemBlock(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("LavaTank.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
||||
public class LightCrystalItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "Crafter", "Parts", "Parts", "Parts", "Parts", "PatternChest", "PatternChest", "PatternChest", "PatternChest", "PatternChest", "PatternShaper",
|
||||
"PatternShaper", "PatternShaper", "PatternShaper", "CastingTable" };
|
||||
|
||||
public LightCrystalItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length-1);
|
||||
return (new StringBuilder()).append("ToolStation.").append(blockType[pos]).toString();
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class MetalItemBlock extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "Cobalt", "Ardite", "Manyullyn", "Copper", "Bronze", "Tin", "Aluminum", "AlBrass", "Alumite", "Steel" };
|
||||
|
||||
public MetalItemBlock(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("StorageMetals.").append(blockType[pos]).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
list.add("Usable for Beacon bases");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class MetalOreItemBlock extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "NetherSlag", "Cobalt", "Ardite", "Copper", "Tin", "Aluminum", "Slag" };
|
||||
|
||||
public MetalOreItemBlock(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("MetalOre.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class MultiBrickFancyItem extends ItemBlock
|
||||
{
|
||||
static String blockType[] = { "obsidian", "sandstone", "netherrack", "stone.refined", "iron", "gold", "lapis", "diamond", "redstone", "bone", "slime", "blueslime", "endstone", "obsidian.ingot",
|
||||
"stone", "stone.road" };
|
||||
|
||||
public MultiBrickFancyItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.fancybrick.").append(blockType[pos]).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 5:
|
||||
case 6:
|
||||
list.add("Somewhat expensive");
|
||||
break;
|
||||
case 7:
|
||||
list.add("Quite expensive");
|
||||
break;
|
||||
case 8:
|
||||
list.add("Emits Redstone signal up to");
|
||||
list.add("4 blocks away");
|
||||
break;
|
||||
case 10:
|
||||
case 11:
|
||||
list.add("Bouncy!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class MultiBrickItem extends ItemBlock
|
||||
{
|
||||
static String blockType[] = { "obsidian", "sandstone", "netherrack", "stone.refined", "iron", "gold", "lapis", "diamond", "redstone", "bone", "slime", "blueslime", "endstone", "obsidian.ingot",
|
||||
"stone.road", "stone.refined.road" };
|
||||
|
||||
public MultiBrickItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.brick.").append(blockType[pos]).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 5:
|
||||
case 6:
|
||||
list.add("Somewhat expensive");
|
||||
break;
|
||||
case 7:
|
||||
list.add("Quite expensive");
|
||||
break;
|
||||
case 8:
|
||||
list.add("Emits Redstone signal up to");
|
||||
list.add("4 blocks away");
|
||||
break;
|
||||
case 10:
|
||||
case 11:
|
||||
list.add("Bouncy!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class OreberryBushItem extends ItemBlock
|
||||
{
|
||||
public int blockID;
|
||||
|
||||
public OreberryBushItem(int id)
|
||||
{
|
||||
super(id);
|
||||
blockID = id + 256;
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta % 4;
|
||||
}
|
||||
|
||||
/* Place bushes on dirt, grass, or other bushes only */
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10)
|
||||
{
|
||||
if (side != 1)
|
||||
return false;
|
||||
|
||||
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack))
|
||||
{
|
||||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
|
||||
if (block != null && block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) TContent.oreBerry) && world.isAirBlock(x, y + 1, z))
|
||||
{
|
||||
world.setBlock(x, y + 1, z, blockID, stack.getItemDamage() % 4, 3);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
stack.stackSize--;
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, blockID);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Block name in inventory */
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.oreberry.").append(blockType[pos]).toString();
|
||||
}
|
||||
|
||||
public static final String blockType[] = { "iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin" };
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage() % 4)
|
||||
{
|
||||
case 0:
|
||||
list.add("Sweet Irony");
|
||||
break;
|
||||
case 1:
|
||||
list.add("Pure Luster");
|
||||
break;
|
||||
case 2:
|
||||
list.add("Tastes like metal");
|
||||
break;
|
||||
case 3:
|
||||
list.add("Tin Man");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class OreberryBushSecondItem extends ItemBlock
|
||||
{
|
||||
public int blockID;
|
||||
|
||||
public OreberryBushSecondItem(int id)
|
||||
{
|
||||
super(id);
|
||||
blockID = id + 256;
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta % 4;
|
||||
}
|
||||
|
||||
/* Place bushes on dirt, grass, or other bushes only */
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (side != 1)
|
||||
return false;
|
||||
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta % 4 != 1 && world.getFullBlockLightValue(x, y + 1, z) >= 13)
|
||||
return false;
|
||||
|
||||
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack))
|
||||
{
|
||||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
|
||||
if (block != null && block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) TContent.oreBerrySecond) && world.isAirBlock(x, y + 1, z))
|
||||
{
|
||||
world.setBlock(x, y + 1, z, blockID, stack.getItemDamage() % 4, 3);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
stack.stackSize--;
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, blockID);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Block name in inventory */
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.oreberry.").append(blockType[pos]).toString();
|
||||
}
|
||||
|
||||
public static final String blockType[] = { "aluminum", "essence", "", "", "aluminum", "essence", "", "", "aluminum", "essence", "", "", "aluminum", "essence", "", "" };
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage() % 4)
|
||||
{
|
||||
case 0:
|
||||
list.add("White Chocolate");
|
||||
break;
|
||||
case 1:
|
||||
list.add("Tastes like Creeper");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class RedstoneMachineItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "drawbridge", "firestarter" };
|
||||
|
||||
public RedstoneMachineItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class SearedSlabItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "brick", "stone", "cobble", "paver", "road", "fancy", "square", "creeper" };
|
||||
|
||||
public SearedSlabItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.searedstone.slab.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class SearedTableItemBlock extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "Table", "Faucet", "Basin" };
|
||||
|
||||
public SearedTableItemBlock(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("SearedBlock.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class SmelteryItemBlock extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "Controller", "Drain", "Brick", "Furnace", "Stone", "Cobblestone", "Paver", "Brick.Cracked", "Road", "Brick.Fancy", "Brick.Square" };
|
||||
|
||||
public SmelteryItemBlock(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("Smeltery.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SoilSlabItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "grass", "dirt", "mycelium", "slime", "grout", "blueslime", "graveyardsoil", "consecratedsoil" };
|
||||
|
||||
public SoilSlabItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.soil.slab.").append(blockType[pos]).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 3:
|
||||
list.add("Heals Undead");
|
||||
break;
|
||||
case 4:
|
||||
list.add("Harmful to Undead");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class SpeedBlockItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "brownstone.rough", "brownstone.rough.road", "brownstone.smooth", "brownstone.smooth.brick", "brownstone.smooth.road", "brownstone.smooth.fancy",
|
||||
"brownstone.smooth.chiseled" };
|
||||
|
||||
public SpeedBlockItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.").append(blockType[pos]).toString();
|
||||
}
|
||||
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
int metadata = stack.getItemDamage();
|
||||
if (metadata == 1 || metadata == 4)
|
||||
list.add("You run pretty fast on it");
|
||||
else
|
||||
list.add("You run a bit faster on it");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class SpeedSlabItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "brownstone.rough", "brownstone.rough.road", "brownstone.smooth", "brownstone.smooth.brick", "brownstone.smooth.road", "brownstone.smooth.fancy",
|
||||
"brownstone.smooth.chiseled" };
|
||||
|
||||
public SpeedSlabItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.").append(blockType[pos]).append(".slab").toString();
|
||||
}
|
||||
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
int metadata = stack.getItemDamage() % 8;
|
||||
if (metadata == 1 || metadata == 4)
|
||||
list.add("You run pretty fast on it");
|
||||
else
|
||||
list.add("You run a bit faster on it");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class StainedGlassClearItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black" };
|
||||
|
||||
public StainedGlassClearItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.stainedglass.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class StainedGlassClearPaneItem extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black" };
|
||||
|
||||
public StainedGlassClearPaneItem(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.stainedglass.pane.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
||||
public class ToolForgeItemBlock extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "iron", "gold", "diamond", "emerald", "cobalt", "ardite", "manyullyn", "copper", "bronze", "tin", "aluminum", "alubrass", "alumite", "steel" };
|
||||
|
||||
public ToolForgeItemBlock(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("block.ToolForge.").append(blockType[pos]).toString();
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package tconstruct.items.blocks;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class ToolStationItemBlock extends ItemBlock
|
||||
{
|
||||
public static final String blockType[] = { "Crafter", "Parts", "Parts", "Parts", "Parts", "PatternChest", "PatternChest", "PatternChest", "PatternChest", "PatternChest", "PatternShaper",
|
||||
"PatternShaper", "PatternShaper", "PatternShaper", "CastingTable" };
|
||||
|
||||
public ToolStationItemBlock(int id)
|
||||
{
|
||||
super(id);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
||||
return (new StringBuilder()).append("ToolStation.").append(blockType[pos]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Arrow extends ToolCore
|
||||
{
|
||||
|
||||
public Arrow(int id)
|
||||
{
|
||||
super(id, 3);
|
||||
this.setUnlocalizedName("InfiTool.Arrow");
|
||||
this.setMaxStackSize(64);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_arrow_head";
|
||||
case 1:
|
||||
return ""; //Doesn't break
|
||||
case 2:
|
||||
return "_arrow_shaft";
|
||||
case 3:
|
||||
return "_arrow_fletching";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_arrow_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "arrow";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
headStrings.put(index, location[0]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAlternatePartPaths (int index, String[] location)
|
||||
{
|
||||
accessoryStrings.put(index, location[3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.arrowhead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.fletching;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
{
|
||||
return new String[] { "ammo" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
//Vanilla style arrow
|
||||
Item accessory = getAccessoryItem();
|
||||
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, 0) : null;
|
||||
Item extra = getExtraItem();
|
||||
ItemStack extraStack = extra != null ? new ItemStack(extra, 1, 0) : null;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, 3), new ItemStack(getHandleItem(), 1, 0), accessoryStack, extraStack, "");
|
||||
if (tool == null)
|
||||
{
|
||||
System.out.println("Creative builder failed tool for Vanilla style" + this.getToolName());
|
||||
System.out.println("Make sure you do not have item ID conflicts");
|
||||
}
|
||||
else
|
||||
{
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
}
|
||||
|
||||
//Random arrow
|
||||
accessory = getAccessoryItem();
|
||||
accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, random.nextInt(4)) : null;
|
||||
extra = getExtraItem();
|
||||
extraStack = extra != null ? new ItemStack(extra, 1, 0) : null;
|
||||
tool = ToolBuilder.instance
|
||||
.buildTool(new ItemStack(getHeadItem(), 1, random.nextInt(18)), new ItemStack(getHandleItem(), 1, random.nextInt(18)), accessoryStack, extraStack, "Random Streamer");
|
||||
|
||||
if (tool == null)
|
||||
{
|
||||
System.out.println("Creative builder failed tool for Vanilla style" + this.getToolName());
|
||||
System.out.println("Make sure you do not have item ID conflicts");
|
||||
}
|
||||
else
|
||||
{
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
}
|
||||
super.getSubItems(id, tab, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTool (int id, String name, List list)
|
||||
{
|
||||
Item accessory = getAccessoryItem();
|
||||
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, 0) : null;
|
||||
Item extra = getExtraItem();
|
||||
ItemStack extraStack = extra != null ? new ItemStack(getExtraItem(), 1, id) : null;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), new ItemStack(getHandleItem(), 1, id), accessoryStack, extraStack, name + getToolName());
|
||||
if (tool == null)
|
||||
{
|
||||
System.out.println("Creative builder failed tool for " + name + this.getToolName());
|
||||
System.out.println("Make sure you do not have item ID conflicts");
|
||||
}
|
||||
else
|
||||
{
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags.hasKey("charge"))
|
||||
{
|
||||
String color = "";
|
||||
//double joules = this.getJoules(stack);
|
||||
int power = tags.getInteger("charge");
|
||||
|
||||
if (power != 0)
|
||||
{
|
||||
if (power <= this.getMaxCharge(stack) / 3)
|
||||
color = "\u00a74";
|
||||
else if (power > this.getMaxCharge(stack) * 2 / 3)
|
||||
color = "\u00a72";
|
||||
else
|
||||
color = "\u00a76";
|
||||
}
|
||||
|
||||
String charge = new StringBuilder().append(color).append(tags.getInteger("charge")).append("/").append(getMaxCharge(stack)).append(" EU").toString();
|
||||
list.add(charge);
|
||||
}
|
||||
if (tags.hasKey("InfiTool"))
|
||||
{
|
||||
boolean broken = tags.getCompoundTag("InfiTool").getBoolean("Broken");
|
||||
if (broken)
|
||||
list.add("\u00A7oBroken");
|
||||
else
|
||||
{
|
||||
int head = tags.getCompoundTag("InfiTool").getInteger("Head");
|
||||
int handle = tags.getCompoundTag("InfiTool").getInteger("Handle");
|
||||
|
||||
String headName = getAbilityNameForType(head);
|
||||
if (!headName.equals(""))
|
||||
list.add(getStyleForType(head) + headName);
|
||||
|
||||
String handleName = getAbilityNameForType(handle);
|
||||
if (!handleName.equals("") && handle != head)
|
||||
list.add(getStyleForType(handle) + handleName);
|
||||
|
||||
int unbreaking = tags.getCompoundTag("InfiTool").getInteger("Unbreaking");
|
||||
String reinforced = getReinforcedName(head, handle, 0, 0, unbreaking);
|
||||
if (!reinforced.equals(""))
|
||||
list.add(reinforced);
|
||||
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.getCompoundTag("InfiTool").hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getCompoundTag("InfiTool").getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import net.minecraft.item.Item;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BattleSign extends Weapon
|
||||
{
|
||||
public BattleSign(int itemID)
|
||||
{
|
||||
super(itemID, 1);
|
||||
this.setUnlocalizedName("InfiTool.Battlesign");
|
||||
}
|
||||
|
||||
/*public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}*/
|
||||
|
||||
public String getToolName ()
|
||||
{
|
||||
return "Battlesign";
|
||||
}
|
||||
|
||||
/*public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if (par7 == 0 || !player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!par3World.getBlockMaterial(par4, par5, par6).isSolid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (par7 == 1)
|
||||
{
|
||||
++par5;
|
||||
}
|
||||
|
||||
if (par7 == 2)
|
||||
{
|
||||
--par6;
|
||||
}
|
||||
|
||||
if (par7 == 3)
|
||||
{
|
||||
++par6;
|
||||
}
|
||||
|
||||
if (par7 == 4)
|
||||
{
|
||||
--par4;
|
||||
}
|
||||
|
||||
if (par7 == 5)
|
||||
{
|
||||
++par4;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!Block.signPost.canPlaceBlockAt(par3World, par4, par5, par6))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (par7 == 1)
|
||||
{
|
||||
int var11 = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
|
||||
par3World.setBlock(par4, par5, par6, Block.signPost.blockID, var11);
|
||||
}
|
||||
else
|
||||
{
|
||||
par3World.setBlock(par4, par5, par6, Block.signWall.blockID, par7);
|
||||
}
|
||||
|
||||
//--par1ItemStack.stackSize;
|
||||
TileEntitySign var12 = (TileEntitySign)par3World.getBlockTileEntity(par4, par5, par6);
|
||||
|
||||
if (var12 != null)
|
||||
{
|
||||
player.displayGUIEditSign(var12);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.signHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
headStrings.put(index, location[0]);
|
||||
brokenPartStrings.put(index, location[1]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_battlesign_head";
|
||||
case 1:
|
||||
return "_battlesign_head_broken";
|
||||
case 2:
|
||||
return "_battlesign_handle";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_battlesign_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "battlesign";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Battleaxe extends HarvestTool
|
||||
{
|
||||
public Battleaxe(int itemID)
|
||||
{
|
||||
super(itemID, 4);
|
||||
this.setUnlocalizedName("InfiTool.Battleaxe");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
return "axe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed (ItemStack itemstack, World world, int bID, int x, int y, int z, EntityLivingBase player)
|
||||
{
|
||||
Block block = Block.blocksList[bID];
|
||||
if (block != null && block.blockMaterial == Material.leaves)
|
||||
return false;
|
||||
|
||||
return AbilityHelper.onBlockChanged(itemstack, world, bID, x, y, z, player, random);
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.wood, Material.vine, Material.circuits, Material.cactus, Material.pumpkin };
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.broadAxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
return TContent.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.broadAxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
return TContent.toughBinding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
return 2.5f;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_battleaxe_fronthead";
|
||||
case 1:
|
||||
return "_battleaxe_fronthead_broken";
|
||||
case 2:
|
||||
return "_battleaxe_handle";
|
||||
case 3:
|
||||
return "_battleaxe_backhead";
|
||||
case 4:
|
||||
return "_battleaxe_binding";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_battleaxe_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "battleaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
{
|
||||
return new String[] { "weapon", "harvest", "melee", "slicing" };
|
||||
}
|
||||
|
||||
/* Battleaxe Specific */
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
//player.rotationYaw += 1;
|
||||
//if (player.onGround)
|
||||
//{
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
//}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int useCount)
|
||||
{
|
||||
//if (player.onGround)
|
||||
{
|
||||
int time = this.getMaxItemUseDuration(stack) - useCount;
|
||||
int boost = time / 100;
|
||||
if (boost > 2)
|
||||
boost = 2;
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, time * 4, boost));
|
||||
player.addPotionEffect(new PotionEffect(Potion.jump.id, time * 4, boost));
|
||||
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, time * 4, 0));
|
||||
player.addPotionEffect(new PotionEffect(Potion.hunger.id, time * 2, 0));
|
||||
if (time > 5 && player.onGround)
|
||||
{
|
||||
player.addExhaustion(0.2F);
|
||||
player.setSprinting(true);
|
||||
|
||||
float speed = 0.025F * time;
|
||||
if (speed > 0.925f)
|
||||
speed = 0.925f;
|
||||
|
||||
float increase = (float) (0.02 * time + 0.2);
|
||||
if (increase > 0.56f)
|
||||
increase = 0.56f;
|
||||
player.motionY += increase;
|
||||
|
||||
player.motionX = (double) (-MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * speed);
|
||||
player.motionZ = (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration (ItemStack par1ItemStack)
|
||||
{
|
||||
return 72000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity (ItemStack stack, EntityLivingBase mob, EntityLivingBase player)
|
||||
{
|
||||
AbilityHelper.knockbackEntity(mob, 1.5f);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
player.movementInput.moveForward *= 5.0F;
|
||||
player.movementInput.moveStrafe *= 5.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
final int woodID = world.getBlockId(x, y, z);
|
||||
final Block wood = Block.blocksList[woodID];
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
for (int yPos = y + 1; yPos < y + 9; yPos++)
|
||||
{
|
||||
int blockID = world.getBlockId(x, yPos, z);
|
||||
Block block = Block.blocksList[blockID];
|
||||
if (!(tags.getBoolean("Broken")) && block != null && block.blockMaterial == Material.wood)
|
||||
{
|
||||
int localblockID = world.getBlockId(x, yPos, z);
|
||||
int localMeta = world.getBlockMetadata(x, yPos, z);
|
||||
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, x, yPos, z, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (block != null && block.blockMaterial == Material.wood)
|
||||
{
|
||||
localMeta = world.getBlockMetadata(x, yPos, z);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
block.harvestBlock(world, player, x, yPos, z, localMeta);
|
||||
block.onBlockHarvested(world, x, y, z, localMeta, player);
|
||||
onBlockDestroyed(stack, world, localblockID, x, yPos, z, player);
|
||||
}
|
||||
world.setBlockToAir(x, yPos, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, woodID + (meta << 12));
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Broadsword extends Weapon
|
||||
{
|
||||
public Broadsword(int itemID)
|
||||
{
|
||||
super(itemID, 4);
|
||||
this.setUnlocalizedName("InfiTool.Broadsword");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.swordBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.wideGuard;
|
||||
}
|
||||
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
return 1.2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_sword_blade";
|
||||
case 1:
|
||||
return "_sword_blade_broken";
|
||||
case 2:
|
||||
return "_sword_handle";
|
||||
case 3:
|
||||
return "_sword_accessory";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_sword_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "broadsword";
|
||||
}
|
||||
|
||||
/*@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
if (player.itemInUse != null && player.itemInUse.getItem() == this)
|
||||
{
|
||||
player.movementInput.moveForward *= 5.0F;
|
||||
player.movementInput.moveStrafe *= 5.0F;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.crafting.Detailing.DetailInput;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Chisel extends ToolCore
|
||||
{
|
||||
public Chisel(int id)
|
||||
{
|
||||
super(id, 0);
|
||||
this.setUnlocalizedName("InfiTool.Chisel");
|
||||
this.setContainerItem(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItemStack (ItemStack itemStack)
|
||||
{
|
||||
//AbilityHelper.damageTool(itemStack, 1, null, false);
|
||||
|
||||
int reinforced = 0;
|
||||
NBTTagCompound tags = itemStack.getTagCompound();
|
||||
|
||||
if (tags.getCompoundTag("InfiTool").hasKey("Unbreaking"))
|
||||
reinforced = tags.getCompoundTag("InfiTool").getInteger("Unbreaking");
|
||||
|
||||
if (random.nextInt(10) < 10 - reinforced)
|
||||
{
|
||||
AbilityHelper.damageTool(itemStack, 1, null, false);
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean performDetailing (World world, int x, int y, int z, int blockID, int blockMeta)
|
||||
{
|
||||
boolean detailed = false;
|
||||
return detailed;
|
||||
}
|
||||
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
if (entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
onEaten(stack, world, entityplayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.getBoolean("Broken"))
|
||||
entityplayer.setItemInUse(stack, getMaxItemUseDuration(stack));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten (ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(world, entityplayer, true);
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
|
||||
{
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
int blockID = world.getBlockId(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
DetailInput details = TConstruct.chiselDetailing.getDetailing(blockID, meta);
|
||||
if (details != null && details.outputID < 4096)
|
||||
{
|
||||
world.setBlock(x, y, z, details.outputID, details.outputMeta, 3);
|
||||
if (!(entityplayer.capabilities.isCreativeMode))
|
||||
{
|
||||
int reinforced = 0;
|
||||
NBTTagCompound tags = itemstack.getTagCompound();
|
||||
|
||||
if (tags.getCompoundTag("InfiTool").hasKey("Unbreaking"))
|
||||
reinforced = tags.getCompoundTag("InfiTool").getInteger("Unbreaking");
|
||||
|
||||
if (random.nextInt(10) < 10 - reinforced)
|
||||
{
|
||||
AbilityHelper.damageTool(itemstack, 1, null, false);
|
||||
}
|
||||
}
|
||||
world.playAuxSFX(2001, x, y, z, blockID + (meta << 12));
|
||||
entityplayer.swingItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
player.movementInput.moveForward *= 2.0;
|
||||
player.movementInput.moveStrafe *= 2.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration (ItemStack itemstack)
|
||||
{
|
||||
if (!itemstack.hasTagCompound())
|
||||
return 20;
|
||||
|
||||
int speed = itemstack.getTagCompound().getCompoundTag("InfiTool").getInteger("MiningSpeed") / 100;
|
||||
int truespeed = 20 - speed;
|
||||
if (truespeed < 0)
|
||||
truespeed = 0;
|
||||
return truespeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack itemstack)
|
||||
{
|
||||
return EnumAction.eat;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
headStrings.put(index, location[0]);
|
||||
brokenPartStrings.put(index, location[1]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_chisel_head";
|
||||
case 1:
|
||||
return "_chisel_head_broken";
|
||||
case 2:
|
||||
return "_chisel_handle";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_chisel_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "chisel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.chiselHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
{
|
||||
return new String[] { "utility" };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Cleaver extends Weapon
|
||||
{
|
||||
public Cleaver(int itemID)
|
||||
{
|
||||
super(itemID, 4);
|
||||
this.setUnlocalizedName("InfiTool.Cleaver");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.largeSwordBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
return TContent.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.heavyPlate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
return TContent.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
return 2.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageModifier ()
|
||||
{
|
||||
return 1.25f;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_cleaver_head";
|
||||
case 1:
|
||||
return "_cleaver_head_broken";
|
||||
case 2:
|
||||
return "_cleaver_handle";
|
||||
case 3:
|
||||
return "_cleaver_shield";
|
||||
case 4:
|
||||
return "_cleaver_guard";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_cleaver_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "cleaver";
|
||||
}
|
||||
|
||||
/* Cleaver specific */
|
||||
@Override
|
||||
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
if (AbilityHelper.onLeftClickEntity(stack, player, entity, this))
|
||||
{
|
||||
entity.hurtResistantTime += 7;
|
||||
|
||||
/*if (entity instanceof EntityLiving)
|
||||
{
|
||||
EntityLiving living = (EntityLiving) entity;
|
||||
if (living.getHealth() <= 0)
|
||||
{
|
||||
|
||||
}
|
||||
}*/
|
||||
//if (entity.getHealth() <= 0)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == stack)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public boolean onEntitySwing (EntityLiving entity, ItemStack stack)
|
||||
{
|
||||
entity.swingProgressInt /= 2;
|
||||
return false;
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Cutlass extends Weapon
|
||||
{
|
||||
public Cutlass(int itemID)
|
||||
{
|
||||
super(itemID, 4);
|
||||
this.setUnlocalizedName("InfiTool.Cutlass");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.swordBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.fullGuard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_cutlass_blade";
|
||||
case 1:
|
||||
return "_cutlass_blade_broken";
|
||||
case 2:
|
||||
return "_cutlass_handle";
|
||||
case 3:
|
||||
return "_cutlass_guard";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_cutlass_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "cutlass";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.entity.projectile.DaggerEntity;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Dagger extends Weapon
|
||||
{
|
||||
public Dagger(int id)
|
||||
{
|
||||
super(id, 1);
|
||||
this.setUnlocalizedName("InfiTool.Dagger");
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick (ItemStack itemstack, World world, EntityPlayer player)
|
||||
{
|
||||
ItemStack stack = itemstack.copy();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
DaggerEntity dagger = new DaggerEntity(stack, world, player);
|
||||
world.spawnEntityInWorld(dagger);
|
||||
}
|
||||
itemstack.stackSize--;
|
||||
return itemstack;
|
||||
/*player.setItemInUse(itemstack, this.getMaxItemUseDuration(itemstack));
|
||||
return itemstack;*/
|
||||
}
|
||||
|
||||
public ItemStack onEaten (ItemStack itemstack, World world, EntityPlayer player)
|
||||
{
|
||||
ItemStack stack = itemstack.copy();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
DaggerEntity dagger = new DaggerEntity(stack, world, player);
|
||||
world.spawnEntityInWorld(dagger);
|
||||
}
|
||||
itemstack.stackSize--;
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
{
|
||||
return new String[] { "weapon", "melee", "throwing" };
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration (ItemStack stack)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
public boolean rangedTool ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_dagger_blade";
|
||||
case 1:
|
||||
return "_dagger_blade_broken";
|
||||
case 2:
|
||||
return "_dagger_handle";
|
||||
case 3:
|
||||
return "_dagger_accessory";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_dagger_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "dagger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.knifeBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.crossbar;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Excavator extends HarvestTool
|
||||
{
|
||||
public Excavator(int itemID)
|
||||
{
|
||||
super(itemID, 2);
|
||||
this.setUnlocalizedName("InfiTool.Excavator");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
return "shovel";
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.excavatorHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
return TContent.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.heavyPlate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
return TContent.toughBinding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
return 2.75f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_excavator_head";
|
||||
case 1:
|
||||
return "_excavator_head_broken";
|
||||
case 2:
|
||||
return "_excavator_handle";
|
||||
case 3:
|
||||
return "_excavator_binding";
|
||||
case 4:
|
||||
return "_excavator_grip";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_excavator_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "excavator";
|
||||
}
|
||||
|
||||
/* Excavator Specific */
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
final int blockID = world.getBlockId(x, y, z);
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
Block block = Block.blocksList[blockID];
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
|
||||
if (block == null)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
float blockHardness = block.getBlockHardness(world, x, y, z);
|
||||
|
||||
boolean validStart = false;
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == block.blockMaterial)
|
||||
{
|
||||
validStart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, player, true, 5.0D);
|
||||
if (mop == null || !validStart)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
int xRange = 1;
|
||||
int yRange = 1;
|
||||
int zRange = 1;
|
||||
switch (mop.sideHit)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
yRange = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
zRange = 0;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
xRange = 0;
|
||||
break;
|
||||
}
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
|
||||
{
|
||||
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
|
||||
{
|
||||
for (int zPos = z - zRange; zPos <= z + zRange; zPos++)
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
{
|
||||
int localblockID = world.getBlockId(xPos, yPos, zPos);
|
||||
block = Block.blocksList[localblockID];
|
||||
int localMeta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
|
||||
float localHardness = block == null ? Float.MAX_VALUE : block.getBlockHardness(world, xPos, yPos, zPos);
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel") && localHardness - 1.5 <= blockHardness)
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (block != null && !(localHardness < 0))
|
||||
{
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == block.blockMaterial)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
block.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
block.onBlockHarvested(world, x, y, z, localMeta, player);
|
||||
if (blockHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
|
||||
}
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, blockID + (meta << 12));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock (ItemStack stack, Block block, int meta)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return 1.0f;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Broken"))
|
||||
return 0.1f;
|
||||
|
||||
Material[] materials = getEffectiveMaterials();
|
||||
for (int i = 0; i < materials.length; i++)
|
||||
{
|
||||
if (materials[i] == block.blockMaterial)
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed");
|
||||
int heads = 1;
|
||||
if (tags.hasKey("MiningSpeed2"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeed2");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedHandle"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedHandle");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedExtra"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedExtra");
|
||||
heads++;
|
||||
}
|
||||
float trueSpeed = mineSpeed / (heads * 300f);
|
||||
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
|
||||
int durability = tags.getInteger("Damage");
|
||||
|
||||
float stonebound = tags.getFloat("Shoddy");
|
||||
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
trueSpeed += bonusLog;
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
return trueSpeed;
|
||||
return 0.1f;
|
||||
}
|
||||
}
|
||||
return super.getStrVsBlock(stack, block, meta);
|
||||
}
|
||||
/*@Override
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == stack)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.blocks.logic.EquipLogic;
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class FryingPan extends Weapon
|
||||
{
|
||||
public FryingPan(int itemID)
|
||||
{
|
||||
super(itemID, 2);
|
||||
this.setUnlocalizedName("InfiTool.FryingPan");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity (ItemStack stack, EntityLivingBase mob, EntityLivingBase player)
|
||||
{
|
||||
AbilityHelper.knockbackEntity(mob, 1.7f);
|
||||
mob.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 0)); //5 seconds of stun
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity mob)
|
||||
{
|
||||
if (mob.canAttackWithItem() && !mob.func_85031_j(player) && mob.hurtResistantTime < 14)
|
||||
AbilityHelper.onLeftClickEntity(stack, player, mob, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamaged (World world, EntityLivingBase player, Entity entity)
|
||||
{
|
||||
world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "sounds.frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
|
||||
public String getToolName ()
|
||||
{
|
||||
return "Frying Pan";
|
||||
}
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
super.getSubItems(id, tab, list);
|
||||
|
||||
Item accessory = getAccessoryItem();
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, 2), new ItemStack(getHandleItem(), 1, 16), null, "Bane of Pigs");
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
tags.setInteger("Modifiers", 0);
|
||||
tags.setInteger("Attack", Integer.MAX_VALUE / 100);
|
||||
tags.setInteger("TotalDurability", Integer.MAX_VALUE / 100);
|
||||
tags.setInteger("BaseDurability", Integer.MAX_VALUE / 100);
|
||||
tags.setInteger("MiningSpeed", Integer.MAX_VALUE / 100);
|
||||
|
||||
int[] keyPair = new int[] { Integer.MAX_VALUE / 100, 0, 0 };
|
||||
tags.setIntArray("Blaze", keyPair);
|
||||
tags.setInteger("Necrotic", Integer.MAX_VALUE / 100);
|
||||
tags.setInteger("Effect1", 7);
|
||||
|
||||
tags.setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
}
|
||||
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
if (side == 0 || !player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!world.getBlockMaterial(x, y, z).isSolid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
++y;
|
||||
}
|
||||
|
||||
if (side == 2)
|
||||
{
|
||||
--z;
|
||||
}
|
||||
|
||||
if (side == 3)
|
||||
{
|
||||
++z;
|
||||
}
|
||||
|
||||
if (side == 4)
|
||||
{
|
||||
--x;
|
||||
}
|
||||
|
||||
if (side == 5)
|
||||
{
|
||||
++x;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!TContent.heldItemBlock.canPlaceBlockAt(world, x, y, z))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setBlock(x, y, z, TContent.heldItemBlock.blockID, 0, 3);
|
||||
world.playSoundEffect(x, y, z, "sounds.frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 0.65F);
|
||||
|
||||
EquipLogic logic = (EquipLogic) world.getBlockTileEntity(x, y, z);
|
||||
logic.setEquipmentItem(stack);
|
||||
--stack.stackSize;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.frypanHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
headStrings.put(index, location[0]);
|
||||
brokenPartStrings.put(index, location[1]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_frypan_head";
|
||||
case 1:
|
||||
return "_frypan_head_broken";
|
||||
case 2:
|
||||
return "_frypan_handle";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_frypan_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "frypan";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Hammer extends HarvestTool
|
||||
{
|
||||
public Hammer(int itemID)
|
||||
{
|
||||
super(itemID, 2);
|
||||
this.setUnlocalizedName("InfiTool.Hammer");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
return "pickaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
return materials;
|
||||
}
|
||||
|
||||
static Material[] materials = new Material[] { Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil };
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.hammerHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
return TContent.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.heavyPlate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
return TContent.heavyPlate;
|
||||
}
|
||||
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
return 4.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_hammer_head";
|
||||
case 1:
|
||||
return "_hammer_handle_broken";
|
||||
case 2:
|
||||
return "_hammer_handle";
|
||||
case 3:
|
||||
return "_hammer_front";
|
||||
case 4:
|
||||
return "_hammer_back";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_hammer_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "hammer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon (ItemStack stack, int renderPass)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
if (tags != null)
|
||||
{
|
||||
tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (renderPass < getPartAmount())
|
||||
{
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
if (tags.getBoolean("Broken"))
|
||||
return (brokenIcons.get(tags.getInteger("RenderHandle")));
|
||||
return handleIcons.get(tags.getInteger("RenderHandle"));
|
||||
}
|
||||
|
||||
else if (renderPass == 1) // Head
|
||||
{
|
||||
return (headIcons.get(tags.getInteger("RenderHead")));
|
||||
}
|
||||
|
||||
else if (renderPass == 2) // Accessory
|
||||
{
|
||||
return (accessoryIcons.get(tags.getInteger("RenderAccessory")));
|
||||
}
|
||||
|
||||
else if (renderPass == 3) // Extra
|
||||
{
|
||||
return (extraIcons.get(tags.getInteger("RenderExtra")));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (renderPass == getPartAmount())
|
||||
{
|
||||
if (tags.hasKey("Effect1"))
|
||||
return (effectIcons.get(tags.getInteger("Effect1")));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 1)
|
||||
{
|
||||
if (tags.hasKey("Effect2"))
|
||||
return (effectIcons.get(tags.getInteger("Effect2")));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 2)
|
||||
{
|
||||
if (tags.hasKey("Effect3"))
|
||||
return (effectIcons.get(tags.getInteger("Effect3")));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 3)
|
||||
{
|
||||
if (tags.hasKey("Effect4"))
|
||||
return (effectIcons.get(tags.getInteger("Effect4")));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 4)
|
||||
{
|
||||
if (tags.hasKey("Effect5"))
|
||||
return (effectIcons.get(tags.getInteger("Effect5")));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 5)
|
||||
{
|
||||
if (tags.hasKey("Effect6"))
|
||||
return (effectIcons.get(tags.getInteger("Effect6")));
|
||||
}
|
||||
}
|
||||
return blankSprite;
|
||||
}
|
||||
return emptyIcon;
|
||||
}
|
||||
|
||||
ArrayList<int[]> coords = new ArrayList<int[]>();
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
final int blockID = world.getBlockId(x, y, z);
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
Block block = Block.blocksList[blockID];
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
|
||||
if (block == null)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
float blockHardness = block.getBlockHardness(world, x, y, z);
|
||||
|
||||
boolean validStart = false;
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == block.blockMaterial)
|
||||
{
|
||||
validStart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, player, true, 5.0D);
|
||||
if (mop == null || !validStart)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
int xRange = 1;
|
||||
int yRange = 1;
|
||||
int zRange = 1;
|
||||
switch (mop.sideHit)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
yRange = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
zRange = 0;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
xRange = 0;
|
||||
break;
|
||||
}
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
|
||||
{
|
||||
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
|
||||
{
|
||||
for (int zPos = z - zRange; zPos <= z + zRange; zPos++)
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
{
|
||||
int localblockID = world.getBlockId(xPos, yPos, zPos);
|
||||
block = Block.blocksList[localblockID];
|
||||
int localMeta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
|
||||
float localHardness = block == null ? Float.MAX_VALUE : block.getBlockHardness(world, xPos, yPos, zPos);
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel") && localHardness - 1.5 <= blockHardness)
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (block != null && !(localHardness < 0))
|
||||
{
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == block.blockMaterial)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
block.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
block.onBlockHarvested(world, x, y, z, localMeta, player);
|
||||
if (blockHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
|
||||
}
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, blockID + (meta << 12));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock (ItemStack stack, Block block, int meta)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return 1.0f;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Broken"))
|
||||
return 0.1f;
|
||||
|
||||
Material[] materials = getEffectiveMaterials();
|
||||
for (int i = 0; i < materials.length; i++)
|
||||
{
|
||||
if (materials[i] == block.blockMaterial)
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed");
|
||||
int heads = 1;
|
||||
if (tags.hasKey("MiningSpeed2"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeed2");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedHandle"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedHandle");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedExtra"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedExtra");
|
||||
heads++;
|
||||
}
|
||||
float trueSpeed = mineSpeed / (heads * 300f);
|
||||
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
|
||||
int durability = tags.getInteger("Damage");
|
||||
|
||||
float stonebound = tags.getFloat("Shoddy");
|
||||
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
trueSpeed += bonusLog;
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
return trueSpeed;
|
||||
return 0.1f;
|
||||
}
|
||||
}
|
||||
return super.getStrVsBlock(stack, block, meta);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == stack)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
{
|
||||
return new String[] { "weapon", "harvest", "melee", "bludgeoning" };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Hatchet extends HarvestTool
|
||||
{
|
||||
public Hatchet(int itemID)
|
||||
{
|
||||
super(itemID, 3);
|
||||
this.setUnlocalizedName("InfiTool.Axe");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
return "axe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed (ItemStack itemstack, World world, int bID, int x, int y, int z, EntityLivingBase player)
|
||||
{
|
||||
Block block = Block.blocksList[bID];
|
||||
if (block != null && block.blockMaterial == Material.leaves)
|
||||
return false;
|
||||
|
||||
return AbilityHelper.onBlockChanged(itemstack, world, bID, x, y, z, player, random);
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.wood, Material.leaves, Material.vine, Material.circuits, Material.cactus, Material.pumpkin };
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.hatchetHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
headStrings.put(index, location[0]);
|
||||
brokenPartStrings.put(index, location[1]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_axe_head";
|
||||
case 1:
|
||||
return "_axe_head_broken";
|
||||
case 2:
|
||||
return "_axe_handle";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_axe_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "axe";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Longsword extends Weapon
|
||||
{
|
||||
public Longsword(int itemID)
|
||||
{
|
||||
super(itemID, 4);
|
||||
this.setUnlocalizedName("InfiTool.Longsword");
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (player.onGround)
|
||||
{
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public float chargeAttack ()
|
||||
{
|
||||
return 1.5f;
|
||||
}
|
||||
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int useCount)
|
||||
{
|
||||
/*if (player.onGround)
|
||||
{
|
||||
int time = this.getMaxItemUseDuration(stack) - useCount;
|
||||
if (time > 5)
|
||||
{
|
||||
player.addExhaustion(0.2F);
|
||||
player.setSprinting(true);
|
||||
|
||||
float speed = 0.05F * time;
|
||||
if (speed > 0.925f)
|
||||
speed = 0.925f;
|
||||
|
||||
float increase = (float) (0.02 * time + 0.2);
|
||||
if (increase > 0.56f)
|
||||
increase = 0.56f;
|
||||
player.motionY += increase + speed/3;
|
||||
|
||||
player.motionX = (double) (-MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * speed);
|
||||
player.motionZ = (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * speed);
|
||||
}
|
||||
}*/
|
||||
int time = this.getMaxItemUseDuration(stack) - useCount;
|
||||
if (time > 5)
|
||||
{
|
||||
player.addExhaustion(0.2F);
|
||||
player.setSprinting(true);
|
||||
|
||||
float increase = (float) (0.02 * time + 0.2);
|
||||
if (increase > 0.56f)
|
||||
increase = 0.56f;
|
||||
player.motionY += increase;
|
||||
|
||||
float speed = 0.05F * time;
|
||||
if (speed > 0.925f)
|
||||
speed = 0.925f;
|
||||
player.motionX = (double) (-MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * speed);
|
||||
player.motionZ = (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * speed);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
player.movementInput.moveForward *= 5.0F;
|
||||
player.movementInput.moveStrafe *= 5.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.swordBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.handGuard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_longsword_blade";
|
||||
case 1:
|
||||
return "_longsword_blade_broken";
|
||||
case 2:
|
||||
return "_longsword_handle";
|
||||
case 3:
|
||||
return "_longsword_accessory";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_longsword_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "longsword";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,381 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class LumberAxe extends HarvestTool
|
||||
{
|
||||
public LumberAxe(int itemID)
|
||||
{
|
||||
super(itemID, 0);
|
||||
this.setUnlocalizedName("InfiTool.LumberAxe");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
return "axe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
return 2.5f;
|
||||
}
|
||||
|
||||
public String getToolName ()
|
||||
{
|
||||
return "Lumber Axe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed (ItemStack itemstack, World world, int bID, int x, int y, int z, EntityLivingBase player)
|
||||
{
|
||||
Block block = Block.blocksList[bID];
|
||||
if (block != null && block.blockMaterial == Material.leaves)
|
||||
return false;
|
||||
|
||||
return AbilityHelper.onBlockChanged(itemstack, world, bID, x, y, z, player, random);
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.wood, Material.vine, Material.circuits, Material.cactus, Material.pumpkin };
|
||||
|
||||
/* Lumber axe specific */
|
||||
|
||||
/*@Override
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == stack)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock (ItemStack stack, Block block, int meta)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return 1.0f;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Broken"))
|
||||
return 0.1f;
|
||||
|
||||
Material[] materials = getEffectiveMaterials();
|
||||
for (int i = 0; i < materials.length; i++)
|
||||
{
|
||||
if (materials[i] == block.blockMaterial)
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed");
|
||||
int heads = 1;
|
||||
if (tags.hasKey("MiningSpeed2"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeed2");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedHandle"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedHandle");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedExtra"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedExtra");
|
||||
heads++;
|
||||
}
|
||||
float trueSpeed = mineSpeed / (heads * 300f);
|
||||
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
|
||||
int durability = tags.getInteger("Damage");
|
||||
|
||||
float stonebound = tags.getFloat("Shoddy");
|
||||
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
trueSpeed += bonusLog;
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
return trueSpeed;
|
||||
return 0.1f;
|
||||
}
|
||||
}
|
||||
return super.getStrVsBlock(stack, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
final int woodID = world.getBlockId(x, y, z);
|
||||
final Block wood = Block.blocksList[woodID];
|
||||
if (wood.isWood(world, x, y, z))
|
||||
{
|
||||
int height = y;
|
||||
boolean foundTop = false;
|
||||
do
|
||||
{
|
||||
height++;
|
||||
int blockID = world.getBlockId(x, height, z);
|
||||
if (blockID != woodID)
|
||||
{
|
||||
height--;
|
||||
foundTop = true;
|
||||
}
|
||||
} while (!foundTop);
|
||||
|
||||
int numLeaves = 0;
|
||||
if (height - y < 30)
|
||||
{
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
{
|
||||
for (int yPos = height - 1; yPos <= height + 1; yPos++)
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
Block leaves = Block.blocksList[world.getBlockId(xPos, yPos, zPos)];
|
||||
if (leaves != null && leaves.isLeaves(world, xPos, yPos, zPos))
|
||||
numLeaves++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (numLeaves > 3)
|
||||
breakTree(world, x, y, z, stack, tags, woodID, meta, player);
|
||||
else
|
||||
destroyWood(world, x, y, z, stack, tags, player);
|
||||
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, woodID + (meta << 12));
|
||||
}
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
void breakTree (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, int bID, int meta, EntityPlayer player)
|
||||
{
|
||||
Block block;
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
{
|
||||
for (int yPos = y; yPos <= y + 1; yPos++)
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
{
|
||||
int localblockID = world.getBlockId(xPos, yPos, zPos);
|
||||
if (bID == localblockID)
|
||||
{
|
||||
block = Block.blocksList[localblockID];
|
||||
meta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (cancelHarvest)
|
||||
{
|
||||
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (localblockID == bID && world.getBlockMetadata(xPos, yPos, zPos) % 4 == meta % 4)
|
||||
{
|
||||
/* world.setBlock(xPos, yPos, zPos, 0, 0, 3);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
Block.blocksList[bID].harvestBlock(world, player, xPos, yPos, zPos, meta);
|
||||
onBlockDestroyed(stack, world, bID, xPos, yPos, zPos, player);
|
||||
}*/
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
|
||||
block.onBlockHarvested(world, x, y, z, meta, player);
|
||||
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
|
||||
}
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
|
||||
}
|
||||
/*else
|
||||
{
|
||||
Block leaves = Block.blocksList[localID];
|
||||
if (leaves != null && leaves.isLeaves(world, xPos, yPos, zPos))
|
||||
{
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
Block.blocksList[bID].harvestBlock(world, player, xPos, yPos, zPos, meta);
|
||||
onBlockDestroyed(stack, world, bID, xPos, yPos, zPos, player);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void destroyWood (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, EntityPlayer player)
|
||||
{
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
{
|
||||
for (int yPos = y - 1; yPos <= y + 1; yPos++)
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
{
|
||||
int localblockID = world.getBlockId(xPos, yPos, zPos);
|
||||
Block block = Block.blocksList[localblockID];
|
||||
int meta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (block != null && block.blockMaterial == Material.wood)
|
||||
{
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
|
||||
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.broadAxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
return TContent.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.heavyPlate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
return TContent.toughBinding;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_lumberaxe_head";
|
||||
case 1:
|
||||
return "_lumberaxe_head_broken";
|
||||
case 2:
|
||||
return "_lumberaxe_handle";
|
||||
case 3:
|
||||
return "_lumberaxe_shield";
|
||||
case 4:
|
||||
return "_lumberaxe_binding";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_lumberaxe_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "lumberaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.DualHarvestTool;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Mattock extends DualHarvestTool
|
||||
{
|
||||
public Mattock(int itemID)
|
||||
{
|
||||
super(itemID, 3);
|
||||
this.setUnlocalizedName("InfiTool.Mattock");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
return axeMaterials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveSecondaryMaterials ()
|
||||
{
|
||||
return shovelMaterials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
return "axe";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSecondHarvestType ()
|
||||
{
|
||||
return "shovel";
|
||||
}
|
||||
|
||||
static Material[] axeMaterials = { Material.wood, Material.cactus, Material.pumpkin, Material.plants, Material.vine };
|
||||
static Material[] shovelMaterials = { Material.grass, Material.ground, Material.clay };
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.hatchetHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.shovelHead;
|
||||
}
|
||||
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_mattock_head";
|
||||
case 1:
|
||||
return "_mattock_head_broken";
|
||||
case 2:
|
||||
return "_mattock_handle";
|
||||
case 3:
|
||||
return "_mattock_back";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_mattock_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "mattock";
|
||||
}
|
||||
|
||||
/* Mattock specific */
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Broken"))
|
||||
return false;
|
||||
|
||||
return AbilityHelper.hoeGround(stack, player, world, x, y, z, side, random);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Pickaxe extends HarvestTool
|
||||
{
|
||||
public Pickaxe(int itemID)
|
||||
{
|
||||
super(itemID, 1);
|
||||
this.setUnlocalizedName("InfiTool.Pickaxe");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
return "pickaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
return materials;
|
||||
}
|
||||
|
||||
static Material[] materials = new Material[] { Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil, Material.circuits };
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.pickaxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_pickaxe_head";
|
||||
case 1:
|
||||
return "_pickaxe_head_broken";
|
||||
case 2:
|
||||
return "_pickaxe_handle";
|
||||
case 3:
|
||||
return "_pickaxe_accessory";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_pickaxe_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "pickaxe";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.entity.projectile.LaunchedPotion;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PotionLauncher extends Item
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon[] icons;
|
||||
public static final String[] textureNames = new String[] { "potionlauncher" };
|
||||
|
||||
public PotionLauncher(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CreativeTabs.tabCombat);
|
||||
this.setMaxDamage(3);
|
||||
}
|
||||
|
||||
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
boolean loaded = tags.getBoolean("Loaded");
|
||||
if (!loaded)
|
||||
{
|
||||
int slotID = getInventorySlotContainItem(Item.potion.itemID, player.inventory);
|
||||
ItemStack potion = player.inventory.getStackInSlot(slotID);
|
||||
|
||||
NBTTagCompound potionTag = new NBTTagCompound();
|
||||
potion.writeToNBT(potionTag);
|
||||
tags.setCompoundTag("LoadedPotion", potionTag);
|
||||
tags.setBoolean("Loaded", true);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
potion.stackSize--;
|
||||
if (potion.stackSize < 1)
|
||||
player.inventory.setInventorySlotContents(slotID, null);
|
||||
}
|
||||
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "sounds.launcher_clank", 1.0F, (world.rand.nextFloat() - world.rand.nextFloat()) * 0.15F + 1.0F);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int time)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int slotID = getInventorySlotContainItem(Item.potion.itemID, player.inventory);
|
||||
if (!tags.getBoolean("Loaded") && slotID >= 0)
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
public int getMaxItemUseDuration (ItemStack stack)
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public EnumAction getItemUseAction (ItemStack stack)
|
||||
{
|
||||
if (!stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Loaded"))
|
||||
return EnumAction.bow;
|
||||
else
|
||||
return EnumAction.none;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IconRegister par1IconRegister)
|
||||
{
|
||||
this.icons = new Icon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = par1IconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage (int meta)
|
||||
{
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (int id, CreativeTabs tabs, List list)
|
||||
{
|
||||
ItemStack stack = new ItemStack(id, 1, 0);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
compound.setCompoundTag("InfiTool", tags);
|
||||
|
||||
tags.setBoolean("Loaded", false);
|
||||
|
||||
stack.setTagCompound(compound);
|
||||
|
||||
list.add(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEntitySwing (EntityLivingBase player, ItemStack stack)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Loaded"))
|
||||
{
|
||||
NBTTagCompound potionTag = tags.getCompoundTag("LoadedPotion");
|
||||
ItemStack potion = ItemStack.loadItemStackFromNBT(potionTag);//findPotion(player);InventoryLogic
|
||||
if (potion != null)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(new LaunchedPotion(world, player, potion));
|
||||
}
|
||||
tags.removeTag("LoadedPotion");
|
||||
tags.setBoolean("Loaded", false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack findPotion (EntityLivingBase living)
|
||||
{
|
||||
if (living instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
int potionSlot = getInventorySlotContainItem(Item.potion.itemID, player.inventory);
|
||||
if (potionSlot >= 0)
|
||||
{
|
||||
return player.inventory.getStackInSlot(potionSlot);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
int getInventorySlotContainItem (int itemID, InventoryPlayer inventory)
|
||||
{
|
||||
for (int j = 0; j < inventory.mainInventory.length; ++j)
|
||||
{
|
||||
if (inventory.mainInventory[j] != null && inventory.mainInventory[j].itemID == itemID)
|
||||
{
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
list.add("Test Item");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Rapier extends Weapon
|
||||
{
|
||||
public Rapier(int itemID)
|
||||
{
|
||||
super(itemID, 2);
|
||||
this.setUnlocalizedName("InfiTool.Rapier");
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
return EnumAction.none;
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (player.onGround)
|
||||
{
|
||||
player.addExhaustion(0.1f);
|
||||
player.motionY += 0.32;
|
||||
float f = 0.5F;
|
||||
player.motionX = (double) (MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * f);
|
||||
player.motionZ = (double) (-MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * f);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity (ItemStack stack, EntityLivingBase mob, EntityLivingBase player)
|
||||
{
|
||||
//AbilityHelper.hitEntity(stack, mob, player, damageVsEntity);
|
||||
//AbilityHelper.knockbackEntity(mob, 0.8f);
|
||||
mob.motionY *= 0.8;
|
||||
if (mob.hurtResistantTime > 18)
|
||||
mob.hurtResistantTime -= 5;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
return 0.7f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageModifier ()
|
||||
{
|
||||
return 0.8f;
|
||||
}
|
||||
|
||||
/*public float chargeAttack ()
|
||||
{
|
||||
return 1.0f;
|
||||
}*/
|
||||
|
||||
public boolean pierceArmor ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.swordBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.crossbar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_rapier_blade";
|
||||
case 1:
|
||||
return "_rapier_blade_broken";
|
||||
case 2:
|
||||
return "_rapier_handle";
|
||||
case 3:
|
||||
return "_rapier_accessory";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_rapier_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "rapier";
|
||||
}
|
||||
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
return none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Scythe extends Weapon
|
||||
{
|
||||
public Scythe(int itemID)
|
||||
{
|
||||
super(itemID, 4);
|
||||
this.setUnlocalizedName("InfiTool.Scythe");
|
||||
}
|
||||
|
||||
/*@Override
|
||||
protected String getHarvestType()
|
||||
{
|
||||
return "sword";
|
||||
}*/
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
return materials;
|
||||
}
|
||||
|
||||
static Material[] materials = new Material[] { Material.web, Material.cactus, Material.pumpkin, Material.plants, Material.vine, Material.leaves };
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.scytheBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
return TContent.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.toughBinding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
return TContent.toughRod;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_scythe_head";
|
||||
case 1:
|
||||
return "_scythe_head_broken";
|
||||
case 2:
|
||||
return "_scythe_handle";
|
||||
case 3:
|
||||
return "_scythe_binding";
|
||||
case 4:
|
||||
return "_scythe_accessory";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
return 3.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_scythe_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "scythe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageModifier ()
|
||||
{
|
||||
return 0.75f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
{
|
||||
return new String[] { "weapon", "melee", "harvest" };
|
||||
}
|
||||
|
||||
/* Scythe Specific */
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
final int blockID = world.getBlockId(x, y, z);
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
{
|
||||
for (int yPos = y - 1; yPos <= y + 1; yPos++)
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
int localblockID = world.getBlockId(xPos, yPos, zPos);
|
||||
Block block = Block.blocksList[localblockID];
|
||||
if (block != null)// && (block.blockMaterial == Material.leaves || block.isLeaves(world, xPos, yPos, zPos)))
|
||||
{
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == block.blockMaterial)
|
||||
{
|
||||
int localMeta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
block.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
block.onBlockHarvested(world, x, y, z, localMeta, player);
|
||||
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
|
||||
}
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, blockID + (meta << 12));
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
AxisAlignedBB box = AxisAlignedBB.getAABBPool().getAABB(entity.posX, entity.posY, entity.posZ, entity.posX + 1.0D, entity.posY + 1.0D, entity.posZ + 1.0D).expand(1.0D, 1.0D, 1.0D);
|
||||
List list = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, box);
|
||||
for (Object o : list)
|
||||
{
|
||||
AbilityHelper.onLeftClickEntity(stack, player, (Entity) o, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.BowBase;
|
||||
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Shortbow extends BowBase
|
||||
{
|
||||
public Shortbow(int itemID)
|
||||
{
|
||||
super(itemID);
|
||||
this.setUnlocalizedName("InfiTool.Shortbow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_bow_top";
|
||||
case 1:
|
||||
return "_bowstring_broken";
|
||||
case 2:
|
||||
return "_bowstring";
|
||||
case 3:
|
||||
return "_bow_bottom";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_bow_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "shortbow";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.toolRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
return TContent.bowstring;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TContent.toolRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
{
|
||||
return new String[] { "weapon", "ranged", "bow" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
player.movementInput.moveForward *= 2.0F;
|
||||
player.movementInput.moveStrafe *= 2.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags.hasKey("charge"))
|
||||
{
|
||||
String color = "";
|
||||
//double joules = this.getJoules(stack);
|
||||
int power = tags.getInteger("charge");
|
||||
|
||||
if (power != 0)
|
||||
{
|
||||
if (power <= this.getMaxCharge(stack) / 3)
|
||||
color = "\u00a74";
|
||||
else if (power > this.getMaxCharge(stack) * 2 / 3)
|
||||
color = "\u00a72";
|
||||
else
|
||||
color = "\u00a76";
|
||||
}
|
||||
|
||||
String charge = new StringBuilder().append(color).append(tags.getInteger("charge")).append("/").append(getMaxCharge(stack)).append(" EU").toString();
|
||||
list.add(charge);
|
||||
}
|
||||
if (tags.hasKey("InfiTool"))
|
||||
{
|
||||
boolean broken = tags.getCompoundTag("InfiTool").getBoolean("Broken");
|
||||
if (broken)
|
||||
list.add("\u00A7oBroken");
|
||||
else
|
||||
{
|
||||
int head = tags.getCompoundTag("InfiTool").getInteger("Head");
|
||||
int handle = tags.getCompoundTag("InfiTool").getInteger("Handle");
|
||||
int binding = tags.getCompoundTag("InfiTool").getInteger("Accessory");
|
||||
int extra = tags.getCompoundTag("InfiTool").getInteger("Extra");
|
||||
|
||||
String headName = getAbilityNameForType(head);
|
||||
if (!headName.equals(""))
|
||||
list.add(getStyleForType(head) + headName);
|
||||
|
||||
String handleName = getBowstringName(handle);
|
||||
if (!handleName.equals("") && handle != head)
|
||||
list.add(handleName);
|
||||
|
||||
if (getPartAmount() >= 3)
|
||||
{
|
||||
String bindingName = getAbilityNameForType(binding);
|
||||
if (!bindingName.equals("") && binding != head && binding != handle)
|
||||
list.add(getStyleForType(binding) + bindingName);
|
||||
}
|
||||
|
||||
if (getPartAmount() >= 4)
|
||||
{
|
||||
String extraName = getAbilityNameForType(extra);
|
||||
if (!extraName.equals("") && extra != head && extra != handle && extra != binding)
|
||||
list.add(getStyleForType(extra) + extraName);
|
||||
}
|
||||
|
||||
int unbreaking = tags.getCompoundTag("InfiTool").getInteger("Unbreaking");
|
||||
String reinforced = getReinforcedName(head, handle, binding, extra, unbreaking);
|
||||
if (!reinforced.equals(""))
|
||||
list.add(reinforced);
|
||||
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.getCompoundTag("InfiTool").hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getCompoundTag("InfiTool").getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getBowstringName (int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
return "";
|
||||
case 1:
|
||||
return "\u00A7bEnchanted";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
//return TConstructRegistry.getMaterial(type).ability();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Shovel extends HarvestTool
|
||||
{
|
||||
public Shovel(int itemID)
|
||||
{
|
||||
super(itemID, 2);
|
||||
this.setUnlocalizedName("InfiTool.Shovel");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
return "shovel";
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TContent.shovelHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
headStrings.put(index, location[0]);
|
||||
brokenPartStrings.put(index, location[1]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_shovel_head";
|
||||
case 1:
|
||||
return "_shovel_head_broken";
|
||||
case 2:
|
||||
return "_shovel_handle";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
return "_shovel_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
return "shovel";
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Icon getIcon (ItemStack stack, int renderPass)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
return (handleIcons.get(tags.getInteger("RenderHandle")));
|
||||
}
|
||||
|
||||
if (renderPass == 1) // Head
|
||||
{
|
||||
if (tags.getBoolean("Broken"))
|
||||
return (brokenHeadIcons.get(tags.getInteger("RenderHead")));
|
||||
else
|
||||
return (headIcons.get(tags.getInteger("RenderHead")));
|
||||
}
|
||||
|
||||
if (renderPass == 2)
|
||||
{
|
||||
if (tags.hasKey("Effect1"))
|
||||
return (effectIcons.get(tags.getInteger("Effect1")));
|
||||
}
|
||||
|
||||
if (renderPass == 3)
|
||||
{
|
||||
if (tags.hasKey("Effect2"))
|
||||
return (effectIcons.get(tags.getInteger("Effect2")));
|
||||
}
|
||||
|
||||
if (renderPass == 4)
|
||||
{
|
||||
if (tags.hasKey("Effect3"))
|
||||
return (effectIcons.get(tags.getInteger("Effect3")));
|
||||
}
|
||||
|
||||
return TProxyClient.blankSprite;
|
||||
}*/
|
||||
}
|
||||
Reference in new issue
Block a user