mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 20:52:26 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
83698cb73c
commit
84c2239244
561 files changed
+8872
-9300
No files matched your search
@@ -1,19 +1,21 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.CustomMaterial;
|
||||
import tconstruct.library.tools.FletchingMaterial;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
|
||||
@Deprecated
|
||||
public class Arrow extends ToolCore {
|
||||
@@ -85,7 +87,7 @@ public class Arrow extends ToolCore {
|
||||
|
||||
@Override
|
||||
public String[] getTraits() {
|
||||
return new String[] {"ammo"};
|
||||
return new String[] { "ammo" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,17 +154,8 @@ 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;
|
||||
}
|
||||
|
||||
@@ -212,9 +205,13 @@ public class Arrow extends ToolCore {
|
||||
}
|
||||
}
|
||||
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"));
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,18 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.*;
|
||||
import tconstruct.tools.logic.EquipLogic;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
|
||||
public class BattleSign extends Weapon {
|
||||
|
||||
public BattleSign() {
|
||||
super(1);
|
||||
this.setUnlocalizedName("InfiTool.Battlesign");
|
||||
@@ -68,17 +70,8 @@ public class BattleSign 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) {
|
||||
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()) {
|
||||
|
||||
@@ -1,10 +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;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
@@ -19,15 +17,19 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
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")
|
||||
})
|
||||
@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");
|
||||
@@ -44,14 +46,14 @@ public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(
|
||||
ItemStack itemstack, World world, Block b, int x, int y, int z, EntityLivingBase player) {
|
||||
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() {
|
||||
@@ -128,23 +130,14 @@ public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon {
|
||||
|
||||
@Override
|
||||
public String[] getTraits() {
|
||||
return new String[] {"weapon", "harvest", "melee", "slicing"};
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -239,8 +232,8 @@ public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon {
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@@ -267,9 +260,8 @@ public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.enchantment.*;
|
||||
import net.minecraft.entity.player.*;
|
||||
@@ -12,6 +13,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.*;
|
||||
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
@@ -20,6 +22,7 @@ import tconstruct.util.config.PHConstruct;
|
||||
|
||||
@Deprecated
|
||||
public abstract class BowBase extends ToolCore {
|
||||
|
||||
public BowBase() {
|
||||
super(0);
|
||||
}
|
||||
@@ -106,7 +109,10 @@ public abstract class BowBase extends ToolCore {
|
||||
AbilityHelper.damageTool(stack, 1, player, false);
|
||||
}
|
||||
world.playSoundAtEntity(
|
||||
player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + speedBase * 0.5F);
|
||||
player,
|
||||
"random.bow",
|
||||
1.0F,
|
||||
1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + speedBase * 0.5F);
|
||||
|
||||
if (creative) {
|
||||
arrowEntity.canBePickedUp = 2;
|
||||
@@ -148,8 +154,7 @@ public abstract class BowBase extends ToolCore {
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items
|
||||
* is being used
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
@@ -157,8 +162,7 @@ public abstract class BowBase extends ToolCore {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is
|
||||
* pressed. Args: itemStack, world, entityPlayer
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer player) {
|
||||
@@ -171,8 +175,7 @@ public abstract class BowBase extends ToolCore {
|
||||
return event.result;
|
||||
}
|
||||
|
||||
if (player.capabilities.isCreativeMode
|
||||
|| player.inventory.hasItemStack(new ItemStack(Items.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));
|
||||
}
|
||||
@@ -188,34 +191,34 @@ public abstract class BowBase extends ToolCore {
|
||||
super.registerIcons(iconRegister);
|
||||
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();
|
||||
@@ -233,8 +236,7 @@ public abstract class BowBase extends ToolCore {
|
||||
accessoryIcons1.clear();
|
||||
extraIcons1.clear();
|
||||
effectIcons1.clear();
|
||||
Iterator<Map.Entry<Integer, String>> iterOne =
|
||||
headStrings.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> iterOne = headStrings.entrySet().iterator();
|
||||
while (iterOne.hasNext()) {
|
||||
Map.Entry<Integer, String> pairs = iterOne.next();
|
||||
headIcons1.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_1"));
|
||||
@@ -273,8 +275,7 @@ public abstract class BowBase extends ToolCore {
|
||||
accessoryIcons2.clear();
|
||||
extraIcons2.clear();
|
||||
effectIcons2.clear();
|
||||
Iterator<Map.Entry<Integer, String>> iterTwo =
|
||||
headStrings.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> iterTwo = headStrings.entrySet().iterator();
|
||||
while (iterTwo.hasNext()) {
|
||||
Map.Entry<Integer, String> pairs = iterTwo.next();
|
||||
headIcons2.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_2"));
|
||||
@@ -313,8 +314,7 @@ public abstract class BowBase extends ToolCore {
|
||||
accessoryIcons3.clear();
|
||||
extraIcons3.clear();
|
||||
effectIcons3.clear();
|
||||
Iterator<Map.Entry<Integer, String>> iterThree =
|
||||
headStrings.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> iterThree = headStrings.entrySet().iterator();
|
||||
while (iterThree.hasNext()) {
|
||||
Map.Entry<Integer, String> pairs = iterThree.next();
|
||||
headIcons3.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_3"));
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Broadsword extends Weapon {
|
||||
|
||||
public Broadsword() {
|
||||
super(4);
|
||||
this.setUnlocalizedName("InfiTool.Broadsword");
|
||||
@@ -53,13 +55,9 @@ public class Broadsword extends Weapon {
|
||||
|
||||
/*
|
||||
* @Override
|
||||
*
|
||||
* @SideOnly(Side.CLIENT) public void onUpdate (ItemStack stack, World
|
||||
* world, Entity entity, int par4, boolean par5) { super.onUpdate(stack,
|
||||
* world, entity, par4, par5); if (entity instanceof EntityPlayerSP) {
|
||||
* EntityPlayerSP player = (EntityPlayerSP) entity; if (player.itemInUse !=
|
||||
* null && player.itemInUse.getItem() == this) {
|
||||
* player.movementInput.moveForward *= 5.0F; player.movementInput.moveStrafe
|
||||
* *= 5.0F; } } }
|
||||
* @SideOnly(Side.CLIENT) public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
* { super.onUpdate(stack, world, entity, par4, par5); if (entity instanceof EntityPlayerSP) { EntityPlayerSP player
|
||||
* = (EntityPlayerSP) entity; if (player.itemInUse != null && player.itemInUse.getItem() == this) {
|
||||
* player.movementInput.moveForward *= 5.0F; player.movementInput.moveStrafe *= 5.0F; } } }
|
||||
*/
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -10,12 +9,15 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.crafting.Detailing.DetailInput;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
|
||||
public class Chisel extends ToolCore {
|
||||
|
||||
public Chisel() {
|
||||
super(0);
|
||||
this.setUnlocalizedName("InfiTool.Chisel");
|
||||
@@ -49,17 +51,8 @@ public class Chisel 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;
|
||||
}
|
||||
|
||||
@@ -188,6 +181,6 @@ public class Chisel extends ToolCore {
|
||||
|
||||
@Override
|
||||
public String[] getTraits() {
|
||||
return new String[] {"utility"};
|
||||
return new String[] { "utility" };
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,12 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.potion.*;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Cleaver extends Weapon {
|
||||
|
||||
public Cleaver() {
|
||||
super(5);
|
||||
this.setUnlocalizedName("InfiTool.Cleaver");
|
||||
@@ -99,10 +101,8 @@ public class Cleaver extends Weapon {
|
||||
entity.hurtResistantTime += 7;
|
||||
|
||||
/*
|
||||
* if (entity instanceof EntityLiving) { EntityLiving living =
|
||||
* (EntityLiving) entity; if (living.getHealth() <= 0) {
|
||||
*
|
||||
* } }
|
||||
* if (entity instanceof EntityLiving) { EntityLiving living = (EntityLiving) entity; if (living.getHealth()
|
||||
* <= 0) { } }
|
||||
*/
|
||||
// if (entity.getHealth() <= 0)
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class Cleaver extends Weapon {
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public boolean onEntitySwing (EntityLiving entity, ItemStack
|
||||
* stack) { entity.swingProgressInt /= 2; return false; }
|
||||
* @Override public boolean onEntitySwing (EntityLiving entity, ItemStack stack) { entity.swingProgressInt /= 2;
|
||||
* return false; }
|
||||
*/
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Cutlass extends Weapon {
|
||||
|
||||
public Cutlass() {
|
||||
super(4);
|
||||
this.setUnlocalizedName("InfiTool.Cutlass");
|
||||
|
||||
@@ -3,11 +3,13 @@ package tconstruct.items.tools;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.tools.entity.DaggerEntity;
|
||||
|
||||
public class Dagger extends Weapon {
|
||||
|
||||
public Dagger() {
|
||||
super(1);
|
||||
this.setUnlocalizedName("InfiTool.Dagger");
|
||||
@@ -40,7 +42,7 @@ public class Dagger extends Weapon {
|
||||
|
||||
@Override
|
||||
public String[] getTraits() {
|
||||
return new String[] {"weapon", "melee", "throwing"};
|
||||
return new String[] { "weapon", "melee", "throwing" };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,10 +2,12 @@ package tconstruct.items.tools;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.*;
|
||||
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Excavator extends AOEHarvestTool {
|
||||
|
||||
public Excavator() {
|
||||
super(2, 1, 0);
|
||||
this.setUnlocalizedName("InfiTool.Excavator");
|
||||
@@ -21,9 +23,8 @@ public class Excavator extends AOEHarvestTool {
|
||||
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() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -9,12 +10,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.*;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.tools.logic.EquipLogic;
|
||||
|
||||
public class FryingPan extends Weapon {
|
||||
|
||||
public FryingPan() {
|
||||
super(2);
|
||||
this.setUnlocalizedName("InfiTool.FryPan");
|
||||
@@ -67,7 +70,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);
|
||||
@@ -77,17 +80,8 @@ 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) {
|
||||
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()) {
|
||||
@@ -121,7 +115,12 @@ public class FryingPan extends Weapon {
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Hammer extends AOEHarvestTool {
|
||||
|
||||
public Hammer() {
|
||||
super(2, 1, 0);
|
||||
this.setUnlocalizedName("InfiTool.Hammer");
|
||||
@@ -41,9 +44,8 @@ public class Hammer extends AOEHarvestTool {
|
||||
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() {
|
||||
@@ -150,6 +152,6 @@ public class Hammer extends AOEHarvestTool {
|
||||
|
||||
@Override
|
||||
public String[] getTraits() {
|
||||
return new String[] {"weapon", "harvest", "melee", "bludgeoning"};
|
||||
return new String[] { "weapon", "harvest", "melee", "bludgeoning" };
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,12 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Hatchet extends HarvestTool {
|
||||
|
||||
public Hatchet() {
|
||||
super(3);
|
||||
this.setUnlocalizedName("InfiTool.Axe");
|
||||
@@ -25,16 +27,15 @@ public class Hatchet extends HarvestTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(
|
||||
ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
|
||||
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() {
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
|
||||
public class Longsword extends Weapon {
|
||||
|
||||
public Longsword() {
|
||||
super(4);
|
||||
this.setUnlocalizedName("InfiTool.Longsword");
|
||||
@@ -37,21 +39,13 @@ public class Longsword extends Weapon {
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int useCount) {
|
||||
/*
|
||||
* if (player.onGround) { int time = this.getMaxItemUseDuration(stack) -
|
||||
* useCount; if (time > 5) { player.addExhaustion(0.2F);
|
||||
* player.setSprinting(true);
|
||||
*
|
||||
* float speed = 0.05F * time; if (speed > 0.925f) speed = 0.925f;
|
||||
*
|
||||
* float increase = (float) (0.02 * time + 0.2); if (increase > 0.56f)
|
||||
* increase = 0.56f; player.motionY += increase + speed/3;
|
||||
*
|
||||
* player.motionX = (double) (-MathHelper.sin(player.rotationYaw /
|
||||
* 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch /
|
||||
* 180.0F * (float) Math.PI) * speed); player.motionZ = (double)
|
||||
* (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI) *
|
||||
* MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) *
|
||||
* speed); } }
|
||||
* if (player.onGround) { int time = this.getMaxItemUseDuration(stack) - useCount; if (time > 5) {
|
||||
* player.addExhaustion(0.2F); player.setSprinting(true); float speed = 0.05F * time; if (speed > 0.925f) speed
|
||||
* = 0.925f; float increase = (float) (0.02 * time + 0.2); if (increase > 0.56f) increase = 0.56f;
|
||||
* player.motionY += increase + speed/3; player.motionX = (double) (-MathHelper.sin(player.rotationYaw / 180.0F
|
||||
* * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * speed); player.motionZ
|
||||
* = (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI) *
|
||||
* MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * speed); } }
|
||||
*/
|
||||
int time = this.getMaxItemUseDuration(stack) - useCount;
|
||||
if (time > 5) {
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
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 gnu.trove.set.hash.THashSet;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import mantle.player.PlayerUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -18,11 +14,21 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.*;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
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 gnu.trove.set.hash.THashSet;
|
||||
|
||||
public class LumberAxe extends AOEHarvestTool {
|
||||
|
||||
public LumberAxe() {
|
||||
super(0, 1, 1);
|
||||
this.setUnlocalizedName("InfiTool.LumberAxe");
|
||||
@@ -49,25 +55,22 @@ public class LumberAxe extends AOEHarvestTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(
|
||||
ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
|
||||
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 */
|
||||
|
||||
/*
|
||||
* @Override public void onUpdate (ItemStack stack, World world, Entity
|
||||
* entity, int par4, boolean par5) { super.onUpdate(stack, world, entity,
|
||||
* par4, par5); if (entity instanceof EntityPlayer) { EntityPlayer player =
|
||||
* (EntityPlayer) entity; ItemStack equipped =
|
||||
* player.getCurrentEquippedItem(); if (equipped == stack) {
|
||||
* player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1)); }
|
||||
* } }
|
||||
* @Override public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5) {
|
||||
* super.onUpdate(stack, world, entity, par4, par5); if (entity instanceof EntityPlayer) { EntityPlayer player =
|
||||
* (EntityPlayer) entity; ItemStack equipped = player.getCurrentEquippedItem(); if (equipped == stack) {
|
||||
* player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1)); } } }
|
||||
*/
|
||||
|
||||
@Override
|
||||
@@ -89,18 +92,17 @@ public class LumberAxe extends AOEHarvestTool {
|
||||
|
||||
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(this, stack, new ChunkPosition(x, y, z), player, 128);
|
||||
try {
|
||||
FMLCommonHandler.instance().bus().register(chopper);
|
||||
} catch (LinkageError l) {
|
||||
PlayerUtils.sendChatMessage(player, "Well, that's embarrassing, you missed!");
|
||||
FMLLog.warning("Unable to spawn TreeChopTask due to LinkageError");
|
||||
}
|
||||
// custom block breaking code, don't call vanilla code
|
||||
return true;
|
||||
if (wood.isWood(world, x, y, z) || wood.getMaterial() == Material.sponge) if (detectTree(world, x, y, z)) {
|
||||
TreeChopTask chopper = new TreeChopTask(this, stack, new ChunkPosition(x, y, z), player, 128);
|
||||
try {
|
||||
FMLCommonHandler.instance().bus().register(chopper);
|
||||
} catch (LinkageError l) {
|
||||
PlayerUtils.sendChatMessage(player, "Well, that's embarrassing, you missed!");
|
||||
FMLLog.warning("Unable to spawn TreeChopTask due to LinkageError");
|
||||
}
|
||||
// custom block breaking code, don't call vanilla code
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
@@ -142,8 +144,7 @@ public class LumberAxe extends AOEHarvestTool {
|
||||
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,
|
||||
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)) {
|
||||
@@ -170,8 +171,8 @@ 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) {
|
||||
public TreeChopTask(AOEHarvestTool tool, ItemStack stack, ChunkPosition start, EntityPlayer player,
|
||||
int blocksPerTick) {
|
||||
this.world = player.getEntityWorld();
|
||||
this.player = player;
|
||||
this.tool = tool;
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class Mattock extends DualHarvestTool {
|
||||
|
||||
public Mattock() {
|
||||
super(3);
|
||||
this.setUnlocalizedName("InfiTool.Mattock");
|
||||
@@ -36,8 +39,8 @@ public class Mattock extends DualHarvestTool {
|
||||
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() {
|
||||
@@ -83,17 +86,8 @@ public class Mattock extends DualHarvestTool {
|
||||
/* 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;
|
||||
|
||||
@@ -108,7 +102,7 @@ public class Mattock extends DualHarvestTool {
|
||||
}
|
||||
|
||||
private boolean allowCrafting(int head) {
|
||||
int[] nonMetals = {0, 1, 3, 4, 5, 6, 7, 8, 9, 17};
|
||||
int[] nonMetals = { 0, 1, 3, 4, 5, 6, 7, 8, 9, 17 };
|
||||
for (int nonMetal : nonMetals) {
|
||||
if (head == nonMetal) return false;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ package tconstruct.items.tools;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Pickaxe extends HarvestTool {
|
||||
|
||||
public Pickaxe() {
|
||||
super(1);
|
||||
this.setUnlocalizedName("InfiTool.Pickaxe");
|
||||
@@ -21,9 +23,8 @@ public class Pickaxe extends HarvestTool {
|
||||
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() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -11,13 +11,16 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.tools.entity.LaunchedPotion;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
|
||||
public class PotionLauncher extends Item {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
public static final String[] textureNames = new String[] {"potionlauncher"};
|
||||
public static final String[] textureNames = new String[] { "potionlauncher" };
|
||||
|
||||
public PotionLauncher() {
|
||||
super();
|
||||
@@ -75,14 +78,13 @@ public class PotionLauncher extends Item {
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items
|
||||
* is being used
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
if (stack != null
|
||||
&& stack.hasTagCompound()
|
||||
&& !stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Loaded")) return EnumAction.bow;
|
||||
if (stack != null && stack.hasTagCompound()
|
||||
&& !stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Loaded"))
|
||||
return EnumAction.bow;
|
||||
else return EnumAction.none;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,12 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Rapier extends Weapon {
|
||||
|
||||
public Rapier() {
|
||||
super(2);
|
||||
this.setUnlocalizedName("InfiTool.Rapier");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -18,11 +18,14 @@ import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
|
||||
import tconstruct.library.*;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class Scythe extends Weapon {
|
||||
|
||||
public Scythe() {
|
||||
super(4);
|
||||
this.setUnlocalizedName("InfiTool.Scythe");
|
||||
@@ -37,9 +40,8 @@ public class Scythe extends Weapon {
|
||||
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() {
|
||||
@@ -121,7 +123,7 @@ public class Scythe extends Weapon {
|
||||
|
||||
@Override
|
||||
public String[] getTraits() {
|
||||
return new String[] {"weapon", "melee", "harvest"};
|
||||
return new String[] { "weapon", "melee", "harvest" };
|
||||
}
|
||||
|
||||
/* Scythe Specific */
|
||||
@@ -149,53 +151,55 @@ public class Scythe extends Weapon {
|
||||
if (!cancelHarvest) {
|
||||
Block localBlock = world.getBlock(xPos, yPos, zPos);
|
||||
int localMeta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
float localHardness = localBlock == null
|
||||
? Float.MAX_VALUE
|
||||
float localHardness = localBlock == null ? Float.MAX_VALUE
|
||||
: localBlock.getBlockHardness(world, xPos, yPos, zPos);
|
||||
if (localBlock
|
||||
!= null) // && (block.blockMaterial == Material.leaves || block.isLeaves(world,
|
||||
if (localBlock != null) // && (block.blockMaterial == Material.leaves ||
|
||||
// block.isLeaves(world,
|
||||
// xPos, yPos, zPos)))
|
||||
{
|
||||
for (Material material : materials) {
|
||||
if (material == localBlock.getMaterial()) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
if (butter
|
||||
&& localBlock instanceof IShearable
|
||||
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));
|
||||
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) {
|
||||
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);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
if (!world.isRemote) 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);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
if (localHardness > 0f)
|
||||
onBlockDestroyed(
|
||||
stack, world, localBlock, xPos, yPos, zPos, player);
|
||||
if (localHardness > 0f) onBlockDestroyed(
|
||||
stack,
|
||||
world,
|
||||
localBlock,
|
||||
xPos,
|
||||
yPos,
|
||||
zPos,
|
||||
player);
|
||||
player.addStat(
|
||||
StatList.mineBlockStatArray[Block.getIdFromBlock(localBlock)],
|
||||
1);
|
||||
@@ -208,7 +212,11 @@ public class Scythe extends Weapon {
|
||||
localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
|
||||
if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos, true)) {
|
||||
localBlock.onBlockDestroyedByPlayer(
|
||||
world, xPos, yPos, zPos, localMeta);
|
||||
world,
|
||||
xPos,
|
||||
yPos,
|
||||
zPos,
|
||||
localMeta);
|
||||
localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
// Workaround for dropping experience
|
||||
if (!butter)
|
||||
@@ -219,26 +227,34 @@ public class Scythe extends Weapon {
|
||||
INetHandler handler = FMLClientHandler.instance()
|
||||
.getClientPlayHandler();
|
||||
if (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));
|
||||
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);
|
||||
if (localHardness > 0f) onBlockDestroyed(
|
||||
stack,
|
||||
world,
|
||||
localBlock,
|
||||
xPos,
|
||||
yPos,
|
||||
zPos,
|
||||
player);
|
||||
}
|
||||
} else {
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
@@ -258,13 +274,12 @@ public class Scythe extends Weapon {
|
||||
@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);
|
||||
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<Entity> list = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, box);
|
||||
for (Entity e : list) {
|
||||
AbilityHelper.onLeftClickEntity(stack, player, e, this);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -9,14 +9,17 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.BowstringMaterial;
|
||||
import tconstruct.library.tools.CustomMaterial;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
|
||||
@Deprecated
|
||||
public class Shortbow extends BowBase {
|
||||
|
||||
public Shortbow() {
|
||||
super();
|
||||
this.setUnlocalizedName("InfiTool.Shortbow");
|
||||
@@ -76,7 +79,7 @@ public class Shortbow extends BowBase {
|
||||
|
||||
@Override
|
||||
public String[] getTraits() {
|
||||
return new String[] {"weapon", "ranged", "bow"};
|
||||
return new String[] { "weapon", "ranged", "bow" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,8 +160,10 @@ public class Shortbow extends BowBase {
|
||||
}
|
||||
}
|
||||
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) {
|
||||
|
||||
@@ -2,10 +2,12 @@ package tconstruct.items.tools;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class Shovel extends HarvestTool {
|
||||
|
||||
public Shovel() {
|
||||
super(2);
|
||||
this.setUnlocalizedName("InfiTool.Shovel");
|
||||
@@ -21,9 +23,8 @@ public class Shovel extends HarvestTool {
|
||||
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() {
|
||||
@@ -72,25 +73,13 @@ public class Shovel extends HarvestTool {
|
||||
}
|
||||
|
||||
/*
|
||||
* @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; }
|
||||
* @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