Little clean and format change

This commit is contained in:
Gig 2015-05-17 22:58:53 +01:00
parent ce4312a578
commit 20a9cabf93
9 changed files with 126 additions and 263 deletions

View file

@ -30,59 +30,47 @@ public class ItemGravityChest extends ItemArmor implements IElectricItem,
public double transferLimit = 1000; public double transferLimit = 1000;
public int energyPerDamage = 100; public int energyPerDamage = 100;
public ItemGravityChest(ArmorMaterial material, int par3, int par4) public ItemGravityChest(ArmorMaterial material, int par3, int par4){
{
super(material, par3, par4); super(material, par3, par4);
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setUnlocalizedName("techreborn.gravitychestplate"); setUnlocalizedName("techreborn.gravitychestplate");
setMaxStackSize(1); setMaxStackSize(1);
setMaxDamage(120); setMaxDamage(120);
// isDamageable();
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister){
{ this.itemIcon = iconRegister.registerIcon("techreborn:" + "items/gravitychestplate");
this.itemIcon = iconRegister.registerIcon("techreborn:"
+ "items/gravitychestplate");
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){
String type)
{
return "techreborn:" + "textures/models/gravitychestplate.png"; return "techreborn:" + "textures/models/gravitychestplate.png";
} }
@SuppressWarnings( @SuppressWarnings(
{ "rawtypes", "unchecked" }) { "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
List itemList)
{
ItemStack itemStack = new ItemStack(this, 1); ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) if (getChargedItem(itemStack) == this){
{
ItemStack charged = new ItemStack(this, 1); ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
false); false);
itemList.add(charged); itemList.add(charged);
} }
if (getEmptyItem(itemStack) == this) if (getEmptyItem(itemStack) == this){
{
itemList.add(new ItemStack(this, 1, getMaxDamage())); itemList.add(new ItemStack(this, 1, getMaxDamage()));
} }
} }
@Override @Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) public void onArmorTick(World world, EntityPlayer player, ItemStack stack){
{
if (world.isRemote) if (world.isRemote)
; ;
if (ElectricItem.manager.canUse(stack, cost)) if (ElectricItem.manager.canUse(stack, cost)){
{
player.capabilities.allowFlying = true; player.capabilities.allowFlying = true;
if (player.fallDistance > 0.0F) if (player.fallDistance > 0.0F)
@ -101,56 +89,45 @@ public class ItemGravityChest extends ItemArmor implements IElectricItem,
} }
@Override @Override
public boolean canProvideEnergy(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack){
{
return true; return true;
} }
@Override @Override
public Item getChargedItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public double getMaxCharge(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack){
{
return maxCharge; return maxCharge;
} }
@Override @Override
public int getTier(ItemStack itemStack) public int getTier(ItemStack itemStack){
{
return tier; return tier;
} }
@Override @Override
public double getTransferLimit(ItemStack itemStack) public double getTransferLimit(ItemStack itemStack){
{
return transferLimit; return transferLimit;
} }
public int getEnergyPerDamage() public int getEnergyPerDamage(){
{
return energyPerDamage; return energyPerDamage;
} }
@Override @Override
public ArmorProperties getProperties(EntityLivingBase player, public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot){
ItemStack armor, DamageSource source, double damage, int slot) if (source.isUnblockable()){
{
if (source.isUnblockable())
{
return new net.minecraftforge.common.ISpecialArmor.ArmorProperties( return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(
0, 0.0D, 3); 0, 0.0D, 3);
} else } else {
{
double absorptionRatio = getBaseAbsorptionRatio() double absorptionRatio = getBaseAbsorptionRatio()
* getDamageAbsorptionRatio(); * getDamageAbsorptionRatio();
int energyPerDamage = getEnergyPerDamage(); int energyPerDamage = getEnergyPerDamage();
@ -163,33 +140,25 @@ public class ItemGravityChest extends ItemArmor implements IElectricItem,
} }
@Override @Override
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot){
{ if (ElectricItem.manager.getCharge(armor) >= getEnergyPerDamage()){
if (ElectricItem.manager.getCharge(armor) >= getEnergyPerDamage())
{
return (int) Math.round(20D * getBaseAbsorptionRatio() return (int) Math.round(20D * getBaseAbsorptionRatio()
* getDamageAbsorptionRatio()); * getDamageAbsorptionRatio());
} else } else{
{
return 0; return 0;
} }
} }
@Override @Override
public void damageArmor(EntityLivingBase entity, ItemStack stack, public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot){
DamageSource source, int damage, int slot) ElectricItem.manager.discharge(stack, damage * getEnergyPerDamage(), 0x7fffffff, true, false, false);
{
ElectricItem.manager.discharge(stack, damage * getEnergyPerDamage(),
0x7fffffff, true, false, false);
} }
public double getDamageAbsorptionRatio() public double getDamageAbsorptionRatio(){
{
return 1.1000000000000001D; return 1.1000000000000001D;
} }
private double getBaseAbsorptionRatio() private double getBaseAbsorptionRatio(){
{
return 0.14999999999999999D; return 0.14999999999999999D;
} }

View file

@ -22,8 +22,7 @@ public class ItemLapotronPack extends ItemArmor implements IElectricItem {
public static final int tier = ConfigTechReborn.LapotronPackTier; public static final int tier = ConfigTechReborn.LapotronPackTier;
public double transferLimit = 100000; public double transferLimit = 100000;
public ItemLapotronPack(ArmorMaterial armormaterial, int par2, int par3) public ItemLapotronPack(ArmorMaterial armormaterial, int par2, int par3){
{
super(armormaterial, par2, par3); super(armormaterial, par2, par3);
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setUnlocalizedName("techreborn.lapotronpack"); setUnlocalizedName("techreborn.lapotronpack");
@ -32,73 +31,58 @@ public class ItemLapotronPack extends ItemArmor implements IElectricItem {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister){
{ this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/lapotronicEnergyOrb");
this.itemIcon = iconRegister.registerIcon("techreborn:"
+ "tool/lapotronicEnergyOrb");
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, public String getArmorTexture(ItemStack stack, Entity entity, int slot,String type){
String type)
{
return "techreborn:" + "textures/models/lapotronpack.png"; return "techreborn:" + "textures/models/lapotronpack.png";
} }
@SuppressWarnings( @SuppressWarnings(
{ "rawtypes", "unchecked" }) { "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
List itemList)
{
ItemStack itemStack = new ItemStack(this, 1); ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) if (getChargedItem(itemStack) == this){
{
ItemStack charged = new ItemStack(this, 1); ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
false);
itemList.add(charged); itemList.add(charged);
} }
if (getEmptyItem(itemStack) == this) if (getEmptyItem(itemStack) == this){
{
itemList.add(new ItemStack(this, 1, getMaxDamage())); itemList.add(new ItemStack(this, 1, getMaxDamage()));
} }
} }
@Override @Override
public boolean canProvideEnergy(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack){
{
return true; return true;
} }
@Override @Override
public Item getChargedItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public double getMaxCharge(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack){
{
return maxCharge; return maxCharge;
} }
@Override @Override
public int getTier(ItemStack itemStack) public int getTier(ItemStack itemStack){
{
return tier; return tier;
} }
@Override @Override
public double getTransferLimit(ItemStack itemStack) public double getTransferLimit(ItemStack itemStack){
{
return transferLimit; return transferLimit;
} }

View file

@ -22,8 +22,7 @@ public class ItemLithiumBatpack extends ItemArmor implements IElectricItem {
public static final int tier = ConfigTechReborn.LithiumBatpackTier; public static final int tier = ConfigTechReborn.LithiumBatpackTier;
public double transferLimit = 10000; public double transferLimit = 10000;
public ItemLithiumBatpack(ArmorMaterial armorMaterial, int par3, int par4) public ItemLithiumBatpack(ArmorMaterial armorMaterial, int par3, int par4){
{
super(armorMaterial, par3, par4); super(armorMaterial, par3, par4);
setMaxStackSize(1); setMaxStackSize(1);
setUnlocalizedName("techreborn.lithiumbatpack"); setUnlocalizedName("techreborn.lithiumbatpack");
@ -32,73 +31,59 @@ public class ItemLithiumBatpack extends ItemArmor implements IElectricItem {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister){
{ this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/lithiumBatpack");
this.itemIcon = iconRegister.registerIcon("techreborn:"
+ "tool/lithiumBatpack");
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){
String type)
{
return "techreborn:" + "textures/models/lithiumbatpack.png"; return "techreborn:" + "textures/models/lithiumbatpack.png";
} }
@SuppressWarnings( @SuppressWarnings(
{ "rawtypes", "unchecked" }) { "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
List itemList)
{
ItemStack itemStack = new ItemStack(this, 1); ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) if (getChargedItem(itemStack) == this){
{
ItemStack charged = new ItemStack(this, 1); ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
false); false);
itemList.add(charged); itemList.add(charged);
} }
if (getEmptyItem(itemStack) == this) if (getEmptyItem(itemStack) == this){
{
itemList.add(new ItemStack(this, 1, getMaxDamage())); itemList.add(new ItemStack(this, 1, getMaxDamage()));
} }
} }
@Override @Override
public boolean canProvideEnergy(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack){
{
return true; return true;
} }
@Override @Override
public Item getChargedItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public double getMaxCharge(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack){
{
return maxCharge; return maxCharge;
} }
@Override @Override
public int getTier(ItemStack itemStack) public int getTier(ItemStack itemStack){
{
return tier; return tier;
} }
@Override @Override
public double getTransferLimit(ItemStack itemStack) public double getTransferLimit(ItemStack itemStack){
{
return transferLimit; return transferLimit;
} }

View file

@ -28,8 +28,7 @@ public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem {
public static final int tier = ConfigTechReborn.AdvancedDrillTier; public static final int tier = ConfigTechReborn.AdvancedDrillTier;
public double transferLimit = 100; public double transferLimit = 100;
public ItemAdvancedDrill() public ItemAdvancedDrill(){
{
super(ToolMaterial.EMERALD); super(ToolMaterial.EMERALD);
efficiencyOnProperMaterial = 20F; efficiencyOnProperMaterial = 20F;
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
@ -40,8 +39,7 @@ public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister){
{
this.itemIcon = iconRegister.registerIcon("techreborn:" this.itemIcon = iconRegister.registerIcon("techreborn:"
+ "tool/advancedDrill"); + "tool/advancedDrill");
} }
@ -49,111 +47,86 @@ public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem {
@SuppressWarnings( @SuppressWarnings(
{ "rawtypes", "unchecked" }) { "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
List itemList)
{
ItemStack itemStack = new ItemStack(this, 1); ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) if (getChargedItem(itemStack) == this){
{
ItemStack charged = new ItemStack(this, 1); ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
false);
itemList.add(charged); itemList.add(charged);
} }
if (getEmptyItem(itemStack) == this) if (getEmptyItem(itemStack) == this){
{
itemList.add(new ItemStack(this, 1, getMaxDamage())); itemList.add(new ItemStack(this, 1, getMaxDamage()));
} }
} }
@Override @Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, public boolean onBlockDestroyed(ItemStack stack, World world, Block block,
int par4, int par5, int par6, EntityLivingBase entityLiving) int par4, int par5, int par6, EntityLivingBase entityLiving){
{
ElectricItem.manager.use(stack, cost, entityLiving); ElectricItem.manager.use(stack, cost, entityLiving);
return true; return true;
} }
@Override @Override
public boolean canHarvestBlock(Block block, ItemStack stack) public boolean canHarvestBlock(Block block, ItemStack stack){
{ return Items.diamond_pickaxe.canHarvestBlock(block, stack)|| Items.diamond_shovel.canHarvestBlock(block, stack);
return Items.diamond_pickaxe.canHarvestBlock(block, stack)
|| Items.diamond_shovel.canHarvestBlock(block, stack);
} }
@Override @Override
public float getDigSpeed(ItemStack stack, Block block, int meta) public float getDigSpeed(ItemStack stack, Block block, int meta){
{ if (!ElectricItem.manager.canUse(stack, cost)){
if (!ElectricItem.manager.canUse(stack, cost))
{
return 4.0F; return 4.0F;
} }
if (Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F if (Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F){
|| Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F)
{
return efficiencyOnProperMaterial; return efficiencyOnProperMaterial;
} else } else {
{
return super.getDigSpeed(stack, block, meta); return super.getDigSpeed(stack, block, meta);
} }
} }
@Override @Override
public boolean hitEntity(ItemStack itemstack, public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1){
EntityLivingBase entityliving, EntityLivingBase entityliving1)
{
return true; return true;
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, public boolean onItemUse(ItemStack stack, EntityPlayer player, World world,
int x, int y, int z, int side, float xOffset, float yOffset, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset){
float zOffset) return TorchHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset);
{
return TorchHelper.placeTorch(stack, player, world, x, y, z, side,
xOffset, yOffset, zOffset);
} }
@Override @Override
public boolean isRepairable() public boolean isRepairable(){
{
return false; return false;
} }
@Override @Override
public boolean canProvideEnergy(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack){
{
return false; return false;
} }
@Override @Override
public double getMaxCharge(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack){
{
return maxCharge; return maxCharge;
} }
@Override @Override
public int getTier(ItemStack itemStack) public int getTier(ItemStack itemStack){
{
return tier; return tier;
} }
@Override @Override
public double getTransferLimit(ItemStack itemStack) public double getTransferLimit(ItemStack itemStack){
{
return transferLimit; return transferLimit;
} }
@Override @Override
public Item getChargedItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack){
{
return this; return this;
} }
} }

View file

@ -13,8 +13,7 @@ import net.minecraft.item.ItemBucket;
public class ItemFluidbucket extends ItemBucket{ public class ItemFluidbucket extends ItemBucket{
private String iconName; private String iconName;
public ItemFluidbucket(Block block) public ItemFluidbucket(Block block){
{
super(block); super(block);
setContainerItem(Items.bucket); setContainerItem(Items.bucket);
setCreativeTab(TechRebornCreativeTabMisc.instance); setCreativeTab(TechRebornCreativeTabMisc.instance);
@ -22,16 +21,14 @@ public class ItemFluidbucket extends ItemBucket{
} }
@Override @Override
public Item setUnlocalizedName(String par1Str) public Item setUnlocalizedName(String par1Str) {
{
iconName = par1Str; iconName = par1Str;
return super.setUnlocalizedName(par1Str); return super.setUnlocalizedName(par1Str);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) public void registerIcons(IIconRegister par1IconRegister) {
{
this.itemIcon = par1IconRegister.registerIcon("techreborn:bucket/" + iconName); this.itemIcon = par1IconRegister.registerIcon("techreborn:bucket/" + iconName);
} }

View file

@ -31,9 +31,9 @@ public class ItemHammer extends ItemTR{
public boolean getShareTag(){ public boolean getShareTag(){
return true; return true;
} }
@Override @Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) { public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) {
return false; return false;
} }

View file

@ -29,8 +29,7 @@ public class ItemOmniTool extends ItemPickaxe implements IElectricItem {
public int cost = 100; public int cost = 100;
public int hitCost = 125; public int hitCost = 125;
public ItemOmniTool(ToolMaterial toolMaterial) public ItemOmniTool(ToolMaterial toolMaterial){
{
super(toolMaterial); super(toolMaterial);
efficiencyOnProperMaterial = 13F; efficiencyOnProperMaterial = 13F;
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
@ -41,43 +40,38 @@ public class ItemOmniTool extends ItemPickaxe implements IElectricItem {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister){
{ this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/omnitool");
this.itemIcon = iconRegister.registerIcon("techreborn:"
+ "tool/omnitool");
} }
@SuppressWarnings( @SuppressWarnings(
{ "rawtypes", "unchecked" }) { "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
List itemList)
{
ItemStack itemStack = new ItemStack(this, 1); ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this)
{ if (getChargedItem(itemStack) == this){
ItemStack charged = new ItemStack(this, 1); ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
false); false);
itemList.add(charged); itemList.add(charged);
} }
if (getEmptyItem(itemStack) == this) if (getEmptyItem(itemStack) == this){
{
itemList.add(new ItemStack(this, 1, getMaxDamage())); itemList.add(new ItemStack(this, 1, getMaxDamage()));
} }
} }
@Override @Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, public boolean onBlockDestroyed(ItemStack stack, World world, Block block,
int par4, int par5, int par6, EntityLivingBase entityLiving) int par4, int par5, int par6, EntityLivingBase entityLiving){
{
ElectricItem.manager.use(stack, cost, entityLiving); ElectricItem.manager.use(stack, cost, entityLiving);
return true; return true;
} }
@Override @Override
public boolean canHarvestBlock(Block block, ItemStack stack) public boolean canHarvestBlock(Block block, ItemStack stack){
{
return Items.diamond_axe.canHarvestBlock(block, stack) return Items.diamond_axe.canHarvestBlock(block, stack)
|| Items.diamond_sword.canHarvestBlock(block, stack) || Items.diamond_sword.canHarvestBlock(block, stack)
|| Items.diamond_pickaxe.canHarvestBlock(block, stack) || Items.diamond_pickaxe.canHarvestBlock(block, stack)
@ -86,10 +80,8 @@ public class ItemOmniTool extends ItemPickaxe implements IElectricItem {
} }
@Override @Override
public float getDigSpeed(ItemStack stack, Block block, int meta) public float getDigSpeed(ItemStack stack, Block block, int meta){
{ if (!ElectricItem.manager.canUse(stack, cost)){
if (!ElectricItem.manager.canUse(stack, cost))
{
return 5.0F; return 5.0F;
} }
@ -97,76 +89,59 @@ public class ItemOmniTool extends ItemPickaxe implements IElectricItem {
|| Items.wooden_sword.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_sword.getDigSpeed(stack, block, meta) > 1.0F
|| Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F
|| Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F
|| Items.shears.getDigSpeed(stack, block, meta) > 1.0F) || Items.shears.getDigSpeed(stack, block, meta) > 1.0F){
{
return efficiencyOnProperMaterial; return efficiencyOnProperMaterial;
} else } else{
{
return super.getDigSpeed(stack, block, meta); return super.getDigSpeed(stack, block, meta);
} }
} }
@Override @Override
public boolean hitEntity(ItemStack itemstack, public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker){
EntityLivingBase entityliving, EntityLivingBase attacker) if (ElectricItem.manager.use(itemstack, hitCost, attacker)){
{ entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 8F);
if (ElectricItem.manager.use(itemstack, hitCost, attacker))
{
entityliving
.attackEntityFrom(DamageSource
.causePlayerDamage((EntityPlayer) attacker), 8F);
} }
return false; return false;
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, public boolean onItemUse(ItemStack stack, EntityPlayer player, World world,
int x, int y, int z, int side, float xOffset, float yOffset, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset){
float zOffset) return TorchHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset);
{
return TorchHelper.placeTorch(stack, player, world, x, y, z, side,
xOffset, yOffset, zOffset);
} }
@Override @Override
public boolean isRepairable() public boolean isRepairable(){
{
return false; return false;
} }
@Override @Override
public Item getChargedItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public boolean canProvideEnergy(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack){
{
return false; return false;
} }
@Override @Override
public double getMaxCharge(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack){
{
return maxCharge; return maxCharge;
} }
@Override @Override
public int getTier(ItemStack itemStack) public int getTier(ItemStack itemStack){
{
return 2; return 2;
} }
@Override @Override
public double getTransferLimit(ItemStack itemStack) public double getTransferLimit(ItemStack itemStack){
{
return 200; return 200;
} }

View file

@ -26,8 +26,7 @@ public class ItemRockCutter extends ItemPickaxe implements IElectricItem {
public int cost = 500; public int cost = 500;
public static final int tier = ConfigTechReborn.RockCutterTier; public static final int tier = ConfigTechReborn.RockCutterTier;
public ItemRockCutter(ToolMaterial toolMaterial) public ItemRockCutter(ToolMaterial toolMaterial){
{
super(toolMaterial); super(toolMaterial);
setUnlocalizedName("techreborn.rockcutter"); setUnlocalizedName("techreborn.rockcutter");
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
@ -37,83 +36,68 @@ public class ItemRockCutter extends ItemPickaxe implements IElectricItem {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister){
{ this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/rockcutter");
this.itemIcon = iconRegister.registerIcon("techreborn:"
+ "tool/rockcutter");
} }
@SuppressWarnings( @SuppressWarnings(
{ "rawtypes", "unchecked" }) { "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
List itemList)
{
ItemStack itemStack = new ItemStack(this, 1); ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) if (getChargedItem(itemStack) == this){
{
ItemStack charged = new ItemStack(this, 1); ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
false); false);
itemList.add(charged); itemList.add(charged);
} }
if (getEmptyItem(itemStack) == this)
{ if (getEmptyItem(itemStack) == this){
itemList.add(new ItemStack(this, 1, getMaxDamage())); itemList.add(new ItemStack(this, 1, getMaxDamage()));
} }
} }
@Override @Override
public boolean canHarvestBlock(Block block, ItemStack stack) public boolean canHarvestBlock(Block block, ItemStack stack){
{
return Items.diamond_pickaxe.canHarvestBlock(block, stack); return Items.diamond_pickaxe.canHarvestBlock(block, stack);
} }
@Override @Override
public boolean isRepairable() public boolean isRepairable(){
{
return false; return false;
} }
public void onCreated(ItemStack par1ItemStack, World par2World, public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
EntityPlayer par3EntityPlayer)
{
par1ItemStack.addEnchantment(Enchantment.silkTouch, 1); par1ItemStack.addEnchantment(Enchantment.silkTouch, 1);
} }
@Override @Override
public boolean canProvideEnergy(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack){
{
return false; return false;
} }
@Override @Override
public Item getChargedItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack){
{
return this; return this;
} }
@Override @Override
public double getMaxCharge(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack){
{
return maxCharge; return maxCharge;
} }
@Override @Override
public int getTier(ItemStack itemStack) public int getTier(ItemStack itemStack){
{
return tier; return tier;
} }
@Override @Override
public double getTransferLimit(ItemStack itemStack) public double getTransferLimit(ItemStack itemStack){
{
return 300; return 300;
} }

View file

@ -11,23 +11,19 @@ import techreborn.client.TechRebornCreativeTab;
public class ItemTechPda extends Item { public class ItemTechPda extends Item {
public ItemTechPda() public ItemTechPda(){
{
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setUnlocalizedName("techreborn.pda"); setUnlocalizedName("techreborn.pda");
setMaxStackSize(1); setMaxStackSize(1);
} }
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister){
{
itemIcon = iconRegister.registerIcon("techreborn:" + "tool/pda"); itemIcon = iconRegister.registerIcon("techreborn:" + "tool/pda");
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player){
EntityPlayer player)
{
player.openGui(Core.INSTANCE, GuiHandler.pdaID, world, player.openGui(Core.INSTANCE, GuiHandler.pdaID, world,
(int) player.posX, (int) player.posY, (int) player.posY); (int) player.posX, (int) player.posY, (int) player.posY);
return itemStack; return itemStack;