mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 19:59:55 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -16,11 +16,9 @@ import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
|
||||
@Deprecated
|
||||
public class Arrow extends ToolCore
|
||||
{
|
||||
public class Arrow extends ToolCore {
|
||||
|
||||
public Arrow()
|
||||
{
|
||||
public Arrow() {
|
||||
super(3);
|
||||
this.setUnlocalizedName("InfiTool.Arrow");
|
||||
this.setMaxStackSize(64);
|
||||
@@ -28,95 +26,87 @@ public class Arrow extends ToolCore
|
||||
}
|
||||
|
||||
@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 "";
|
||||
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
|
||||
protected int getDefaultColor(int renderPass, int materialID) {
|
||||
// fletchling uses custom material
|
||||
if(renderPass == 2) {
|
||||
if (renderPass == 2) {
|
||||
CustomMaterial mat = TConstructRegistry.getCustomMaterial(materialID, FletchingMaterial.class);
|
||||
if(mat != null)
|
||||
return mat.color;
|
||||
if (mat != null) return mat.color;
|
||||
}
|
||||
|
||||
return super.getDefaultColor(renderPass, materialID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_arrow_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "arrow";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
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)
|
||||
{
|
||||
public void registerAlternatePartPaths(int index, String[] location) {
|
||||
accessoryStrings.put(index, location[3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerWeaponry.arrowhead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerWeaponry.fletching;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "ammo" };
|
||||
public String[] getTraits() {
|
||||
return new String[] {"ammo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageModifier ()
|
||||
{
|
||||
public float getDamageModifier() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
public void getSubItems(Item 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)
|
||||
{
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, 3),
|
||||
new ItemStack(getHandleItem(), 1, 0),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
"");
|
||||
if (tool != null) {
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
@@ -127,10 +117,14 @@ public class Arrow extends ToolCore
|
||||
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, StatCollector.translateToLocal("item.tool.randomarrow"));
|
||||
tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, random.nextInt(18)),
|
||||
new ItemStack(getHandleItem(), 1, random.nextInt(18)),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
StatCollector.translateToLocal("item.tool.randomarrow"));
|
||||
|
||||
if (tool != null)
|
||||
{
|
||||
if (tool != null) {
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
@@ -139,15 +133,18 @@ public class Arrow extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTool (int id, String name, List list)
|
||||
{
|
||||
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);
|
||||
if (tool != null)
|
||||
{
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, id),
|
||||
new ItemStack(getHandleItem(), 1, id),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
name);
|
||||
if (tool != null) {
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
@@ -155,76 +152,75 @@ public class Arrow extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
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;
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (!stack.hasTagCompound()) return;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
if (tags.hasKey("Energy")) {
|
||||
String color = "";
|
||||
// double joules = this.getJoules(stack);
|
||||
int power = tags.getInteger("Energy");
|
||||
|
||||
if (power != 0)
|
||||
{
|
||||
if (power <= this.getMaxEnergyStored(stack) / 3)
|
||||
color = "\u00a74";
|
||||
else if (power > this.getMaxEnergyStored(stack) * 2 / 3)
|
||||
color = "\u00a72";
|
||||
else
|
||||
color = "\u00a76";
|
||||
if (power != 0) {
|
||||
if (power <= this.getMaxEnergyStored(stack) / 3) color = "\u00a74";
|
||||
else if (power > this.getMaxEnergyStored(stack) * 2 / 3) color = "\u00a72";
|
||||
else color = "\u00a76";
|
||||
}
|
||||
|
||||
String energy = new StringBuilder().append(color).append(tags.getInteger("Energy")).append("/").append(getMaxEnergyStored(stack)).append(" RF").toString();
|
||||
String energy = new StringBuilder()
|
||||
.append(color)
|
||||
.append(tags.getInteger("Energy"))
|
||||
.append("/")
|
||||
.append(getMaxEnergyStored(stack))
|
||||
.append(" RF")
|
||||
.toString();
|
||||
list.add(energy);
|
||||
}
|
||||
if (tags.hasKey("InfiTool"))
|
||||
{
|
||||
if (tags.hasKey("InfiTool")) {
|
||||
boolean broken = tags.getCompoundTag("InfiTool").getBoolean("Broken");
|
||||
if (broken)
|
||||
list.add("\u00A7oBroken");
|
||||
else
|
||||
{
|
||||
if (broken) list.add("\u00A7oBroken");
|
||||
else {
|
||||
int head = tags.getCompoundTag("InfiTool").getInteger("Head");
|
||||
int handle = tags.getCompoundTag("InfiTool").getInteger("Handle");
|
||||
|
||||
String headName = getAbilityNameForType(head, 0);
|
||||
if (!headName.equals(""))
|
||||
list.add(getStyleForType(head) + headName);
|
||||
if (!headName.equals("")) list.add(getStyleForType(head) + headName);
|
||||
|
||||
String handleName = getAbilityNameForType(handle, 0);
|
||||
if (!handleName.equals("") && handle != head)
|
||||
list.add(getStyleForType(handle) + handleName);
|
||||
if (!handleName.equals("") && handle != head) list.add(getStyleForType(handle) + handleName);
|
||||
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
while (displayToolTips) {
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.getCompoundTag("InfiTool").hasKey(tooltip))
|
||||
{
|
||||
if (tags.getCompoundTag("InfiTool").hasKey(tooltip)) {
|
||||
String tipName = tags.getCompoundTag("InfiTool").getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
if (!tipName.equals("")) list.add(tipName);
|
||||
} else displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
int attack = (int) (tags.getCompoundTag("InfiTool").getInteger("Attack") * this.getDamageModifier());
|
||||
list.add("\u00A79+" + attack + " " + StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage"));
|
||||
list.add("\u00A79+" + tags.getCompoundTag("InfiTool").getInteger("Attack") + " " + StatCollector.translateToLocalFormatted("attribute.name.ammo.attackDamage"));
|
||||
list.add("\u00A79+" + attack + " "
|
||||
+ StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage"));
|
||||
list.add("\u00A79+" + tags.getCompoundTag("InfiTool").getInteger("Attack") + " "
|
||||
+ StatCollector.translateToLocalFormatted("attribute.name.ammo.attackDamage"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,122 +10,105 @@ import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.*;
|
||||
import tconstruct.tools.logic.EquipLogic;
|
||||
|
||||
public class BattleSign extends Weapon
|
||||
{
|
||||
public BattleSign()
|
||||
{
|
||||
public class BattleSign extends Weapon {
|
||||
public BattleSign() {
|
||||
super(1);
|
||||
this.setUnlocalizedName("InfiTool.Battlesign");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolName ()
|
||||
{
|
||||
public String getToolName() {
|
||||
return "Battlesign";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.signHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
public int getPartAmount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_battlesign_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "battlesign";
|
||||
}
|
||||
|
||||
@Override
|
||||
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())
|
||||
{
|
||||
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.getBlock(x, y, z).getMaterial().isSolid())
|
||||
{
|
||||
} else if (!world.getBlock(x, y, z).getMaterial().isSolid()) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
} else {
|
||||
if (side == 1) {
|
||||
++y;
|
||||
}
|
||||
|
||||
if (side == 2)
|
||||
{
|
||||
if (side == 2) {
|
||||
--z;
|
||||
}
|
||||
|
||||
if (side == 3)
|
||||
{
|
||||
if (side == 3) {
|
||||
++z;
|
||||
}
|
||||
|
||||
if (side == 4)
|
||||
{
|
||||
if (side == 4) {
|
||||
--x;
|
||||
}
|
||||
|
||||
if (side == 5)
|
||||
{
|
||||
if (side == 5) {
|
||||
++x;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack))
|
||||
{
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack)) {
|
||||
return false;
|
||||
}
|
||||
else if (!TinkerTools.battlesignBlock.canPlaceBlockAt(world, x, y, z))
|
||||
{
|
||||
} else if (!TinkerTools.battlesignBlock.canPlaceBlockAt(world, x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
world.setBlock(x, y, z, TinkerTools.battlesignBlock, 0, 3);
|
||||
TinkerTools.battlesignBlock.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
|
||||
@@ -133,8 +116,7 @@ public class BattleSign extends Weapon
|
||||
logic.setEquipmentItem(stack);
|
||||
--stack.stackSize;
|
||||
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
||||
{
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
player.openGui(TConstruct.instance, ToolProxyClient.battlesignTextID, world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mods.battlegear2.api.PlayerEventChild;
|
||||
import mods.battlegear2.api.weapons.IBattlegearWeapon;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -19,152 +22,139 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import tconstruct.library.tools.AOEHarvestTool;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@Optional.InterfaceList({ @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.weapons.IBattlegearWeapon"),
|
||||
@Optional.Interface(modid = "ZeldaItemAPI", iface = "zeldaswordskills.api.item.ISword") })
|
||||
public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon
|
||||
{
|
||||
public Battleaxe()
|
||||
{
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.weapons.IBattlegearWeapon"),
|
||||
@Optional.Interface(modid = "ZeldaItemAPI", iface = "zeldaswordskills.api.item.ISword")
|
||||
})
|
||||
public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon {
|
||||
public Battleaxe() {
|
||||
super(4, 1, 1);
|
||||
this.setUnlocalizedName("InfiTool.Battleaxe");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
protected String getHarvestType() {
|
||||
return "axe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed (ItemStack itemstack, World world, Block b, int x, int y, int z, EntityLivingBase player)
|
||||
{
|
||||
if (b != null && b.getMaterial() == Material.leaves)
|
||||
return false;
|
||||
public boolean onBlockDestroyed(
|
||||
ItemStack itemstack, World world, Block b, int x, int y, int z, EntityLivingBase player) {
|
||||
if (b != null && b.getMaterial() == Material.leaves) return false;
|
||||
|
||||
return AbilityHelper.onBlockChanged(itemstack, world, b, x, y, z, player, random);
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.wood, Material.vine, Material.circuits, Material.cactus, Material.gourd };
|
||||
static Material[] materials = {Material.wood, Material.vine, Material.circuits, Material.cactus, Material.gourd};
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.broadAxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
public Item getHandleItem() {
|
||||
return TinkerTools.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.broadAxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
public Item getExtraItem() {
|
||||
return TinkerTools.toughBinding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
public int durabilityTypeAccessory() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
public int durabilityTypeExtra() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
public float getRepairCost() {
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
public float getDurabilityModifier() {
|
||||
return 2.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_battleaxe_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "battleaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "harvest", "melee", "slicing" };
|
||||
public String[] getTraits() {
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
// player.rotationYaw += 1;
|
||||
// if (player.onGround)
|
||||
// {
|
||||
@@ -174,66 +164,59 @@ public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int useCount)
|
||||
{
|
||||
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;
|
||||
if (boost > 2) boost = 2;
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
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)
|
||||
{
|
||||
if (time > 5 && player.onGround) {
|
||||
player.addExhaustion(0.2F);
|
||||
player.setSprinting(true);
|
||||
|
||||
float speed = 0.025F * time;
|
||||
if (speed > 0.925f)
|
||||
speed = 0.925f;
|
||||
if (speed > 0.925f) speed = 0.925f;
|
||||
|
||||
float increase = (float) (0.02 * time + 0.2);
|
||||
if (increase > 0.56f)
|
||||
increase = 0.56f;
|
||||
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);
|
||||
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
|
||||
public int getMaxItemUseDuration (ItemStack par1ItemStack)
|
||||
{
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity (ItemStack stack, EntityLivingBase mob, EntityLivingBase player)
|
||||
{
|
||||
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)
|
||||
{
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
if (entity instanceof EntityPlayerSP) {
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
if (usingItem != null && usingItem.getItem() == this) {
|
||||
player.movementInput.moveForward *= 5.0F;
|
||||
player.movementInput.moveStrafe *= 5.0F;
|
||||
}
|
||||
@@ -244,54 +227,49 @@ public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean sheatheOnBack (ItemStack item)
|
||||
{
|
||||
public boolean sheatheOnBack(ItemStack item) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean isOffhandHandDual (ItemStack off)
|
||||
{
|
||||
public boolean isOffhandHandDual(ItemStack off) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean offhandAttackEntity (PlayerEventChild.OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem)
|
||||
{
|
||||
public boolean offhandAttackEntity(
|
||||
PlayerEventChild.OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean offhandClickAir (PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem)
|
||||
{
|
||||
public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean offhandClickBlock (PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem)
|
||||
{
|
||||
public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public void performPassiveEffects (Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem)
|
||||
{
|
||||
public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem) {
|
||||
// unused
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean allowOffhand (ItemStack mainhand, ItemStack offhand)
|
||||
{
|
||||
if (offhand == null)
|
||||
return true;
|
||||
public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) {
|
||||
if (offhand == null) return true;
|
||||
|
||||
return (mainhand != null && mainhand.getItem() != TinkerTools.cleaver && mainhand.getItem() != TinkerTools.battleaxe)
|
||||
return (mainhand != null
|
||||
&& mainhand.getItem() != TinkerTools.cleaver
|
||||
&& mainhand.getItem() != TinkerTools.battleaxe)
|
||||
&& (offhand.getItem() != TinkerTools.cleaver && offhand.getItem() != TinkerTools.battleaxe);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,81 +20,68 @@ import tconstruct.tools.entity.ArrowEntity;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
@Deprecated
|
||||
public abstract class BowBase extends ToolCore
|
||||
{
|
||||
public BowBase()
|
||||
{
|
||||
public abstract class BowBase extends ToolCore {
|
||||
public BowBase() {
|
||||
super(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
public int durabilityTypeAccessory() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Bow usage */
|
||||
@Override
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int useRemaining) {
|
||||
int time = this.getMaxItemUseDuration(stack) - useRemaining;
|
||||
|
||||
ArrowLooseEvent event = new ArrowLooseEvent(player, stack, time);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if (event.isCanceled())
|
||||
{
|
||||
if (event.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
time = event.charge;
|
||||
|
||||
boolean creative = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
|
||||
boolean creative = player.capabilities.isCreativeMode
|
||||
|| EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
|
||||
int slotID = getInventorySlotContainItem(TinkerTools.arrow, player.inventory);
|
||||
int arrowID = getInventorySlotContainItem(Items.arrow, player.inventory);
|
||||
int arrowState = 0;
|
||||
ItemStack tinkerArrow = null;
|
||||
if (slotID != -1)
|
||||
tinkerArrow = player.inventory.getStackInSlot(slotID);
|
||||
if (slotID != -1) tinkerArrow = player.inventory.getStackInSlot(slotID);
|
||||
|
||||
if (creative || tinkerArrow != null || arrowID != -1)
|
||||
{
|
||||
if (creative || tinkerArrow != null || arrowID != -1) {
|
||||
NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
float drawTime = toolTag.getInteger("DrawSpeed");
|
||||
float flightSpeed = toolTag.getFloat("FlightSpeed");
|
||||
float speedBase = (float) time / drawTime;
|
||||
speedBase = (speedBase * speedBase + speedBase * 2.0F) / 3.0F;
|
||||
|
||||
if ((double) speedBase < 0.1D)
|
||||
{
|
||||
if ((double) speedBase < 0.1D) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (speedBase > flightSpeed)
|
||||
{
|
||||
if (speedBase > flightSpeed) {
|
||||
speedBase = flightSpeed;
|
||||
}
|
||||
|
||||
EntityArrow arrowEntity = null;
|
||||
// if (tinkerArrow != null)
|
||||
if (slotID != -1 && (arrowID == -1 || slotID < arrowID))
|
||||
{
|
||||
if (slotID != -1 && (arrowID == -1 || slotID < arrowID)) {
|
||||
ItemStack arrowStack = tinkerArrow.copy();
|
||||
arrowStack.stackSize = 1;
|
||||
arrowEntity = new ArrowEntity(world, player, speedBase * 2.0F, arrowStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
arrowEntity = new EntityArrow(world, player, speedBase * 2.0F);
|
||||
}
|
||||
|
||||
if (speedBase >= 1.0F)
|
||||
{
|
||||
if (speedBase >= 1.0F) {
|
||||
arrowEntity.setIsCritical(true);
|
||||
}
|
||||
|
||||
int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack);
|
||||
|
||||
if (var9 > 0)
|
||||
{
|
||||
if (var9 > 0) {
|
||||
arrowEntity.setDamage(arrowEntity.getDamage() + (double) var9 * 0.5D + 0.5D);
|
||||
}
|
||||
|
||||
@@ -104,57 +91,44 @@ public abstract class BowBase extends ToolCore
|
||||
((ArrowEntity) arrowEntity).setKnockbackModStrength(toolTag.getFloat("Knockback"));
|
||||
// var10 += toolTag.getFloat("Knockback");
|
||||
|
||||
if (var10 > 0)
|
||||
{
|
||||
if (var10 > 0) {
|
||||
arrowEntity.setKnockbackStrength(var10);
|
||||
}
|
||||
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0)
|
||||
{
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0) {
|
||||
arrowEntity.setFire(100);
|
||||
}
|
||||
|
||||
int reinforced = 0;
|
||||
|
||||
if (toolTag.hasKey("Unbreaking"))
|
||||
reinforced = toolTag.getInteger("Unbreaking");
|
||||
if (toolTag.hasKey("Unbreaking")) reinforced = toolTag.getInteger("Unbreaking");
|
||||
|
||||
if (random.nextInt(10) < 10 - reinforced)
|
||||
{
|
||||
if (random.nextInt(10) < 10 - reinforced) {
|
||||
AbilityHelper.damageTool(stack, 1, player, false);
|
||||
}
|
||||
world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + speedBase * 0.5F);
|
||||
world.playSoundAtEntity(
|
||||
player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + speedBase * 0.5F);
|
||||
|
||||
if (creative)
|
||||
{
|
||||
if (creative) {
|
||||
arrowEntity.canBePickedUp = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// if (tinkerArrow != null)
|
||||
if (slotID != -1 && (arrowID == -1 || slotID < arrowID))
|
||||
{
|
||||
if (slotID != -1 && (arrowID == -1 || slotID < arrowID)) {
|
||||
player.inventory.consumeInventoryItem(TinkerTools.arrow);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
player.inventory.consumeInventoryItem(Items.arrow);
|
||||
}
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(arrowEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int getInventorySlotContainItem (Item item, InventoryPlayer inventory)
|
||||
{
|
||||
for (int j = 0; j < inventory.mainInventory.length; ++j)
|
||||
{
|
||||
if (inventory.mainInventory[j] != null && inventory.mainInventory[j].getItem() == item)
|
||||
{
|
||||
int getInventorySlotContainItem(Item item, InventoryPlayer inventory) {
|
||||
for (int j = 0; j < inventory.mainInventory.length; ++j) {
|
||||
if (inventory.mainInventory[j] != null && inventory.mainInventory[j].getItem() == item) {
|
||||
return j;
|
||||
}
|
||||
}
|
||||
@@ -162,8 +136,7 @@ public abstract class BowBase extends ToolCore
|
||||
return -1;
|
||||
}
|
||||
|
||||
public ItemStack onFoodEaten (ItemStack stack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
public ItemStack onFoodEaten(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -171,8 +144,7 @@ public abstract class BowBase extends ToolCore
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
@Override
|
||||
public int getMaxItemUseDuration (ItemStack par1ItemStack)
|
||||
{
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
@@ -181,8 +153,7 @@ public abstract class BowBase extends ToolCore
|
||||
* is being used
|
||||
*/
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@@ -191,22 +162,19 @@ public abstract class BowBase extends ToolCore
|
||||
* pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World par2World, EntityPlayer player)
|
||||
{
|
||||
if (stack.hasTagCompound())
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer player) {
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!toolTag.getBoolean("Broken"))
|
||||
{
|
||||
if (!toolTag.getBoolean("Broken")) {
|
||||
ArrowNockEvent event = new ArrowNockEvent(player, stack);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if (event.isCanceled())
|
||||
{
|
||||
if (event.isCanceled()) {
|
||||
return event.result;
|
||||
}
|
||||
|
||||
if (player.capabilities.isCreativeMode || player.inventory.hasItemStack(new ItemStack(Items.arrow)) || player.inventory.hasItemStack(new ItemStack(TinkerTools.arrow)))
|
||||
{
|
||||
if (player.capabilities.isCreativeMode
|
||||
|| player.inventory.hasItemStack(new ItemStack(Items.arrow))
|
||||
|| player.inventory.hasItemStack(new ItemStack(TinkerTools.arrow))) {
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
}
|
||||
}
|
||||
@@ -217,45 +185,50 @@ public abstract class BowBase extends ToolCore
|
||||
|
||||
/* Rendering */
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
super.registerIcons(iconRegister);
|
||||
if(PHConstruct.minimalTextures)
|
||||
{
|
||||
if (PHConstruct.minimalTextures) {
|
||||
headIcons1.clear();
|
||||
headIcons1.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_1"));
|
||||
headIcons1.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_1"));
|
||||
handleIcons1.clear();
|
||||
handleIcons1.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_1"));
|
||||
handleIcons1.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_1"));
|
||||
accessoryIcons1.clear();
|
||||
accessoryIcons1.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_1"));
|
||||
accessoryIcons1.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_1"));
|
||||
|
||||
headIcons2.clear();
|
||||
headIcons2.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_2"));
|
||||
headIcons2.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_2"));
|
||||
handleIcons2.clear();
|
||||
handleIcons2.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_2"));
|
||||
handleIcons2.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_2"));
|
||||
accessoryIcons2.clear();
|
||||
accessoryIcons2.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_2"));
|
||||
accessoryIcons2.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_2"));
|
||||
|
||||
headIcons3.clear();
|
||||
headIcons3.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_3"));
|
||||
headIcons3.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_3"));
|
||||
handleIcons3.clear();
|
||||
handleIcons3.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_3"));
|
||||
handleIcons3.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_3"));
|
||||
accessoryIcons3.clear();
|
||||
accessoryIcons3.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_3"));
|
||||
|
||||
accessoryIcons3.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_3"));
|
||||
|
||||
// effect icons
|
||||
effectIcons1.clear();
|
||||
effectIcons2.clear();
|
||||
effectIcons3.clear();
|
||||
for(Map.Entry<Integer, String> entry : effectStrings.entrySet()) {
|
||||
for (Map.Entry<Integer, String> entry : effectStrings.entrySet()) {
|
||||
effectIcons.put(entry.getKey(), iconRegister.registerIcon(entry.getValue()));
|
||||
effectIcons1.put(entry.getKey(), iconRegister.registerIcon(entry.getValue() + "_1"));
|
||||
effectIcons2.put(entry.getKey(), iconRegister.registerIcon(entry.getValue() + "_2"));
|
||||
effectIcons3.put(entry.getKey(), iconRegister.registerIcon(entry.getValue() + "_3"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
headIcons1.clear();
|
||||
handleIcons1.clear();
|
||||
accessoryIcons1.clear();
|
||||
@@ -277,7 +250,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterOne = accessoryStrings.entrySet().iterator();
|
||||
while (iterOne.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterOne.next();
|
||||
accessoryIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
accessoryIcons1.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +259,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterOne = extraStrings.entrySet().iterator();
|
||||
while (iterOne.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterOne.next();
|
||||
extraIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
extraIcons1.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,7 +291,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterTwo = accessoryStrings.entrySet().iterator();
|
||||
while (iterTwo.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterTwo.next();
|
||||
accessoryIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
accessoryIcons2.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +300,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterTwo = extraStrings.entrySet().iterator();
|
||||
while (iterTwo.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterTwo.next();
|
||||
extraIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
extraIcons2.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +332,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterThree = accessoryStrings.entrySet().iterator();
|
||||
while (iterThree.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterThree.next();
|
||||
accessoryIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
accessoryIcons3.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +341,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterThree = extraStrings.entrySet().iterator();
|
||||
while (iterThree.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterThree.next();
|
||||
extraIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
extraIcons3.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,82 +355,46 @@ public abstract class BowBase extends ToolCore
|
||||
registerArrows(iconRegister);
|
||||
}
|
||||
|
||||
void registerArrows (IIconRegister iconRegister)
|
||||
{
|
||||
void registerArrows(IIconRegister iconRegister) {
|
||||
arrow1 = iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/arrow_1");
|
||||
arrow2 = iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/arrow_2");
|
||||
arrow3 = iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/arrow_3");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon (ItemStack stack, int renderPass)
|
||||
{
|
||||
public IIcon getIcon(ItemStack stack, int renderPass) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
if (tags != null)
|
||||
{
|
||||
if (tags != null) {
|
||||
tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (renderPass < getPartAmount())
|
||||
{
|
||||
if (renderPass < getPartAmount()) {
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
if (tags.getBoolean("Broken"))
|
||||
return getCorrectIcon(brokenIcons, tags.getInteger("RenderHandle"));
|
||||
if (tags.getBoolean("Broken")) return getCorrectIcon(brokenIcons, tags.getInteger("RenderHandle"));
|
||||
return getCorrectIcon(handleIcons, tags.getInteger("RenderHandle"));
|
||||
}
|
||||
|
||||
else if (renderPass == 1) // Head
|
||||
} else if (renderPass == 1) // Head
|
||||
{
|
||||
return getCorrectIcon(headIcons, tags.getInteger("RenderHead"));
|
||||
}
|
||||
|
||||
else if (renderPass == 2) // Accessory
|
||||
} else if (renderPass == 2) // Accessory
|
||||
{
|
||||
return getCorrectIcon(accessoryIcons, tags.getInteger("RenderAccessory"));
|
||||
}
|
||||
|
||||
else if (renderPass == 3) // Extra
|
||||
} else if (renderPass == 3) // Extra
|
||||
{
|
||||
return getCorrectIcon(extraIcons, tags.getInteger("RenderExtra"));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (renderPass == getPartAmount())
|
||||
{
|
||||
if (tags.hasKey("Effect1"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect1"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 1)
|
||||
{
|
||||
if (tags.hasKey("Effect2"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect2"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 2)
|
||||
{
|
||||
if (tags.hasKey("Effect3"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect3"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 3)
|
||||
{
|
||||
if (tags.hasKey("Effect4"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect4"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 4)
|
||||
{
|
||||
if (tags.hasKey("Effect5"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect5"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 5)
|
||||
{
|
||||
if (tags.hasKey("Effect6"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect6"));
|
||||
} else {
|
||||
if (renderPass == getPartAmount()) {
|
||||
if (tags.hasKey("Effect1")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect1"));
|
||||
} else if (renderPass == getPartAmount() + 1) {
|
||||
if (tags.hasKey("Effect2")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect2"));
|
||||
} else if (renderPass == getPartAmount() + 2) {
|
||||
if (tags.hasKey("Effect3")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect3"));
|
||||
} else if (renderPass == getPartAmount() + 3) {
|
||||
if (tags.hasKey("Effect4")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect4"));
|
||||
} else if (renderPass == getPartAmount() + 4) {
|
||||
if (tags.hasKey("Effect5")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect5"));
|
||||
} else if (renderPass == getPartAmount() + 5) {
|
||||
if (tags.hasKey("Effect6")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect6"));
|
||||
}
|
||||
}
|
||||
return blankSprite;
|
||||
@@ -459,30 +402,24 @@ public abstract class BowBase extends ToolCore
|
||||
return emptyIcon;
|
||||
}
|
||||
|
||||
protected IIcon getCorrectIcon2(Map<Integer, IIcon> icons, int id)
|
||||
{
|
||||
if(!icons.containsKey(id))
|
||||
return blankSprite;
|
||||
|
||||
protected IIcon getCorrectIcon2(Map<Integer, IIcon> icons, int id) {
|
||||
if (!icons.containsKey(id)) return blankSprite;
|
||||
|
||||
return icons.get(id);
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
public void registerPartPaths(int index, String[] location) {
|
||||
headStrings.put(index, location[0]);
|
||||
// brokenHeadStrings.put(index, location[1]);
|
||||
// handleStrings.put(index, location[2]);
|
||||
if (location.length > 3)
|
||||
accessoryStrings.put(index, location[3]);
|
||||
if (location.length > 4)
|
||||
extraStrings.put(index, location[4]);
|
||||
if (location.length > 3) accessoryStrings.put(index, location[3]);
|
||||
if (location.length > 4) extraStrings.put(index, location[4]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAlternatePartPaths (int index, String[] location)
|
||||
{
|
||||
public void registerAlternatePartPaths(int index, String[] location) {
|
||||
brokenPartStrings.put(index, location[1]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
@@ -510,100 +447,59 @@ public abstract class BowBase extends ToolCore
|
||||
public HashMap<Integer, IIcon> effectIcons3 = new HashMap<Integer, IIcon>();
|
||||
|
||||
@Override
|
||||
public IIcon getIcon (ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
|
||||
{
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
int useTime = stack.getMaxItemUseDuration() - useRemaining;
|
||||
if (!stack.hasTagCompound())
|
||||
return emptyIcon;
|
||||
if (!stack.hasTagCompound()) return emptyIcon;
|
||||
|
||||
NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int drawTime = toolTag.getInteger("DrawSpeed");
|
||||
float flightSpeed = toolTag.getFloat("FlightSpeed");
|
||||
drawTime *= flightSpeed;
|
||||
if (usingItem == null)
|
||||
{
|
||||
if (usingItem == null) {
|
||||
return getIcon(stack, renderPass);
|
||||
}
|
||||
if (useTime >= drawTime - 2)
|
||||
{
|
||||
if (useTime >= drawTime - 2) {
|
||||
return getIcon3(stack, renderPass);
|
||||
}
|
||||
if (useTime >= (drawTime * 2 / 3))
|
||||
{
|
||||
if (useTime >= (drawTime * 2 / 3)) {
|
||||
return getIcon2(stack, renderPass);
|
||||
}
|
||||
return getIcon1(stack, renderPass);
|
||||
}
|
||||
|
||||
public IIcon getIcon1 (ItemStack stack, int renderPass)
|
||||
{
|
||||
public IIcon getIcon1(ItemStack stack, int renderPass) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
if (tags != null)
|
||||
{
|
||||
if (tags != null) {
|
||||
tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (renderPass < getPartAmount())
|
||||
{
|
||||
if (renderPass < getPartAmount()) {
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
return getCorrectIcon(handleIcons1, tags.getInteger("RenderHandle"));
|
||||
}
|
||||
|
||||
else if (renderPass == 1) // Head
|
||||
} else if (renderPass == 1) // Head
|
||||
{
|
||||
return getCorrectIcon(headIcons1, tags.getInteger("RenderHead"));
|
||||
}
|
||||
|
||||
else if (renderPass == 2) // Accessory
|
||||
} else if (renderPass == 2) // Accessory
|
||||
{
|
||||
return getCorrectIcon(accessoryIcons1, tags.getInteger("RenderAccessory"));
|
||||
}
|
||||
|
||||
else if (renderPass == 3) // Extra
|
||||
} else if (renderPass == 3) // Extra
|
||||
{
|
||||
return getCorrectIcon(extraIcons1, tags.getInteger("RenderExtra"));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (renderPass == getPartAmount())
|
||||
{
|
||||
if (tags.hasKey("Effect1"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect1"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 1)
|
||||
{
|
||||
if (tags.hasKey("Effect2"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect2"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 2)
|
||||
{
|
||||
if (tags.hasKey("Effect3"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect3"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 3)
|
||||
{
|
||||
if (tags.hasKey("Effect4"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect4"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 4)
|
||||
{
|
||||
if (tags.hasKey("Effect5"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect5"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 5)
|
||||
{
|
||||
if (tags.hasKey("Effect6"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect6"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (renderPass == getPartAmount()) {
|
||||
if (tags.hasKey("Effect1")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect1"));
|
||||
} else if (renderPass == getPartAmount() + 1) {
|
||||
if (tags.hasKey("Effect2")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect2"));
|
||||
} else if (renderPass == getPartAmount() + 2) {
|
||||
if (tags.hasKey("Effect3")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect3"));
|
||||
} else if (renderPass == getPartAmount() + 3) {
|
||||
if (tags.hasKey("Effect4")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect4"));
|
||||
} else if (renderPass == getPartAmount() + 4) {
|
||||
if (tags.hasKey("Effect5")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect5"));
|
||||
} else if (renderPass == getPartAmount() + 5) {
|
||||
if (tags.hasKey("Effect6")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect6"));
|
||||
} else {
|
||||
return arrow1;
|
||||
}
|
||||
}
|
||||
@@ -612,75 +508,39 @@ public abstract class BowBase extends ToolCore
|
||||
return emptyIcon;
|
||||
}
|
||||
|
||||
public IIcon getIcon2 (ItemStack stack, int renderPass)
|
||||
{
|
||||
public IIcon getIcon2(ItemStack stack, int renderPass) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
if (tags != null)
|
||||
{
|
||||
if (tags != null) {
|
||||
tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (renderPass < getPartAmount())
|
||||
{
|
||||
if (renderPass < getPartAmount()) {
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
return getCorrectIcon(handleIcons2, tags.getInteger("RenderHandle"));
|
||||
}
|
||||
|
||||
else if (renderPass == 1) // Head
|
||||
} else if (renderPass == 1) // Head
|
||||
{
|
||||
return getCorrectIcon(headIcons2, tags.getInteger("RenderHead"));
|
||||
}
|
||||
|
||||
else if (renderPass == 2) // Accessory
|
||||
} else if (renderPass == 2) // Accessory
|
||||
{
|
||||
return getCorrectIcon(accessoryIcons2, tags.getInteger("RenderAccessory"));
|
||||
}
|
||||
|
||||
else if (renderPass == 3) // Extra
|
||||
} else if (renderPass == 3) // Extra
|
||||
{
|
||||
return getCorrectIcon(extraIcons2, tags.getInteger("RenderExtra"));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (renderPass == getPartAmount())
|
||||
{
|
||||
if (tags.hasKey("Effect1"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect1"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 1)
|
||||
{
|
||||
if (tags.hasKey("Effect2"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect2"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 2)
|
||||
{
|
||||
if (tags.hasKey("Effect3"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect3"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 3)
|
||||
{
|
||||
if (tags.hasKey("Effect4"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect4"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 4)
|
||||
{
|
||||
if (tags.hasKey("Effect5"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect5"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 5)
|
||||
{
|
||||
if (tags.hasKey("Effect6"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect6"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (renderPass == getPartAmount()) {
|
||||
if (tags.hasKey("Effect1")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect1"));
|
||||
} else if (renderPass == getPartAmount() + 1) {
|
||||
if (tags.hasKey("Effect2")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect2"));
|
||||
} else if (renderPass == getPartAmount() + 2) {
|
||||
if (tags.hasKey("Effect3")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect3"));
|
||||
} else if (renderPass == getPartAmount() + 3) {
|
||||
if (tags.hasKey("Effect4")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect4"));
|
||||
} else if (renderPass == getPartAmount() + 4) {
|
||||
if (tags.hasKey("Effect5")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect5"));
|
||||
} else if (renderPass == getPartAmount() + 5) {
|
||||
if (tags.hasKey("Effect6")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect6"));
|
||||
} else {
|
||||
return arrow2;
|
||||
}
|
||||
}
|
||||
@@ -689,75 +549,39 @@ public abstract class BowBase extends ToolCore
|
||||
return emptyIcon;
|
||||
}
|
||||
|
||||
public IIcon getIcon3 (ItemStack stack, int renderPass)
|
||||
{
|
||||
public IIcon getIcon3(ItemStack stack, int renderPass) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
if (tags != null)
|
||||
{
|
||||
if (tags != null) {
|
||||
tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (renderPass < getPartAmount())
|
||||
{
|
||||
if (renderPass < getPartAmount()) {
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
return getCorrectIcon(handleIcons3, tags.getInteger("RenderHandle"));
|
||||
}
|
||||
|
||||
else if (renderPass == 1) // Head
|
||||
} else if (renderPass == 1) // Head
|
||||
{
|
||||
return getCorrectIcon(headIcons3, tags.getInteger("RenderHead"));
|
||||
}
|
||||
|
||||
else if (renderPass == 2) // Accessory
|
||||
} else if (renderPass == 2) // Accessory
|
||||
{
|
||||
return getCorrectIcon(accessoryIcons3, tags.getInteger("RenderAccessory"));
|
||||
}
|
||||
|
||||
else if (renderPass == 3) // Extra
|
||||
} else if (renderPass == 3) // Extra
|
||||
{
|
||||
return getCorrectIcon(extraIcons3, tags.getInteger("RenderExtra"));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (renderPass == getPartAmount())
|
||||
{
|
||||
if (tags.hasKey("Effect1"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect1"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 1)
|
||||
{
|
||||
if (tags.hasKey("Effect2"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect2"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 2)
|
||||
{
|
||||
if (tags.hasKey("Effect3"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect3"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 3)
|
||||
{
|
||||
if (tags.hasKey("Effect4"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect4"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 4)
|
||||
{
|
||||
if (tags.hasKey("Effect5"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect5"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 5)
|
||||
{
|
||||
if (tags.hasKey("Effect6"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect6"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (renderPass == getPartAmount()) {
|
||||
if (tags.hasKey("Effect1")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect1"));
|
||||
} else if (renderPass == getPartAmount() + 1) {
|
||||
if (tags.hasKey("Effect2")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect2"));
|
||||
} else if (renderPass == getPartAmount() + 2) {
|
||||
if (tags.hasKey("Effect3")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect3"));
|
||||
} else if (renderPass == getPartAmount() + 3) {
|
||||
if (tags.hasKey("Effect4")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect4"));
|
||||
} else if (renderPass == getPartAmount() + 4) {
|
||||
if (tags.hasKey("Effect5")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect5"));
|
||||
} else if (renderPass == getPartAmount() + 5) {
|
||||
if (tags.hasKey("Effect6")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect6"));
|
||||
} else {
|
||||
return arrow3;
|
||||
}
|
||||
}
|
||||
@@ -767,15 +591,18 @@ public abstract class BowBase extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTool (int id, String name, List list)
|
||||
{
|
||||
public void buildTool(int id, String name, List list) {
|
||||
Item accessory = getAccessoryItem();
|
||||
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, id) : 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);
|
||||
if (tool == null)
|
||||
return;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, id),
|
||||
new ItemStack(getHandleItem(), 1, id),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
name);
|
||||
if (tool == null) return;
|
||||
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
|
||||
@@ -4,65 +4,56 @@ import net.minecraft.item.Item;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Broadsword extends Weapon
|
||||
{
|
||||
public Broadsword()
|
||||
{
|
||||
public class Broadsword extends Weapon {
|
||||
public Broadsword() {
|
||||
super(4);
|
||||
this.setUnlocalizedName("InfiTool.Broadsword");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.swordBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.wideGuard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_sword_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
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) {
|
||||
|
||||
@@ -15,28 +15,23 @@ import tconstruct.library.crafting.Detailing.DetailInput;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Chisel extends ToolCore
|
||||
{
|
||||
public Chisel()
|
||||
{
|
||||
public class Chisel extends ToolCore {
|
||||
public Chisel() {
|
||||
super(0);
|
||||
this.setUnlocalizedName("InfiTool.Chisel");
|
||||
this.setContainerItem(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem (ItemStack itemStack)
|
||||
{
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
public ItemStack getContainerItem(ItemStack itemStack) {
|
||||
if (itemStack.hasTagCompound()) {
|
||||
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)
|
||||
{
|
||||
if (random.nextInt(10) < 10 - reinforced) {
|
||||
AbilityHelper.damageTool(itemStack, 1, null, false);
|
||||
}
|
||||
}
|
||||
@@ -44,51 +39,50 @@ public class Chisel extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid (ItemStack par1ItemStack)
|
||||
{
|
||||
return par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Broken");
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) {
|
||||
return par1ItemStack.hasTagCompound()
|
||||
&& par1ItemStack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Broken");
|
||||
}
|
||||
|
||||
boolean performDetailing (World world, int x, int y, int z, int blockID, int blockMeta)
|
||||
{
|
||||
boolean performDetailing(World world, int x, int y, int z, int blockID, int blockMeta) {
|
||||
boolean detailed = false;
|
||||
return detailed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
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)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer entityplayer) {
|
||||
if (entityplayer.capabilities.isCreativeMode) {
|
||||
onEaten(stack, world, entityplayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.getBoolean("Broken"))
|
||||
entityplayer.setItemInUse(stack, getMaxItemUseDuration(stack));
|
||||
if (!tags.getBoolean("Broken")) entityplayer.setItemInUse(stack, getMaxItemUseDuration(stack));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten (ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) {
|
||||
if (!world.isRemote) {
|
||||
MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(world, entityplayer, true);
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
if (movingobjectposition == null) {
|
||||
return itemstack;
|
||||
}
|
||||
if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK)
|
||||
{
|
||||
if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK) {
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
@@ -96,19 +90,16 @@ public class Chisel extends ToolCore
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
DetailInput details = TConstruct.chiselDetailing.getDetailing(block, meta);
|
||||
if (details != null)
|
||||
{
|
||||
if (details != null) {
|
||||
world.setBlock(x, y, z, Block.getBlockFromItem(details.output.getItem()), details.outputMeta, 3);
|
||||
if (!(entityplayer.capabilities.isCreativeMode))
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (random.nextInt(10) < 10 - reinforced) {
|
||||
AbilityHelper.damageTool(itemstack, 1, null, false);
|
||||
}
|
||||
}
|
||||
@@ -123,15 +114,12 @@ public class Chisel extends ToolCore
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
if (entity instanceof EntityPlayerSP) {
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
if (usingItem != null && usingItem.getItem() == this) {
|
||||
player.movementInput.moveForward *= 2.0;
|
||||
player.movementInput.moveStrafe *= 2.0;
|
||||
}
|
||||
@@ -139,82 +127,68 @@ public class Chisel extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration (ItemStack itemstack)
|
||||
{
|
||||
if (!itemstack.hasTagCompound())
|
||||
return 20;
|
||||
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;
|
||||
if (truespeed < 0) truespeed = 0;
|
||||
return truespeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack itemstack)
|
||||
{
|
||||
public EnumAction getItemUseAction(ItemStack itemstack) {
|
||||
return EnumAction.eat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
public int getPartAmount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_chisel_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "chisel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.chiselHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "utility" };
|
||||
public String[] getTraits() {
|
||||
return new String[] {"utility"};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,118 +9,100 @@ import net.minecraft.world.World;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Cleaver extends Weapon
|
||||
{
|
||||
public Cleaver()
|
||||
{
|
||||
public class Cleaver extends Weapon {
|
||||
public Cleaver() {
|
||||
super(5);
|
||||
this.setUnlocalizedName("InfiTool.Cleaver");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.largeSwordBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
public Item getHandleItem() {
|
||||
return TinkerTools.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.largePlate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
public Item getExtraItem() {
|
||||
return TinkerTools.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
public int durabilityTypeAccessory() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
public int durabilityTypeExtra() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
public float getRepairCost() {
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
public float getDurabilityModifier() {
|
||||
return 2.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageModifier ()
|
||||
{
|
||||
public float getDamageModifier() {
|
||||
return 1.4f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_cleaver_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "cleaver";
|
||||
}
|
||||
|
||||
/* Cleaver specific */
|
||||
@Override
|
||||
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
if (AbilityHelper.onLeftClickEntity(stack, player, entity, this))
|
||||
{
|
||||
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)
|
||||
@@ -129,15 +111,12 @@ public class Cleaver extends Weapon
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == stack)
|
||||
{
|
||||
if (equipped == stack) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 2, 2, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,59 +4,50 @@ import net.minecraft.item.Item;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Cutlass extends Weapon
|
||||
{
|
||||
public Cutlass()
|
||||
{
|
||||
public class Cutlass extends Weapon {
|
||||
public Cutlass() {
|
||||
super(4);
|
||||
this.setUnlocalizedName("InfiTool.Cutlass");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.swordBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_cutlass_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "cutlass";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
public int durabilityTypeAccessory() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -7,24 +7,19 @@ import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.tools.entity.DaggerEntity;
|
||||
|
||||
public class Dagger extends Weapon
|
||||
{
|
||||
public Dagger()
|
||||
{
|
||||
public class Dagger extends Weapon {
|
||||
public Dagger() {
|
||||
super(1);
|
||||
this.setUnlocalizedName("InfiTool.Dagger");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack itemstack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) {
|
||||
ItemStack stack = itemstack.copy();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
DaggerEntity dagger = new DaggerEntity(world, player, 1.5f, 0, stack);
|
||||
//dagger.motionY++;
|
||||
if (player.capabilities.isCreativeMode)
|
||||
dagger.canBePickedUp = 2;
|
||||
// dagger.motionY++;
|
||||
if (player.capabilities.isCreativeMode) dagger.canBePickedUp = 2;
|
||||
world.spawnEntityInWorld(dagger);
|
||||
}
|
||||
itemstack.stackSize--;
|
||||
@@ -32,13 +27,11 @@ public class Dagger extends Weapon
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten (ItemStack itemstack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer player) {
|
||||
ItemStack stack = itemstack.copy();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
DaggerEntity dagger = new DaggerEntity(world, player, 1.5f, 0, stack);
|
||||
//dagger.motionY++;
|
||||
// dagger.motionY++;
|
||||
world.spawnEntityInWorld(dagger);
|
||||
}
|
||||
itemstack.stackSize--;
|
||||
@@ -46,67 +39,57 @@ public class Dagger extends Weapon
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "melee", "throwing" };
|
||||
public String[] getTraits() {
|
||||
return new String[] {"weapon", "melee", "throwing"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration (ItemStack stack)
|
||||
{
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public boolean rangedTool ()
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_dagger_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "dagger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.knifeBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.crossbar;
|
||||
}
|
||||
}
|
||||
@@ -1,138 +1,112 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import mantle.world.WorldHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import tconstruct.library.*;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Excavator extends AOEHarvestTool
|
||||
{
|
||||
public Excavator()
|
||||
{
|
||||
super(2, 1,0);
|
||||
public class Excavator extends AOEHarvestTool {
|
||||
public Excavator() {
|
||||
super(2, 1, 0);
|
||||
this.setUnlocalizedName("InfiTool.Excavator");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
protected String getHarvestType() {
|
||||
return "shovel";
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
|
||||
static Material[] materials = {
|
||||
Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay
|
||||
};
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.excavatorHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
public Item getHandleItem() {
|
||||
return TinkerTools.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.largePlate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
public Item getExtraItem() {
|
||||
return TinkerTools.toughBinding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
public float getRepairCost() {
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
public float getDurabilityModifier() {
|
||||
return 2.75f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
public int durabilityTypeAccessory() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
public int durabilityTypeExtra() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_excavator_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "excavator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public float breakSpeedModifier ()
|
||||
{
|
||||
public float breakSpeedModifier() {
|
||||
return 0.4f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float stoneboundModifier ()
|
||||
{
|
||||
public float stoneboundModifier() {
|
||||
return 216f;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,46 +15,50 @@ import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.tools.logic.EquipLogic;
|
||||
|
||||
public class FryingPan extends Weapon
|
||||
{
|
||||
public FryingPan()
|
||||
{
|
||||
public class FryingPan extends Weapon {
|
||||
public FryingPan() {
|
||||
super(2);
|
||||
this.setUnlocalizedName("InfiTool.FryPan");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity (ItemStack stack, EntityLivingBase mob, EntityLivingBase player)
|
||||
{
|
||||
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
|
||||
// seconds
|
||||
// of
|
||||
// stun
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity mob)
|
||||
{
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity mob) {
|
||||
if (mob.canAttackWithItem() && !mob.hitByEntity(player) && mob.hurtResistantTime < 14)
|
||||
AbilityHelper.onLeftClickEntity(stack, player, mob, this);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamaged (World world, EntityLivingBase player, Entity entity)
|
||||
{
|
||||
world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "tinker:frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
public void onEntityDamaged(World world, EntityLivingBase player, Entity entity) {
|
||||
world.playSoundEffect(
|
||||
entity.posX,
|
||||
entity.posY,
|
||||
entity.posZ,
|
||||
"tinker:frypan_hit",
|
||||
1.0F,
|
||||
(random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
public void getSubItems(Item 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, StatCollector.translateToLocal("tool.baneofpigs"));
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, 2),
|
||||
new ItemStack(getHandleItem(), 1, 16),
|
||||
null,
|
||||
StatCollector.translateToLocal("tool.baneofpigs"));
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
tags.setBoolean("Special", true);
|
||||
@@ -64,7 +68,7 @@ public class FryingPan extends Weapon
|
||||
tags.setInteger("BaseDurability", Integer.MAX_VALUE / 100);
|
||||
tags.setInteger("MiningSpeed", Integer.MAX_VALUE / 100);
|
||||
|
||||
int[] keyPair = new int[] { Integer.MAX_VALUE / 100, 0, 0 };
|
||||
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);
|
||||
@@ -74,56 +78,51 @@ public class FryingPan extends Weapon
|
||||
}
|
||||
|
||||
@Override
|
||||
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())
|
||||
{
|
||||
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.getBlock(x, y, z).getMaterial().isSolid())
|
||||
{
|
||||
} else if (!world.getBlock(x, y, z).getMaterial().isSolid()) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
} else {
|
||||
if (side == 1) {
|
||||
++y;
|
||||
}
|
||||
|
||||
if (side == 2)
|
||||
{
|
||||
if (side == 2) {
|
||||
--z;
|
||||
}
|
||||
|
||||
if (side == 3)
|
||||
{
|
||||
if (side == 3) {
|
||||
++z;
|
||||
}
|
||||
|
||||
if (side == 4)
|
||||
{
|
||||
if (side == 4) {
|
||||
--x;
|
||||
}
|
||||
|
||||
if (side == 5)
|
||||
{
|
||||
if (side == 5) {
|
||||
++x;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack))
|
||||
{
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack)) {
|
||||
return false;
|
||||
}
|
||||
else if (!TinkerTools.heldItemBlock.canPlaceBlockAt(world, x, y, z))
|
||||
{
|
||||
} else if (!TinkerTools.heldItemBlock.canPlaceBlockAt(world, x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
world.setBlock(x, y, z, TinkerTools.heldItemBlock, 0, 3);
|
||||
TinkerTools.heldItemBlock.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
world.playSoundEffect(x, y, z, "tinker:frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 0.65F);
|
||||
world.playSoundEffect(
|
||||
x, y, z, "tinker:frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 0.65F);
|
||||
|
||||
EquipLogic logic = (EquipLogic) world.getTileEntity(x, y, z);
|
||||
logic.setEquipmentItem(stack);
|
||||
@@ -135,56 +134,48 @@ public class FryingPan extends Weapon
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.frypanHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
public int getPartAmount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_frypan_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "frypan";
|
||||
}
|
||||
}
|
||||
@@ -2,153 +2,130 @@ package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import java.util.List;
|
||||
import mantle.world.WorldHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import tconstruct.library.*;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Hammer extends AOEHarvestTool
|
||||
{
|
||||
public Hammer()
|
||||
{
|
||||
public class Hammer extends AOEHarvestTool {
|
||||
public Hammer() {
|
||||
super(2, 1, 0);
|
||||
this.setUnlocalizedName("InfiTool.Hammer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
public int getPartAmount() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
public int durabilityTypeAccessory() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
public int durabilityTypeExtra() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
protected String getHarvestType() {
|
||||
return "pickaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
static Material[] materials = new Material[] { Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil };
|
||||
static Material[] materials =
|
||||
new Material[] {Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil
|
||||
};
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.hammerHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
public Item getHandleItem() {
|
||||
return TinkerTools.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.largePlate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
public Item getExtraItem() {
|
||||
return TinkerTools.largePlate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_hammer_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "hammer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon (ItemStack stack, int renderPass)
|
||||
{
|
||||
public IIcon getIcon(ItemStack stack, int renderPass) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
if (tags != null) {
|
||||
tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
if (tags.getBoolean("Broken"))
|
||||
return getCorrectIcon(brokenIcons, tags.getInteger("RenderHandle"));
|
||||
if (tags.getBoolean("Broken")) return getCorrectIcon(brokenIcons, tags.getInteger("RenderHandle"));
|
||||
return getCorrectIcon(handleIcons, tags.getInteger("RenderHandle"));
|
||||
}
|
||||
else if(renderPass == 1)
|
||||
return getCorrectIcon(headIcons, tags.getInteger("RenderHead"));
|
||||
} else if (renderPass == 1) return getCorrectIcon(headIcons, tags.getInteger("RenderHead"));
|
||||
}
|
||||
|
||||
return super.getIcon(stack, renderPass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
public void getSubItems(Item id, CreativeTabs tab, List list) {
|
||||
super.getSubItems(id, tab, list);
|
||||
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, 10), new ItemStack(getHandleItem(), 1, 8), new ItemStack(getAccessoryItem(), 1, 11), new ItemStack(getExtraItem(), 1, 11), StatCollector.translateToLocal("tool.infiminer"));
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, 10),
|
||||
new ItemStack(getHandleItem(), 1, 8),
|
||||
new ItemStack(getAccessoryItem(), 1, 11),
|
||||
new ItemStack(getExtraItem(), 1, 11),
|
||||
StatCollector.translateToLocal("tool.infiminer"));
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
tags.setBoolean("Special", true);
|
||||
@@ -163,24 +140,18 @@ public class Hammer extends AOEHarvestTool
|
||||
list.add(tool);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public float breakSpeedModifier ()
|
||||
{
|
||||
public float breakSpeedModifier() {
|
||||
return 0.4f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float stoneboundModifier ()
|
||||
{
|
||||
public float stoneboundModifier() {
|
||||
return 216f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "harvest", "melee", "bludgeoning" };
|
||||
public String[] getTraits() {
|
||||
return new String[] {"weapon", "harvest", "melee", "bludgeoning"};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,88 +9,77 @@ import net.minecraft.world.World;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Hatchet extends HarvestTool
|
||||
{
|
||||
public Hatchet()
|
||||
{
|
||||
public class Hatchet extends HarvestTool {
|
||||
public Hatchet() {
|
||||
super(3);
|
||||
this.setUnlocalizedName("InfiTool.Axe");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
protected String getHarvestType() {
|
||||
return "axe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed (ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase player)
|
||||
{
|
||||
if (block != null && block.getMaterial() == Material.leaves)
|
||||
return false;
|
||||
public boolean onBlockDestroyed(
|
||||
ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
|
||||
if (block != null && block.getMaterial() == Material.leaves) return false;
|
||||
|
||||
return AbilityHelper.onBlockChanged(itemstack, world, block, x, y, z, player, random);
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.wood, Material.leaves, Material.vine, Material.circuits, Material.cactus, Material.gourd };
|
||||
static Material[] materials = {
|
||||
Material.wood, Material.leaves, Material.vine, Material.circuits, Material.cactus, Material.gourd
|
||||
};
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.hatchetHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
public int getPartAmount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_axe_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "axe";
|
||||
}
|
||||
}
|
||||
@@ -10,49 +10,42 @@ import net.minecraft.world.World;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Longsword extends Weapon
|
||||
{
|
||||
public Longsword()
|
||||
{
|
||||
public class Longsword extends Weapon {
|
||||
public Longsword() {
|
||||
super(4);
|
||||
this.setUnlocalizedName("InfiTool.Longsword");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (player.onGround)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (player.onGround) {
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float chargeAttack ()
|
||||
{
|
||||
public float chargeAttack() {
|
||||
return 1.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int useCount)
|
||||
{
|
||||
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)
|
||||
@@ -61,35 +54,33 @@ public class Longsword extends Weapon
|
||||
* speed); } }
|
||||
*/
|
||||
int time = this.getMaxItemUseDuration(stack) - useCount;
|
||||
if (time > 5)
|
||||
{
|
||||
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;
|
||||
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);
|
||||
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)
|
||||
{
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
if (entity instanceof EntityPlayerSP) {
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
if (usingItem != null && usingItem.getItem() == this) {
|
||||
player.movementInput.moveForward *= 5.0F;
|
||||
player.movementInput.moveStrafe *= 5.0F;
|
||||
}
|
||||
@@ -97,44 +88,38 @@ public class Longsword extends Weapon
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.swordBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_longsword_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "longsword";
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.lang.LinkageError;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
import mantle.player.PlayerUtils;
|
||||
import mantle.world.WorldHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -23,52 +22,42 @@ import net.minecraft.world.World;
|
||||
import tconstruct.library.*;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
public class LumberAxe extends AOEHarvestTool
|
||||
{
|
||||
public LumberAxe()
|
||||
{
|
||||
super(0, 1,1);
|
||||
public class LumberAxe extends AOEHarvestTool {
|
||||
public LumberAxe() {
|
||||
super(0, 1, 1);
|
||||
this.setUnlocalizedName("InfiTool.LumberAxe");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
protected String getHarvestType() {
|
||||
return "axe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
public float getRepairCost() {
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
public float getDurabilityModifier() {
|
||||
return 2.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed (ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase player)
|
||||
{
|
||||
if (block != null && block.getMaterial() == Material.leaves)
|
||||
return false;
|
||||
public boolean onBlockDestroyed(
|
||||
ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
|
||||
if (block != null && block.getMaterial() == Material.leaves) return false;
|
||||
|
||||
return AbilityHelper.onBlockChanged(itemstack, world, block, x, y, z, player, random);
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.wood, Material.vine, Material.circuits, Material.cactus, Material.gourd };
|
||||
static Material[] materials = {Material.wood, Material.vine, Material.circuits, Material.cactus, Material.gourd};
|
||||
|
||||
/* Lumber axe specific */
|
||||
|
||||
@@ -83,32 +72,28 @@ public class LumberAxe extends AOEHarvestTool
|
||||
*/
|
||||
|
||||
@Override
|
||||
public float breakSpeedModifier ()
|
||||
{
|
||||
public float breakSpeedModifier() {
|
||||
return 0.4f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float stoneboundModifier ()
|
||||
{
|
||||
public float stoneboundModifier() {
|
||||
return 216f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if (!stack.hasTagCompound() || player.isSneaking())
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
if (!stack.hasTagCompound() || player.isSneaking()) return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
World world = player.worldObj;
|
||||
final Block wood = world.getBlock(x, y, z);
|
||||
|
||||
if (wood == null)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
if (wood == null) return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
if (wood.isWood(world, x, y, z) || wood.getMaterial() == Material.sponge)
|
||||
if(detectTree(world, x,y,z)) {
|
||||
TreeChopTask chopper = new TreeChopTask((AOEHarvestTool)this, stack, new ChunkPosition(x, y, z), player, 128);
|
||||
if (detectTree(world, x, y, z)) {
|
||||
TreeChopTask chopper =
|
||||
new TreeChopTask((AOEHarvestTool) this, stack, new ChunkPosition(x, y, z), player, 128);
|
||||
try {
|
||||
FMLCommonHandler.instance().bus().register(chopper);
|
||||
} catch (LinkageError l) {
|
||||
@@ -122,57 +107,59 @@ public class LumberAxe extends AOEHarvestTool
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
public static boolean detectTree(World world, int pX, int pY, int pZ) {
|
||||
ChunkPosition pos = null;
|
||||
Stack<ChunkPosition> candidates = new Stack<>();
|
||||
candidates.add(new ChunkPosition(pX, pY, pZ));
|
||||
public static boolean detectTree(World world, int pX, int pY, int pZ) {
|
||||
ChunkPosition pos = null;
|
||||
Stack<ChunkPosition> candidates = new Stack<>();
|
||||
candidates.add(new ChunkPosition(pX, pY, pZ));
|
||||
|
||||
while (!candidates.isEmpty()) {
|
||||
ChunkPosition candidate = candidates.pop();
|
||||
int curX = candidate.chunkPosX, curY = candidate.chunkPosY, curZ = candidate.chunkPosZ;
|
||||
while (!candidates.isEmpty()) {
|
||||
ChunkPosition candidate = candidates.pop();
|
||||
int curX = candidate.chunkPosX, curY = candidate.chunkPosY, curZ = candidate.chunkPosZ;
|
||||
|
||||
Block block = world.getBlock(curX, curY, curZ);
|
||||
if ((pos == null || candidate.chunkPosY > pos.chunkPosY) && block.isWood(world, curX, curY, curZ)) {
|
||||
pos = new ChunkPosition(curX, candidate.chunkPosY + 1, curZ);
|
||||
// go up
|
||||
while (world.getBlock(curX, pos.chunkPosY, curZ).isWood(world, curX, pos.chunkPosY, curZ)) {
|
||||
pos = new ChunkPosition(curX, pos.chunkPosY + 1, curZ);
|
||||
}
|
||||
// check if we still have a way diagonally up
|
||||
candidates.add(new ChunkPosition(curX + 1, pos.chunkPosY + 1, curZ ));
|
||||
candidates.add(new ChunkPosition(curX , pos.chunkPosY + 1, curZ + 1));
|
||||
candidates.add(new ChunkPosition(curX - 1, pos.chunkPosY + 1, curZ ));
|
||||
candidates.add(new ChunkPosition(curX , pos.chunkPosY + 1, curZ - 1));
|
||||
}
|
||||
}
|
||||
Block block = world.getBlock(curX, curY, curZ);
|
||||
if ((pos == null || candidate.chunkPosY > pos.chunkPosY) && block.isWood(world, curX, curY, curZ)) {
|
||||
pos = new ChunkPosition(curX, candidate.chunkPosY + 1, curZ);
|
||||
// go up
|
||||
while (world.getBlock(curX, pos.chunkPosY, curZ).isWood(world, curX, pos.chunkPosY, curZ)) {
|
||||
pos = new ChunkPosition(curX, pos.chunkPosY + 1, curZ);
|
||||
}
|
||||
// check if we still have a way diagonally up
|
||||
candidates.add(new ChunkPosition(curX + 1, pos.chunkPosY + 1, curZ));
|
||||
candidates.add(new ChunkPosition(curX, pos.chunkPosY + 1, curZ + 1));
|
||||
candidates.add(new ChunkPosition(curX - 1, pos.chunkPosY + 1, curZ));
|
||||
candidates.add(new ChunkPosition(curX, pos.chunkPosY + 1, curZ - 1));
|
||||
}
|
||||
}
|
||||
|
||||
// not even one match, so there were no logs.
|
||||
if (pos == null) {
|
||||
return false;
|
||||
}
|
||||
// not even one match, so there were no logs.
|
||||
if (pos == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if there were enough leaves around the last position
|
||||
// pos now contains the block above the topmost log
|
||||
// we want at least 5 leaves in the surrounding 26 blocks
|
||||
int d = 3;
|
||||
int leaves = 0;
|
||||
for (int offX = 0; offX < d; offX++) {
|
||||
for (int offY = 0; offY < d; offY++) {
|
||||
for (int offZ = 0; offZ < d; offZ++) {
|
||||
int xPos = pos.chunkPosX -1 + offX, yPos = pos.chunkPosY - 1 + offY, zPos = pos.chunkPosZ - 1 + offZ;
|
||||
Block leaf = world.getBlock(xPos, yPos, zPos);
|
||||
if (leaf != null && leaf.isLeaves(world, xPos, yPos, zPos)) {
|
||||
if (++leaves >= 5) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if there were enough leaves around the last position
|
||||
// pos now contains the block above the topmost log
|
||||
// we want at least 5 leaves in the surrounding 26 blocks
|
||||
int d = 3;
|
||||
int leaves = 0;
|
||||
for (int offX = 0; offX < d; offX++) {
|
||||
for (int offY = 0; offY < d; offY++) {
|
||||
for (int offZ = 0; offZ < d; offZ++) {
|
||||
int xPos = pos.chunkPosX - 1 + offX,
|
||||
yPos = pos.chunkPosY - 1 + offY,
|
||||
zPos = pos.chunkPosZ - 1 + offZ;
|
||||
Block leaf = world.getBlock(xPos, yPos, zPos);
|
||||
if (leaf != null && leaf.isLeaves(world, xPos, yPos, zPos)) {
|
||||
if (++leaves >= 5) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// not enough leaves. sorreh
|
||||
return false;
|
||||
}
|
||||
// not enough leaves. sorreh
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class TreeChopTask {
|
||||
|
||||
@@ -185,165 +172,154 @@ public class LumberAxe extends AOEHarvestTool
|
||||
public Queue<ChunkPosition> blocks = Lists.newLinkedList();
|
||||
public Set<ChunkPosition> visited = new THashSet<>();
|
||||
|
||||
public TreeChopTask(AOEHarvestTool tool, ItemStack stack, ChunkPosition start, EntityPlayer player, int blocksPerTick) {
|
||||
this.world = player.getEntityWorld();
|
||||
this.player = player;
|
||||
this.tool = tool;
|
||||
this.stack = stack;
|
||||
this.blocksPerTick = blocksPerTick;
|
||||
public TreeChopTask(
|
||||
AOEHarvestTool tool, ItemStack stack, ChunkPosition start, EntityPlayer player, int blocksPerTick) {
|
||||
this.world = player.getEntityWorld();
|
||||
this.player = player;
|
||||
this.tool = tool;
|
||||
this.stack = stack;
|
||||
this.blocksPerTick = blocksPerTick;
|
||||
|
||||
this.blocks.add(start);
|
||||
}
|
||||
this.blocks.add(start);
|
||||
}
|
||||
|
||||
private void queueCoordinate(int x, int y, int z) {
|
||||
ChunkPosition pos = new ChunkPosition(x, y, z);
|
||||
if (!visited.contains(pos)) {
|
||||
blocks.add(pos);
|
||||
}
|
||||
}
|
||||
private void queueCoordinate(int x, int y, int z) {
|
||||
ChunkPosition pos = new ChunkPosition(x, y, z);
|
||||
if (!visited.contains(pos)) {
|
||||
blocks.add(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldTick(TickEvent.WorldTickEvent event) {
|
||||
if (event.side.isClient()) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
// only if same dimension
|
||||
if (event.world.provider.dimensionId != world.provider.dimensionId) {
|
||||
return;
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onWorldTick(TickEvent.WorldTickEvent event) {
|
||||
if (event.side.isClient()) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
// only if same dimension
|
||||
if (event.world.provider.dimensionId != world.provider.dimensionId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// setup
|
||||
int left = blocksPerTick;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
// setup
|
||||
int left = blocksPerTick;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
// continue running
|
||||
ChunkPosition pos;
|
||||
while (left > 0) {
|
||||
// completely done or can't do our job anymore?!
|
||||
if (blocks.isEmpty() || tags.getBoolean("Broken")) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
// continue running
|
||||
ChunkPosition pos;
|
||||
while (left > 0) {
|
||||
// completely done or can't do our job anymore?!
|
||||
if (blocks.isEmpty() || tags.getBoolean("Broken")) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
pos = blocks.remove();
|
||||
if (!visited.add(pos)) {
|
||||
continue;
|
||||
}
|
||||
int x = pos.chunkPosX, y = pos.chunkPosY, z = pos.chunkPosZ;
|
||||
pos = blocks.remove();
|
||||
if (!visited.add(pos)) {
|
||||
continue;
|
||||
}
|
||||
int x = pos.chunkPosX, y = pos.chunkPosY, z = pos.chunkPosZ;
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
// can we harvest the block and is effective?
|
||||
if (!block.isWood(world, x, y, z) || !tool.isEffective(block, meta)) {
|
||||
continue;
|
||||
}
|
||||
// can we harvest the block and is effective?
|
||||
if (!block.isWood(world, x, y, z) || !tool.isEffective(block, meta)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// save its neighbors
|
||||
queueCoordinate(x + 1, y, z );
|
||||
queueCoordinate(x, y, z + 1);
|
||||
queueCoordinate(x - 1, y, z );
|
||||
queueCoordinate(x, y, z - 1);
|
||||
// save its neighbors
|
||||
queueCoordinate(x + 1, y, z);
|
||||
queueCoordinate(x, y, z + 1);
|
||||
queueCoordinate(x - 1, y, z);
|
||||
queueCoordinate(x, y, z - 1);
|
||||
|
||||
// also add the layer above.. stupid acacia trees
|
||||
for (int offX = 0; offX < 3; offX++) {
|
||||
for (int offZ = 0; offZ < 3; offZ++) {
|
||||
queueCoordinate(x - 1 + offX, y + 1, z - 1 + offZ);
|
||||
}
|
||||
}
|
||||
// also add the layer above.. stupid acacia trees
|
||||
for (int offX = 0; offX < 3; offX++) {
|
||||
for (int offZ = 0; offZ < 3; offZ++) {
|
||||
queueCoordinate(x - 1 + offX, y + 1, z - 1 + offZ);
|
||||
}
|
||||
}
|
||||
|
||||
// break it, wooo!
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers) {
|
||||
if (mod.beforeBlockBreak(tool, stack, x, y, z, player)) {
|
||||
cancelHarvest = true;
|
||||
}
|
||||
}
|
||||
if(!cancelHarvest)
|
||||
tool.breakExtraBlock(player.worldObj, x, y, z, 0, player, x, y, z);
|
||||
// break it, wooo!
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers) {
|
||||
if (mod.beforeBlockBreak(tool, stack, x, y, z, player)) {
|
||||
cancelHarvest = true;
|
||||
}
|
||||
}
|
||||
if (!cancelHarvest) tool.breakExtraBlock(player.worldObj, x, y, z, 0, player, x, y, z);
|
||||
|
||||
left--;
|
||||
}
|
||||
}
|
||||
left--;
|
||||
}
|
||||
}
|
||||
|
||||
private void finish() {
|
||||
// goodbye cruel world
|
||||
FMLCommonHandler.instance().bus().unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
return TinkerTools.broadAxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
return TinkerTools.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
return TinkerTools.largePlate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
return TinkerTools.toughBinding;
|
||||
}
|
||||
|
||||
@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 "";
|
||||
private void finish() {
|
||||
// goodbye cruel world
|
||||
FMLCommonHandler.instance().bus().unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.broadAxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem() {
|
||||
return TinkerTools.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.largePlate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem() {
|
||||
return TinkerTools.toughBinding;
|
||||
}
|
||||
|
||||
@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 ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "lumberaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
public int durabilityTypeAccessory() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
public int durabilityTypeExtra() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -10,119 +10,108 @@ import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class Mattock extends DualHarvestTool
|
||||
{
|
||||
public Mattock()
|
||||
{
|
||||
public class Mattock extends DualHarvestTool {
|
||||
public Mattock() {
|
||||
super(3);
|
||||
this.setUnlocalizedName("InfiTool.Mattock");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return axeMaterials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveSecondaryMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveSecondaryMaterials() {
|
||||
return shovelMaterials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
protected String getHarvestType() {
|
||||
return "axe";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSecondHarvestType ()
|
||||
{
|
||||
protected String getSecondHarvestType() {
|
||||
return "shovel";
|
||||
}
|
||||
|
||||
static Material[] axeMaterials = { Material.wood, Material.cactus, Material.plants, Material.vine, Material.gourd };
|
||||
static Material[] shovelMaterials = { Material.grass, Material.ground, Material.clay };
|
||||
static Material[] axeMaterials = {Material.wood, Material.cactus, Material.plants, Material.vine, Material.gourd};
|
||||
static Material[] shovelMaterials = {Material.grass, Material.ground, Material.clay};
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.hatchetHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.shovelHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_mattock_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
if (tags.getBoolean("Broken")) return false;
|
||||
|
||||
return AbilityHelper.hoeGround(stack, player, world, x, y, z, side, random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTool (int id, String name, List list)
|
||||
{
|
||||
if (!PHConstruct.denyMattock || allowCrafting(id))
|
||||
{
|
||||
public void buildTool(int id, String name, List list) {
|
||||
if (!PHConstruct.denyMattock || allowCrafting(id)) {
|
||||
super.buildTool(id, name, list);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean allowCrafting (int head)
|
||||
{
|
||||
int[] nonMetals = { 0, 1, 3, 4, 5, 6, 7, 8, 9, 17 };
|
||||
for (int i = 0; i < nonMetals.length; i++)
|
||||
{
|
||||
if (head == nonMetals[i])
|
||||
return false;
|
||||
private boolean allowCrafting(int head) {
|
||||
int[] nonMetals = {0, 1, 3, 4, 5, 6, 7, 8, 9, 17};
|
||||
for (int i = 0; i < nonMetals.length; i++) {
|
||||
if (head == nonMetals[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,68 +5,59 @@ import net.minecraft.item.Item;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Pickaxe extends HarvestTool
|
||||
{
|
||||
public Pickaxe()
|
||||
{
|
||||
public class Pickaxe extends HarvestTool {
|
||||
public Pickaxe() {
|
||||
super(1);
|
||||
this.setUnlocalizedName("InfiTool.Pickaxe");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
protected String getHarvestType() {
|
||||
return "pickaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
static Material[] materials = new Material[] { Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil, Material.circuits };
|
||||
static Material[] materials = new Material[] {
|
||||
Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil, Material.circuits
|
||||
};
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.pickaxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_pickaxe_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "pickaxe";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,14 +13,13 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.tools.entity.LaunchedPotion;
|
||||
|
||||
public class PotionLauncher extends Item
|
||||
{
|
||||
public class PotionLauncher extends Item {
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
public static final String[] textureNames = new String[] { "potionlauncher" };
|
||||
|
||||
public PotionLauncher()
|
||||
{
|
||||
public static final String[] textureNames = new String[] {"potionlauncher"};
|
||||
|
||||
public PotionLauncher() {
|
||||
super();
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CreativeTabs.tabCombat);
|
||||
@@ -28,12 +27,10 @@ public class PotionLauncher extends Item
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
boolean loaded = tags.getBoolean("Loaded");
|
||||
if (!loaded)
|
||||
{
|
||||
if (!loaded) {
|
||||
int slotID = getInventorySlotContainItem(Items.potionitem, player.inventory);
|
||||
ItemStack potion = player.inventory.getStackInSlot(slotID);
|
||||
|
||||
@@ -42,31 +39,30 @@ public class PotionLauncher extends Item
|
||||
tags.setTag("LoadedPotion", potionTag);
|
||||
tags.setBoolean("Loaded", true);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
potion.stackSize--;
|
||||
if (potion.stackSize < 1)
|
||||
player.inventory.setInventorySlotContents(slotID, null);
|
||||
if (potion.stackSize < 1) player.inventory.setInventorySlotContents(slotID, null);
|
||||
}
|
||||
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "tinker:launcher_clank", 1.0F, (world.rand.nextFloat() - world.rand.nextFloat()) * 0.15F + 1.0F);
|
||||
world.playSoundEffect(
|
||||
player.posX,
|
||||
player.posY,
|
||||
player.posZ,
|
||||
"tinker:launcher_clank",
|
||||
1.0F,
|
||||
(world.rand.nextFloat() - world.rand.nextFloat()) * 0.15F + 1.0F);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int time)
|
||||
{
|
||||
|
||||
}
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int time) {}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int slotID = getInventorySlotContainItem(Items.potionitem, player.inventory);
|
||||
if (!tags.getBoolean("Loaded") && slotID >= 0)
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
if (!tags.getBoolean("Loaded") && slotID >= 0) player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -74,8 +70,7 @@ public class PotionLauncher extends Item
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
@Override
|
||||
public int getMaxItemUseDuration (ItemStack stack)
|
||||
{
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 30;
|
||||
}
|
||||
|
||||
@@ -84,36 +79,31 @@ public class PotionLauncher extends Item
|
||||
* is being used
|
||||
*/
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack stack)
|
||||
{
|
||||
if (stack != null && stack.hasTagCompound() && !stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Loaded"))
|
||||
return EnumAction.bow;
|
||||
else
|
||||
return EnumAction.none;
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
if (stack != null
|
||||
&& stack.hasTagCompound()
|
||||
&& !stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Loaded")) return EnumAction.bow;
|
||||
else return EnumAction.none;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = par1IconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage (int meta)
|
||||
{
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item b, CreativeTabs tabs, List list)
|
||||
{
|
||||
public void getSubItems(Item b, CreativeTabs tabs, List list) {
|
||||
ItemStack stack = new ItemStack(b, 1, 0);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
@@ -127,22 +117,17 @@ public class PotionLauncher extends Item
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEntitySwing (EntityLivingBase player, ItemStack stack)
|
||||
{
|
||||
if (stack != null && stack.hasTagCompound())
|
||||
{
|
||||
public boolean onEntitySwing(EntityLivingBase player, ItemStack stack) {
|
||||
if (stack != null && stack.hasTagCompound()) {
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Loaded"))
|
||||
{
|
||||
if (tags.getBoolean("Loaded")) {
|
||||
NBTTagCompound potionTag = tags.getCompoundTag("LoadedPotion");
|
||||
ItemStack potion = ItemStack.loadItemStackFromNBT(potionTag);// findPotion(player);InventoryLogic
|
||||
if (potion != null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(new LaunchedPotion(world, player, potion));
|
||||
}
|
||||
tags.removeTag("LoadedPotion");
|
||||
@@ -154,26 +139,20 @@ public class PotionLauncher extends Item
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack findPotion (EntityLivingBase living)
|
||||
{
|
||||
if (living instanceof EntityPlayer)
|
||||
{
|
||||
ItemStack findPotion(EntityLivingBase living) {
|
||||
if (living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
int potionSlot = getInventorySlotContainItem(Items.potionitem, player.inventory);
|
||||
if (potionSlot >= 0)
|
||||
{
|
||||
if (potionSlot >= 0) {
|
||||
return player.inventory.getStackInSlot(potionSlot);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
int getInventorySlotContainItem (Item item, InventoryPlayer inventory)
|
||||
{
|
||||
for (int j = 0; j < inventory.mainInventory.length; ++j)
|
||||
{
|
||||
if (inventory.mainInventory[j] != null && inventory.mainInventory[j].getItem() == item)
|
||||
{
|
||||
int getInventorySlotContainItem(Item item, InventoryPlayer inventory) {
|
||||
for (int j = 0; j < inventory.mainInventory.length; ++j) {
|
||||
if (inventory.mainInventory[j] != null && inventory.mainInventory[j].getItem() == item) {
|
||||
return j;
|
||||
}
|
||||
}
|
||||
@@ -183,8 +162,7 @@ public class PotionLauncher extends Item
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
list.add(StatCollector.translateToLocal("potionlauncher.tooltip"));
|
||||
}
|
||||
}
|
||||
@@ -9,54 +9,49 @@ import net.minecraft.world.World;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Rapier extends Weapon
|
||||
{
|
||||
public Rapier()
|
||||
{
|
||||
public class Rapier extends Weapon {
|
||||
public Rapier() {
|
||||
super(2);
|
||||
this.setUnlocalizedName("InfiTool.Rapier");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.none;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (player.onGround)
|
||||
{
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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;
|
||||
if (mob.hurtResistantTime > 18) mob.hurtResistantTime -= 5;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
public float getDurabilityModifier() {
|
||||
return 0.7f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageModifier ()
|
||||
{
|
||||
public float getDamageModifier() {
|
||||
return 0.8f;
|
||||
}
|
||||
|
||||
@@ -65,56 +60,48 @@ public class Rapier extends Weapon
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean pierceArmor ()
|
||||
{
|
||||
public boolean pierceArmor() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.swordBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_rapier_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "rapier";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return none;
|
||||
}
|
||||
}
|
||||
@@ -23,10 +23,8 @@ import tconstruct.library.*;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Scythe extends Weapon
|
||||
{
|
||||
public Scythe()
|
||||
{
|
||||
public class Scythe extends Weapon {
|
||||
public Scythe() {
|
||||
super(4);
|
||||
this.setUnlocalizedName("InfiTool.Scythe");
|
||||
}
|
||||
@@ -36,210 +34,214 @@ public class Scythe extends Weapon
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
static Material[] materials = new Material[] { Material.web, Material.cactus, Material.plants, Material.leaves, Material.vine, Material.gourd };
|
||||
static Material[] materials = new Material[] {
|
||||
Material.web, Material.cactus, Material.plants, Material.leaves, Material.vine, Material.gourd
|
||||
};
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.scytheBlade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
public Item getHandleItem() {
|
||||
return TinkerTools.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.toughBinding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
public Item getExtraItem() {
|
||||
return TinkerTools.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
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 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 "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
public float getDurabilityModifier() {
|
||||
return 3.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
public float getRepairCost() {
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_scythe_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "scythe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
public int durabilityTypeAccessory() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
public int durabilityTypeExtra() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageModifier ()
|
||||
{
|
||||
public float getDamageModifier() {
|
||||
return 0.75f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "melee", "harvest" };
|
||||
public String[] getTraits() {
|
||||
return new String[] {"weapon", "melee", "harvest"};
|
||||
}
|
||||
|
||||
/* Scythe Specific */
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
if (!stack.hasTagCompound()) return false;
|
||||
|
||||
World world = player.worldObj;
|
||||
final Block blockB = world.getBlock(x, y, z);
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
if (!stack.hasTagCompound()) return false;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
boolean butter = EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0;
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(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")))
|
||||
{
|
||||
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;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers) {
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player)) cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (!cancelHarvest) {
|
||||
Block localBlock = world.getBlock(xPos, yPos, zPos);
|
||||
int localMeta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, xPos, yPos, zPos);
|
||||
if (localBlock != null)// && (block.blockMaterial == Material.leaves || block.isLeaves(world, xPos, yPos, zPos)))
|
||||
float localHardness = localBlock == null
|
||||
? Float.MAX_VALUE
|
||||
: localBlock.getBlockHardness(world, xPos, yPos, zPos);
|
||||
if (localBlock
|
||||
!= null) // && (block.blockMaterial == Material.leaves || block.isLeaves(world,
|
||||
// xPos, yPos, zPos)))
|
||||
{
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == localBlock.getMaterial())
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (butter && localBlock instanceof IShearable && ((IShearable) localBlock).isShearable(stack, player.worldObj, xPos, yPos, zPos))
|
||||
{
|
||||
ArrayList<ItemStack> drops = ((IShearable) localBlock).onSheared(stack, player.worldObj, xPos, yPos, zPos, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack));
|
||||
for (int iter = 0; iter < materials.length; iter++) {
|
||||
if (materials[iter] == localBlock.getMaterial()) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
if (butter
|
||||
&& localBlock instanceof IShearable
|
||||
&& ((IShearable) localBlock)
|
||||
.isShearable(stack, player.worldObj, xPos, yPos, zPos)) {
|
||||
ArrayList<ItemStack> drops = ((IShearable) localBlock)
|
||||
.onSheared(
|
||||
stack,
|
||||
player.worldObj,
|
||||
xPos,
|
||||
yPos,
|
||||
zPos,
|
||||
EnchantmentHelper.getEnchantmentLevel(
|
||||
Enchantment.fortune.effectId, stack));
|
||||
Random rand = new Random();
|
||||
|
||||
if (!world.isRemote)
|
||||
for (ItemStack dropStack : drops)
|
||||
{
|
||||
for (ItemStack dropStack : drops) {
|
||||
float f = 0.7F;
|
||||
double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, (double) xPos + d, (double) yPos + d1, (double) zPos + d2, dropStack);
|
||||
double d = (double) (rand.nextFloat() * f)
|
||||
+ (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (rand.nextFloat() * f)
|
||||
+ (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (rand.nextFloat() * f)
|
||||
+ (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(
|
||||
player.worldObj,
|
||||
(double) xPos + d,
|
||||
(double) yPos + d1,
|
||||
(double) zPos + d2,
|
||||
dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
if (localHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player);
|
||||
player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(localBlock)], 1);
|
||||
onBlockDestroyed(
|
||||
stack, world, localBlock, xPos, yPos, zPos, player);
|
||||
player.addStat(
|
||||
StatList.mineBlockStatArray[Block.getIdFromBlock(localBlock)],
|
||||
1);
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
|
||||
// Workaround for dropping experience
|
||||
int exp = localBlock.getExpDrop(world, localMeta, fortune);
|
||||
|
||||
localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
|
||||
if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos, true))
|
||||
{
|
||||
localBlock.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta);
|
||||
if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos, true)) {
|
||||
localBlock.onBlockDestroyedByPlayer(
|
||||
world, xPos, yPos, zPos, localMeta);
|
||||
localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
// Workaround for dropping experience
|
||||
if (!butter)
|
||||
localBlock.dropXpOnBlockBreak(world, xPos, yPos, zPos, exp);
|
||||
}
|
||||
|
||||
if (world.isRemote)
|
||||
{
|
||||
INetHandler handler = FMLClientHandler.instance().getClientPlayHandler();
|
||||
if (handler != null && handler instanceof NetHandlerPlayClient)
|
||||
{
|
||||
NetHandlerPlayClient handlerClient = (NetHandlerPlayClient) handler;
|
||||
handlerClient.addToSendQueue(new C07PacketPlayerDigging(0, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
|
||||
handlerClient.addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
|
||||
if (world.isRemote) {
|
||||
INetHandler handler = FMLClientHandler.instance()
|
||||
.getClientPlayHandler();
|
||||
if (handler != null && handler instanceof NetHandlerPlayClient) {
|
||||
NetHandlerPlayClient handlerClient =
|
||||
(NetHandlerPlayClient) handler;
|
||||
handlerClient.addToSendQueue(new C07PacketPlayerDigging(
|
||||
0,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
Minecraft.getMinecraft().objectMouseOver.sideHit));
|
||||
handlerClient.addToSendQueue(new C07PacketPlayerDigging(
|
||||
2,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
Minecraft.getMinecraft().objectMouseOver.sideHit));
|
||||
}
|
||||
}
|
||||
|
||||
if (localHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player);
|
||||
onBlockDestroyed(
|
||||
stack, world, localBlock, xPos, yPos, zPos, player);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
@@ -250,21 +252,24 @@ public class Scythe extends Weapon
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(blockB) + (meta << 12));
|
||||
if (!world.isRemote) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(blockB) + (meta << 12));
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(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);
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(
|
||||
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)
|
||||
{
|
||||
for (Object o : list) {
|
||||
AbilityHelper.onLeftClickEntity(stack, player, (Entity) o, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,93 +16,77 @@ import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
|
||||
@Deprecated
|
||||
public class Shortbow extends BowBase
|
||||
{
|
||||
public Shortbow()
|
||||
{
|
||||
public class Shortbow extends BowBase {
|
||||
public Shortbow() {
|
||||
super();
|
||||
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 "";
|
||||
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
|
||||
protected int getDefaultColor(int renderPass, int materialID) {
|
||||
// bowstring uses custom material
|
||||
if(renderPass == 0) {
|
||||
if (renderPass == 0) {
|
||||
CustomMaterial mat = TConstructRegistry.getCustomMaterial(materialID, BowstringMaterial.class);
|
||||
if(mat != null)
|
||||
return mat.color;
|
||||
if (mat != null) return mat.color;
|
||||
}
|
||||
|
||||
return super.getDefaultColor(renderPass, materialID);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_bow_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "shortbow";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.toolRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
public Item getHandleItem() {
|
||||
return TinkerWeaponry.bowstring;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.toolRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "ranged", "bow" };
|
||||
public String[] getTraits() {
|
||||
return new String[] {"weapon", "ranged", "bow"};
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
if (entity instanceof EntityPlayerSP) {
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
if (usingItem != null && usingItem.getItem() == this) {
|
||||
player.movementInput.moveForward *= 2.0F;
|
||||
player.movementInput.moveStrafe *= 2.0F;
|
||||
}
|
||||
@@ -111,60 +95,52 @@ public class Shortbow extends BowBase
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (!stack.hasTagCompound()) return;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
if (tags.hasKey("Energy")) {
|
||||
String color = "";
|
||||
// double joules = this.getJoules(stack);
|
||||
int power = tags.getInteger("Energy");
|
||||
|
||||
if (power != 0)
|
||||
{
|
||||
if (power <= this.getMaxEnergyStored(stack) / 3)
|
||||
color = "\u00a74";
|
||||
else if (power > this.getMaxEnergyStored(stack) * 2 / 3)
|
||||
color = "\u00a72";
|
||||
else
|
||||
color = "\u00a76";
|
||||
if (power != 0) {
|
||||
if (power <= this.getMaxEnergyStored(stack) / 3) color = "\u00a74";
|
||||
else if (power > this.getMaxEnergyStored(stack) * 2 / 3) color = "\u00a72";
|
||||
else color = "\u00a76";
|
||||
}
|
||||
|
||||
String energy = new StringBuilder().append(color).append(tags.getInteger("Energy")).append("/").append(getMaxEnergyStored(stack)).append(" RF").toString();
|
||||
String energy = new StringBuilder()
|
||||
.append(color)
|
||||
.append(tags.getInteger("Energy"))
|
||||
.append("/")
|
||||
.append(getMaxEnergyStored(stack))
|
||||
.append(" RF")
|
||||
.toString();
|
||||
list.add(energy);
|
||||
}
|
||||
if (tags.hasKey("InfiTool"))
|
||||
{
|
||||
if (tags.hasKey("InfiTool")) {
|
||||
boolean broken = tags.getCompoundTag("InfiTool").getBoolean("Broken");
|
||||
if (broken)
|
||||
list.add("\u00A7oBroken");
|
||||
else
|
||||
{
|
||||
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, 0);
|
||||
if (!headName.equals(""))
|
||||
list.add(getStyleForType(head) + headName);
|
||||
if (!headName.equals("")) list.add(getStyleForType(head) + headName);
|
||||
|
||||
String handleName = getBowstringName(handle);
|
||||
if (!handleName.equals("") && handle != head)
|
||||
list.add(handleName);
|
||||
if (!handleName.equals("") && handle != head) list.add(handleName);
|
||||
|
||||
if (getPartAmount() >= 3)
|
||||
{
|
||||
if (getPartAmount() >= 3) {
|
||||
String bindingName = getAbilityNameForType(binding, 0);
|
||||
if (!bindingName.equals("") && binding != head && binding != handle)
|
||||
list.add(getStyleForType(binding) + bindingName);
|
||||
}
|
||||
|
||||
if (getPartAmount() >= 4)
|
||||
{
|
||||
if (getPartAmount() >= 4) {
|
||||
String extraName = getAbilityNameForType(extra, 0);
|
||||
if (!extraName.equals("") && extra != head && extra != handle && extra != binding)
|
||||
list.add(getStyleForType(extra) + extraName);
|
||||
@@ -172,41 +148,33 @@ public class Shortbow extends BowBase
|
||||
|
||||
int unbreaking = tags.getCompoundTag("InfiTool").getInteger("Unbreaking");
|
||||
String reinforced = getReinforcedName(head, handle, binding, extra, unbreaking);
|
||||
if (!reinforced.equals(""))
|
||||
list.add(reinforced);
|
||||
if (!reinforced.equals("")) list.add(reinforced);
|
||||
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
while (displayToolTips) {
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.getCompoundTag("InfiTool").hasKey(tooltip))
|
||||
{
|
||||
if (tags.getCompoundTag("InfiTool").hasKey(tooltip)) {
|
||||
String tipName = tags.getCompoundTag("InfiTool").getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
if (!tipName.equals("")) list.add(tipName);
|
||||
} else displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
list.add("");
|
||||
list.add("\u00A79+" + tags.getCompoundTag("InfiTool").getInteger("Attack") + " " + StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage"));
|
||||
|
||||
list.add("\u00A79+" + tags.getCompoundTag("InfiTool").getInteger("Attack") + " "
|
||||
+ StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage"));
|
||||
}
|
||||
|
||||
public String getBowstringName (int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
return "";
|
||||
case 1:
|
||||
return "\u00A7bEnchanted";
|
||||
default:
|
||||
return "";
|
||||
public String getBowstringName(int type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
return "";
|
||||
case 1:
|
||||
return "\u00A7bEnchanted";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
// return TConstructRegistry.getMaterial(type).ability();
|
||||
}
|
||||
|
||||
@@ -6,102 +6,92 @@ import net.minecraft.item.Item;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Shovel extends HarvestTool
|
||||
{
|
||||
public Shovel()
|
||||
{
|
||||
public class Shovel extends HarvestTool {
|
||||
public Shovel() {
|
||||
super(2);
|
||||
this.setUnlocalizedName("InfiTool.Shovel");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
protected String getHarvestType() {
|
||||
return "shovel";
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
|
||||
static Material[] materials = {
|
||||
Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay
|
||||
};
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.shovelHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
public int getPartAmount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
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 "";
|
||||
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 ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_shovel_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
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