Made chainsaws share code
This commit is contained in:
parent
4949dd0cf5
commit
74caaf6bd6
14 changed files with 95 additions and 500 deletions
|
@ -136,14 +136,14 @@ public class ModItems {
|
|||
treeTap = new ItemTreeTap();
|
||||
GameRegistry.registerItem(treeTap, "treetap");
|
||||
|
||||
ironDrill = PoweredItem.createItem(ItemDrill.class);
|
||||
ironDrill = PoweredItem.createItem(ItemIronDrill.class);
|
||||
GameRegistry.registerItem(ironDrill, "irondrill");
|
||||
diamondDrill = PoweredItem.createItem(ItemDiamondDrill.class);
|
||||
GameRegistry.registerItem(diamondDrill, "diamonddrill");
|
||||
advancedDrill = PoweredItem.createItem(ItemAdvancedDrill.class);
|
||||
GameRegistry.registerItem(advancedDrill, "advanceddrill");
|
||||
|
||||
ironChainsaw = PoweredItem.createItem(ItemChainsaw.class);
|
||||
ironChainsaw = PoweredItem.createItem(ItemIronChainsaw.class);
|
||||
GameRegistry.registerItem(ironChainsaw, "ironchainsaw");
|
||||
diamondChainsaw = PoweredItem.createItem(ItemDiamondChainsaw.class);
|
||||
GameRegistry.registerItem(diamondChainsaw, "diamondchainsaw");
|
||||
|
|
|
@ -1,50 +1,14 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemAdvancedChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public int maxCharge = ConfigTechReborn.AdvancedChainsawCharge;
|
||||
public int cost = 250;
|
||||
public static final int tier = ConfigTechReborn.AdvancedChainsawTier;
|
||||
public double transferLimit = 100;
|
||||
public class ItemAdvancedChainsaw extends ItemChainsaw {
|
||||
|
||||
public ItemAdvancedChainsaw() {
|
||||
super(ToolMaterial.EMERALD);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(240);
|
||||
setUnlocalizedName("techreborn.advancedChainsaw");
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
return true;
|
||||
super(ToolMaterial.EMERALD, "techreborn.advancedChainsaw", ConfigTechReborn.AdvancedChainsawCharge, ConfigTechReborn.AdvancedDrillTier, 4.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,85 +16,6 @@ public class ItemAdvancedChainsaw extends ItemAxe implements IEnergyItemInfo, IT
|
|||
return Items.diamond_axe.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||
if(!PoweredItem.canUseEnergy(cost, stack)){
|
||||
return 4.0F;
|
||||
}
|
||||
if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else {
|
||||
return super.getDigSpeed(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos.getX(), pos.getY(), pos.getZ(), side.getIndex(), hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTeir(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings(
|
||||
{"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/advancedChainsaw";
|
||||
|
|
|
@ -1,50 +1,14 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemAdvancedDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public int maxCharge = ConfigTechReborn.AdvancedDrillCharge;
|
||||
public int cost = 250;
|
||||
public static final int tier = ConfigTechReborn.AdvancedDrillTier;
|
||||
public double transferLimit = 100;
|
||||
public class ItemAdvancedDrill extends ItemDrill {
|
||||
|
||||
public ItemAdvancedDrill() {
|
||||
super(ToolMaterial.EMERALD);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(240);
|
||||
setUnlocalizedName("techreborn.advancedDrill");
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
return true;
|
||||
super(ToolMaterial.EMERALD, "techreborn.advancedDrill", ConfigTechReborn.AdvancedDrillCharge, ConfigTechReborn.AdvancedDrillTier, 4.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,85 +16,6 @@ public class ItemAdvancedDrill extends ItemPickaxe implements IEnergyItemInfo, I
|
|||
return Items.diamond_pickaxe.canHarvestBlock(block, stack) || Items.diamond_shovel.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||
if(!PoweredItem.canUseEnergy(cost, stack)){
|
||||
return 4.0F;
|
||||
}
|
||||
if (Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else {
|
||||
return super.getDigSpeed(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos.getX(), pos.getY(), pos.getZ(), side.getIndex(), hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTeir(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings(
|
||||
{"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/advancedDrill";
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
@ -22,23 +23,26 @@ import reborncore.api.power.IEnergyItemInfo;
|
|||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public int maxCharge = ConfigTechReborn.IronChainsawCharge;
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
public static final int tier = ConfigTechReborn.IronChainsawTier;
|
||||
public float unpoweredSpeed = 2.0F;
|
||||
public static int tier = 1;
|
||||
public double transferLimit = 100;
|
||||
|
||||
public ItemChainsaw() {
|
||||
super(ToolMaterial.IRON);
|
||||
public ItemChainsaw(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed) {
|
||||
super(material);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(240);
|
||||
setUnlocalizedName("techreborn.ironChainsaw");
|
||||
setUnlocalizedName(unlocalizedName);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.maxCharge=energyCapacity;
|
||||
this.tier=tier;
|
||||
this.unpoweredSpeed=unpoweredSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,15 +51,10 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
||||
return Items.iron_axe.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||
if(!PoweredItem.canUseEnergy(cost, stack)){
|
||||
return 2.0F;
|
||||
return unpoweredSpeed;
|
||||
}
|
||||
if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F) {
|
||||
return efficiencyOnProperMaterial;
|
||||
|
@ -64,10 +63,9 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,7 +131,7 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
|
|||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/ironChainsaw";
|
||||
return "techreborn:items/tool/nullChainsaw";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,50 +1,14 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemDiamondChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public int maxCharge = ConfigTechReborn.DiamondChainsawCharge;
|
||||
public int cost = 250;
|
||||
public static final int tier = ConfigTechReborn.DiamondChainsawTier;
|
||||
public double transferLimit = 100;
|
||||
public class ItemDiamondChainsaw extends ItemChainsaw {
|
||||
|
||||
public ItemDiamondChainsaw() {
|
||||
super(ToolMaterial.EMERALD);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(240);
|
||||
setUnlocalizedName("techreborn.diamondChainsaw");
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
return true;
|
||||
super(ToolMaterial.EMERALD, "techreborn.diamondChainsaw", ConfigTechReborn.DiamondChainsawCharge, ConfigTechReborn.DiamondChainsawTier, 2.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,85 +16,6 @@ public class ItemDiamondChainsaw extends ItemAxe implements IEnergyItemInfo, ITe
|
|||
return Items.diamond_axe.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||
if(!PoweredItem.canUseEnergy(cost, stack)){
|
||||
return 2.5F;
|
||||
}
|
||||
if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else {
|
||||
return super.getDigSpeed(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos.getX(), pos.getY(), pos.getZ(), side.getIndex(), hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTeir(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings(
|
||||
{"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/diamondChainsaw";
|
||||
|
|
|
@ -1,50 +1,14 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemDiamondDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public int maxCharge = ConfigTechReborn.DiamondDrillCharge;
|
||||
public int cost = 250;
|
||||
public static final int tier = ConfigTechReborn.DiamondDrillTier;
|
||||
public double transferLimit = 100;
|
||||
public class ItemDiamondDrill extends ItemDrill {
|
||||
|
||||
public ItemDiamondDrill() {
|
||||
super(ToolMaterial.EMERALD);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(240);
|
||||
setUnlocalizedName("techreborn.diamondDrill");
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
return true;
|
||||
super(ToolMaterial.EMERALD, "techreborn.diamondDrill", ConfigTechReborn.DiamondDrillCharge, ConfigTechReborn.DiamondDrillTier, 2.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,85 +16,6 @@ public class ItemDiamondDrill extends ItemPickaxe implements IEnergyItemInfo, IT
|
|||
return Items.diamond_pickaxe.canHarvestBlock(block, stack) || Items.diamond_shovel.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||
if(!PoweredItem.canUseEnergy(cost, stack)){
|
||||
return 2.5F;
|
||||
}
|
||||
if (Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else {
|
||||
return super.getDigSpeed(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos.getX(), pos.getY(), pos.getZ(), side.getIndex(), hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTeir(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings(
|
||||
{"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/diamondDrill";
|
||||
|
|
|
@ -26,19 +26,23 @@ import techreborn.config.ConfigTechReborn;
|
|||
|
||||
public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public int maxCharge = ConfigTechReborn.IronDrillCharge;
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
public static final int tier = ConfigTechReborn.IronDrillTier;
|
||||
public float unpoweredSpeed = 2.0F;
|
||||
public static int tier = 1;
|
||||
public double transferLimit = 100;
|
||||
|
||||
public ItemDrill() {
|
||||
super(ToolMaterial.IRON);
|
||||
public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed) {
|
||||
super(material);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(240);
|
||||
setUnlocalizedName("techreborn.ironDrill");
|
||||
setUnlocalizedName(unlocalizedName);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.maxCharge=energyCapacity;
|
||||
this.tier=tier;
|
||||
this.unpoweredSpeed=unpoweredSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,15 +51,10 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
||||
return Items.iron_pickaxe.canHarvestBlock(block, stack) || Items.iron_shovel.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||
if(!PoweredItem.canUseEnergy(cost, stack)){
|
||||
return 2.0F;
|
||||
return unpoweredSpeed;
|
||||
}
|
||||
if (Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F) {
|
||||
return efficiencyOnProperMaterial;
|
||||
|
@ -64,10 +63,9 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,7 +131,7 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
|||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/ironDrill";
|
||||
return "techreborn:items/tool/nullDrill";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
28
src/main/java/techreborn/items/tools/ItemIronChainsaw.java
Normal file
28
src/main/java/techreborn/items/tools/ItemIronChainsaw.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemIronChainsaw extends ItemChainsaw {
|
||||
|
||||
public ItemIronChainsaw() {
|
||||
super(ToolMaterial.IRON, "techreborn.ironChainsaw", ConfigTechReborn.IronChainsawCharge, ConfigTechReborn.IronChainsawTier, 2.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
||||
return Items.iron_axe.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/ironChainsaw";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
28
src/main/java/techreborn/items/tools/ItemIronDrill.java
Normal file
28
src/main/java/techreborn/items/tools/ItemIronDrill.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemIronDrill extends ItemDrill {
|
||||
|
||||
public ItemIronDrill() {
|
||||
super(ToolMaterial.IRON, "techreborn.ironDrill", ConfigTechReborn.IronDrillCharge, ConfigTechReborn.IronDrillTier, 2.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
||||
return Items.iron_pickaxe.canHarvestBlock(block, stack) || Items.iron_shovel.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/ironDrill";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -11,6 +12,7 @@ import net.minecraft.util.BlockPos;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.items.ItemTR;
|
||||
import techreborn.items.ItemTextureBase;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -18,11 +20,12 @@ import java.util.Random;
|
|||
/**
|
||||
* Created by mark on 26/02/2016.
|
||||
*/
|
||||
public class ItemWrench extends ItemTextureBase {
|
||||
public class ItemWrench extends ItemTR implements ITexturedItem {
|
||||
|
||||
public ItemWrench() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setUnlocalizedName("techreborn.wrench");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 490 B After Width: | Height: | Size: 490 B |
Binary file not shown.
After Width: | Height: | Size: 381 B |
Binary file not shown.
After Width: | Height: | Size: 518 B |
Binary file not shown.
After Width: | Height: | Size: 383 B |
Loading…
Reference in a new issue