Added jackhammers
This commit is contained in:
parent
3ad3453499
commit
9e5f223a42
21 changed files with 359 additions and 98 deletions
|
@ -10,9 +10,9 @@ The current main maintainer is [@gigabit101](https://github.com/gigabit101/) if
|
||||||
|
|
||||||
[@modmuss50](https://github.com/modmuss50/) is a past maintainer of the mod (see [here](http://techreborn.ninja/?p=20)).
|
[@modmuss50](https://github.com/modmuss50/) is a past maintainer of the mod (see [here](http://techreborn.ninja/?p=20)).
|
||||||
|
|
||||||
# Reccommended Builds:
|
# Recommended Builds:
|
||||||
|
|
||||||
See [this list](http://minecraft.curseforge.com/projects/techreborn/files?sort=releasetype). The top one should always be the latest, reccommended build of TechReborn. Currently TechReborn does not have a reccommended 1.8.9 build.
|
See [this list](http://minecraft.curseforge.com/projects/techreborn/files?sort=releasetype). The top one should always be the latest, recommended build of TechReborn. Currently TechReborn does not have a recommended 1.8.9 build.
|
||||||
|
|
||||||
# Jenkins Builds:
|
# Jenkins Builds:
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ Jenkins builds of TechReborn are compiled directly from this repository. Please
|
||||||
1.8.9:
|
1.8.9:
|
||||||
---
|
---
|
||||||
|
|
||||||
*This version is constantly recieving updates, and does not have a stable, reccommended, release. Once again, remember to backup your worlds before using jenkins builds.*
|
*This version is constantly recieving updates, and does not have a stable, recommended, release. Once again, remember to backup your worlds before using jenkins builds.*
|
||||||
|
|
||||||
[![Build Status](http://modmuss50.me:8080/job/TechReborn-1.8.9/badge/icon)](http://modmuss50.me:8080/job/TechReborn-1.8.9/)
|
[![Build Status](http://modmuss50.me:8080/job/TechReborn-1.8.9/badge/icon)](http://modmuss50.me:8080/job/TechReborn-1.8.9/)
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,9 @@ public class ConfigTechReborn {
|
||||||
public static int IronChainsawCharge;
|
public static int IronChainsawCharge;
|
||||||
public static int DiamondChainsawCharge;
|
public static int DiamondChainsawCharge;
|
||||||
public static int AdvancedChainsawCharge;
|
public static int AdvancedChainsawCharge;
|
||||||
|
public static int IronJackhammerCharge;
|
||||||
|
public static int DiamondJackhammerCharge;
|
||||||
|
public static int SteelJackhammerCharge;
|
||||||
public static int LapotronPackCharge;
|
public static int LapotronPackCharge;
|
||||||
public static int LithiumBatpackCharge;
|
public static int LithiumBatpackCharge;
|
||||||
public static int LapotronicOrbMaxCharge;
|
public static int LapotronicOrbMaxCharge;
|
||||||
|
@ -114,6 +117,9 @@ public class ConfigTechReborn {
|
||||||
public static int IronChainsawTier;
|
public static int IronChainsawTier;
|
||||||
public static int DiamondChainsawTier;
|
public static int DiamondChainsawTier;
|
||||||
public static int AdvancedChainsawTier;
|
public static int AdvancedChainsawTier;
|
||||||
|
public static int IronJackhammerTier;
|
||||||
|
public static int DiamondJackhammerTier;
|
||||||
|
public static int SteelJackhammerTier;
|
||||||
public static int LapotronPackTier;
|
public static int LapotronPackTier;
|
||||||
public static int LapotronicOrbTier;
|
public static int LapotronicOrbTier;
|
||||||
public static int LithiumBatpackTier;
|
public static int LithiumBatpackTier;
|
||||||
|
@ -408,6 +414,18 @@ public class ConfigTechReborn {
|
||||||
.get(CATEGORY_POWER, "AdvancedChainsaw MaxCharge", 1000000, "Set the max charge for the advanced chainsaw")
|
.get(CATEGORY_POWER, "AdvancedChainsaw MaxCharge", 1000000, "Set the max charge for the advanced chainsaw")
|
||||||
.getInt();
|
.getInt();
|
||||||
|
|
||||||
|
IronJackhammerCharge = config
|
||||||
|
.get(CATEGORY_POWER, "IronJackhammer MaxCharge", 10000, "Set the max charge for the iron jackhammer")
|
||||||
|
.getInt();
|
||||||
|
|
||||||
|
SteelJackhammerCharge = config
|
||||||
|
.get(CATEGORY_POWER, "AdvancedJackhammer MaxCharge", 20000, "Set the max charge for the advanced jackhammer")
|
||||||
|
.getInt();
|
||||||
|
|
||||||
|
DiamondJackhammerCharge = config
|
||||||
|
.get(CATEGORY_POWER, "DiamondJackhammer MaxCharge", 100000, "Set the max charge for the diamond jackhammer")
|
||||||
|
.getInt();
|
||||||
|
|
||||||
LapotronPackCharge = config
|
LapotronPackCharge = config
|
||||||
.get(CATEGORY_POWER, "LapotronPack MaxCharge", 100000000, "Set the max charge for the LapotronPack")
|
.get(CATEGORY_POWER, "LapotronPack MaxCharge", 100000000, "Set the max charge for the LapotronPack")
|
||||||
.getInt();
|
.getInt();
|
||||||
|
@ -468,6 +486,15 @@ public class ConfigTechReborn {
|
||||||
AdvancedChainsawTier = config.get(CATEGORY_POWER, "AdvancedChainsaw Tier", 2, "Set the Tier of the advanced chainsaw")
|
AdvancedChainsawTier = config.get(CATEGORY_POWER, "AdvancedChainsaw Tier", 2, "Set the Tier of the advanced chainsaw")
|
||||||
.getInt();
|
.getInt();
|
||||||
|
|
||||||
|
IronJackhammerTier = config.get(CATEGORY_POWER, "IronJackhammer Tier", 2, "Set the Tier of the iron jackhammer")
|
||||||
|
.getInt();
|
||||||
|
|
||||||
|
DiamondJackhammerTier = config.get(CATEGORY_POWER, "DiamondJackhammer Tier", 2, "Set the Tier of the diamond jackhammer")
|
||||||
|
.getInt();
|
||||||
|
|
||||||
|
SteelJackhammerTier = config.get(CATEGORY_POWER, "AdvancedJackhammer Tier", 2, "Set the Tier of the advanced jackhammer")
|
||||||
|
.getInt();
|
||||||
|
|
||||||
LapotronPackTier = config.get(CATEGORY_POWER, "LapotronPack Tier", 2, "Set the Tier of the LapotronPack")
|
LapotronPackTier = config.get(CATEGORY_POWER, "LapotronPack Tier", 2, "Set the Tier of the LapotronPack")
|
||||||
.getInt();
|
.getInt();
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,9 @@ public class ModItems {
|
||||||
public static Item ironChainsaw;
|
public static Item ironChainsaw;
|
||||||
public static Item diamondChainsaw;
|
public static Item diamondChainsaw;
|
||||||
public static Item advancedChainsaw;
|
public static Item advancedChainsaw;
|
||||||
|
public static Item ironJackhammer;
|
||||||
|
public static Item steelJackhammer;
|
||||||
|
public static Item diamondJackhammer;
|
||||||
public static Item hammer;
|
public static Item hammer;
|
||||||
public static Item wrench;
|
public static Item wrench;
|
||||||
public static Item cables;
|
public static Item cables;
|
||||||
|
@ -149,6 +152,13 @@ public class ModItems {
|
||||||
GameRegistry.registerItem(diamondChainsaw, "diamondchainsaw");
|
GameRegistry.registerItem(diamondChainsaw, "diamondchainsaw");
|
||||||
advancedChainsaw = PoweredItem.createItem(ItemAdvancedChainsaw.class);
|
advancedChainsaw = PoweredItem.createItem(ItemAdvancedChainsaw.class);
|
||||||
GameRegistry.registerItem(advancedChainsaw, "advancedchainsaw");
|
GameRegistry.registerItem(advancedChainsaw, "advancedchainsaw");
|
||||||
|
|
||||||
|
ironJackhammer = PoweredItem.createItem(ItemIronJackhammer.class);
|
||||||
|
GameRegistry.registerItem(ironJackhammer, "ironjackhammer");
|
||||||
|
steelJackhammer = PoweredItem.createItem(ItemSteelJackhammer.class);
|
||||||
|
GameRegistry.registerItem(steelJackhammer, "steeljackhammer");
|
||||||
|
diamondJackhammer = PoweredItem.createItem(ItemDiamondJackhammer.class);
|
||||||
|
GameRegistry.registerItem(diamondJackhammer, "diamondjackhammer");
|
||||||
|
|
||||||
hammer = new ItemHammer(100);
|
hammer = new ItemHammer(100);
|
||||||
GameRegistry.registerItem(hammer, "hammer");
|
GameRegistry.registerItem(hammer, "hammer");
|
||||||
|
|
|
@ -9,6 +9,7 @@ public class ItemAdvancedChainsaw extends ItemChainsaw {
|
||||||
|
|
||||||
public ItemAdvancedChainsaw() {
|
public ItemAdvancedChainsaw() {
|
||||||
super(ToolMaterial.EMERALD, "techreborn.advancedChainsaw", ConfigTechReborn.AdvancedChainsawCharge, ConfigTechReborn.AdvancedDrillTier, 4.0F);
|
super(ToolMaterial.EMERALD, "techreborn.advancedChainsaw", ConfigTechReborn.AdvancedChainsawCharge, ConfigTechReborn.AdvancedDrillTier, 4.0F);
|
||||||
|
this.cost = 250;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,6 +9,7 @@ public class ItemAdvancedDrill extends ItemDrill {
|
||||||
|
|
||||||
public ItemAdvancedDrill() {
|
public ItemAdvancedDrill() {
|
||||||
super(ToolMaterial.EMERALD, "techreborn.advancedDrill", ConfigTechReborn.AdvancedDrillCharge, ConfigTechReborn.AdvancedDrillTier, 4.0F);
|
super(ToolMaterial.EMERALD, "techreborn.advancedDrill", ConfigTechReborn.AdvancedDrillCharge, ConfigTechReborn.AdvancedDrillTier, 4.0F);
|
||||||
|
this.cost = 250;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,122 +30,121 @@ import techreborn.utils.OreDictUtils;
|
||||||
|
|
||||||
public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedItem {
|
public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedItem {
|
||||||
|
|
||||||
public int maxCharge = 1;
|
public int maxCharge = 1;
|
||||||
public int cost = 250;
|
public int cost = 250;
|
||||||
public float unpoweredSpeed = 2.0F;
|
public float unpoweredSpeed = 2.0F;
|
||||||
public static int tier = 1;
|
public static int tier = 1;
|
||||||
public double transferLimit = 100;
|
public double transferLimit = 100;
|
||||||
|
|
||||||
public ItemChainsaw(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed) {
|
public ItemChainsaw(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed) {
|
||||||
super(material);
|
super(material);
|
||||||
efficiencyOnProperMaterial = 20F;
|
efficiencyOnProperMaterial = 20F;
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
setMaxDamage(240);
|
setMaxDamage(240);
|
||||||
setUnlocalizedName(unlocalizedName);
|
setUnlocalizedName(unlocalizedName);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
this.maxCharge=energyCapacity;
|
this.maxCharge = energyCapacity;
|
||||||
this.tier=tier;
|
this.tier = tier;
|
||||||
this.unpoweredSpeed=unpoweredSpeed;
|
this.unpoweredSpeed = unpoweredSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack)+1) == 0) {
|
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack) + 1) == 0) {
|
||||||
PoweredItem.useEnergy(cost, stack);
|
PoweredItem.useEnergy(cost, stack);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||||
if(OreDictUtils.isOre(state, "treeLeaves")&&PoweredItem.canUseEnergy(cost, stack)){
|
if (!PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
return 40F;
|
return unpoweredSpeed;
|
||||||
}
|
}
|
||||||
if(!PoweredItem.canUseEnergy(cost, stack)){
|
|
||||||
return unpoweredSpeed;
|
|
||||||
}
|
|
||||||
if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F) {
|
|
||||||
return efficiencyOnProperMaterial;
|
|
||||||
} else {
|
|
||||||
return super.getDigSpeed(stack, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (OreDictUtils.isOre(state, "treeLeaves") && PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
return 40F;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F) {
|
||||||
|
return efficiencyOnProperMaterial;
|
||||||
|
} else {
|
||||||
|
return super.getDigSpeed(stack, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos.getX(), pos.getY(), pos.getZ(), side.getIndex(), hitX, hitY, hitZ);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRepairable() {
|
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
return false;
|
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos.getX(), pos.getY(), pos.getZ(), side.getIndex(), hitX, hitY, hitZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRepairable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower(ItemStack stack) {
|
public double getMaxPower(ItemStack stack) {
|
||||||
return maxCharge;
|
return maxCharge;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(ItemStack stack) {
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(ItemStack stack) {
|
public boolean canProvideEnergy(ItemStack stack) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxTransfer(ItemStack stack) {
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
return transferLimit;
|
return transferLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTeir(ItemStack stack) {
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings(
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
{"rawtypes", "unchecked"})
|
@SideOnly(Side.CLIENT)
|
||||||
@SideOnly(Side.CLIENT)
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
itemList.add(itemStack);
|
||||||
itemList.add(itemStack);
|
|
||||||
|
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
||||||
itemList.add(charged);
|
itemList.add(charged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDurabilityForDisplay(ItemStack stack) {
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
return 1 - charge;
|
return 1 - charge;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showDurabilityBar(ItemStack stack) {
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage) {
|
public String getTextureName(int damage) {
|
||||||
return "techreborn:items/tool/nullChainsaw";
|
return "techreborn:items/tool/nullChainsaw";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta() {
|
public int getMaxMeta() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ public class ItemDiamondChainsaw extends ItemChainsaw {
|
||||||
|
|
||||||
public ItemDiamondChainsaw() {
|
public ItemDiamondChainsaw() {
|
||||||
super(ToolMaterial.EMERALD, "techreborn.diamondChainsaw", ConfigTechReborn.DiamondChainsawCharge, ConfigTechReborn.DiamondChainsawTier, 2.5F);
|
super(ToolMaterial.EMERALD, "techreborn.diamondChainsaw", ConfigTechReborn.DiamondChainsawCharge, ConfigTechReborn.DiamondChainsawTier, 2.5F);
|
||||||
|
this.cost = 250;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,6 +9,7 @@ public class ItemDiamondDrill extends ItemDrill {
|
||||||
|
|
||||||
public ItemDiamondDrill() {
|
public ItemDiamondDrill() {
|
||||||
super(ToolMaterial.EMERALD, "techreborn.diamondDrill", ConfigTechReborn.DiamondDrillCharge, ConfigTechReborn.DiamondDrillTier, 2.5F);
|
super(ToolMaterial.EMERALD, "techreborn.diamondDrill", ConfigTechReborn.DiamondDrillCharge, ConfigTechReborn.DiamondDrillTier, 2.5F);
|
||||||
|
this.cost = 250;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package techreborn.items.tools;
|
||||||
|
|
||||||
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
|
||||||
|
public class ItemDiamondJackhammer extends ItemJackhammer {
|
||||||
|
|
||||||
|
public ItemDiamondJackhammer() {
|
||||||
|
super(ToolMaterial.EMERALD, "techreborn.diamondJackhammer", ConfigTechReborn.DiamondJackhammerCharge, ConfigTechReborn.DiamondJackhammerTier);
|
||||||
|
this.cost = 250;
|
||||||
|
this.efficiencyOnProperMaterial = 60F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTextureName(int damage) {
|
||||||
|
return "techreborn:items/tool/diamondJackhammer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,7 +9,8 @@ public class ItemIronChainsaw extends ItemChainsaw {
|
||||||
|
|
||||||
public ItemIronChainsaw() {
|
public ItemIronChainsaw() {
|
||||||
super(ToolMaterial.IRON, "techreborn.ironChainsaw", ConfigTechReborn.IronChainsawCharge, ConfigTechReborn.IronChainsawTier, 2.0F);
|
super(ToolMaterial.IRON, "techreborn.ironChainsaw", ConfigTechReborn.IronChainsawCharge, ConfigTechReborn.IronChainsawTier, 2.0F);
|
||||||
}
|
this.cost = 50;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ public class ItemIronDrill extends ItemDrill {
|
||||||
|
|
||||||
public ItemIronDrill() {
|
public ItemIronDrill() {
|
||||||
super(ToolMaterial.IRON, "techreborn.ironDrill", ConfigTechReborn.IronDrillCharge, ConfigTechReborn.IronDrillTier, 2.0F);
|
super(ToolMaterial.IRON, "techreborn.ironDrill", ConfigTechReborn.IronDrillCharge, ConfigTechReborn.IronDrillTier, 2.0F);
|
||||||
|
this.cost = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
22
src/main/java/techreborn/items/tools/ItemIronJackhammer.java
Normal file
22
src/main/java/techreborn/items/tools/ItemIronJackhammer.java
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package techreborn.items.tools;
|
||||||
|
|
||||||
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
|
||||||
|
public class ItemIronJackhammer extends ItemJackhammer {
|
||||||
|
|
||||||
|
public ItemIronJackhammer() {
|
||||||
|
super(ToolMaterial.IRON, "techreborn.ironJackhammer", ConfigTechReborn.IronJackhammerCharge, ConfigTechReborn.IronJackhammerTier);
|
||||||
|
this.cost = 50;
|
||||||
|
this.efficiencyOnProperMaterial = 12F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTextureName(int damage) {
|
||||||
|
return "techreborn:items/tool/ironJackhammer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
151
src/main/java/techreborn/items/tools/ItemJackhammer.java
Normal file
151
src/main/java/techreborn/items/tools/ItemJackhammer.java
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
package techreborn.items.tools;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
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.enchantment.Enchantment;
|
||||||
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
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.utils.OreDictUtils;
|
||||||
|
|
||||||
|
public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem {
|
||||||
|
|
||||||
|
public int maxCharge = 1;
|
||||||
|
public int cost = 250;
|
||||||
|
public static int tier = 1;
|
||||||
|
public double transferLimit = 100;
|
||||||
|
|
||||||
|
public ItemJackhammer(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier) {
|
||||||
|
super(material);
|
||||||
|
efficiencyOnProperMaterial = 20F;
|
||||||
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
|
setMaxStackSize(1);
|
||||||
|
setMaxDamage(240);
|
||||||
|
setUnlocalizedName(unlocalizedName);
|
||||||
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
|
this.maxCharge = energyCapacity;
|
||||||
|
this.tier = tier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
||||||
|
Random rand = new Random();
|
||||||
|
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack) + 1) == 0) {
|
||||||
|
PoweredItem.useEnergy(cost, stack);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
||||||
|
if (OreDictUtils.isOre(block, "stone") && PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||||
|
if (OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
|
return efficiencyOnProperMaterial;
|
||||||
|
} else {
|
||||||
|
return 0.5F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
if (PoweredItem.getEnergy(stack) > getMaxPower(stack)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
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/nullJackhammer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package techreborn.items.tools;
|
||||||
|
|
||||||
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
|
||||||
|
public class ItemSteelJackhammer extends ItemJackhammer {
|
||||||
|
|
||||||
|
public ItemSteelJackhammer() {
|
||||||
|
super(ToolMaterial.EMERALD, "techreborn.steelJackhammer", ConfigTechReborn.SteelJackhammerCharge, ConfigTechReborn.SteelJackhammerTier);
|
||||||
|
this.cost = 100;
|
||||||
|
this.efficiencyOnProperMaterial = 16F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTextureName(int damage) {
|
||||||
|
return "techreborn:items/tool/steelJackhammer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,9 +23,8 @@ public class OreDictUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOre(ItemStack stack, String oreName) {
|
public static boolean isOre(ItemStack stack, String oreName) {
|
||||||
int id = OreDictionary.getOreID(oreName);
|
if (stack != null && stack.getItem() != null && oreName != null) {
|
||||||
|
int id = OreDictionary.getOreID(oreName);
|
||||||
if (stack != null || stack.getItem() != null) {
|
|
||||||
int[] ids = OreDictionary.getOreIDs(stack);
|
int[] ids = OreDictionary.getOreIDs(stack);
|
||||||
|
|
||||||
for (int i : ids) {
|
for (int i : ids) {
|
||||||
|
|
|
@ -610,6 +610,9 @@ item.techreborn.advancedChainsaw.name=Advanced Chainsaw
|
||||||
item.techreborn.lapotronicorb.name=Lapotronic Energy Orb
|
item.techreborn.lapotronicorb.name=Lapotronic Energy Orb
|
||||||
item.techreborn.cloakingdevice.name=Cloaking Device
|
item.techreborn.cloakingdevice.name=Cloaking Device
|
||||||
item.techreborn.hammer.name=Iron Hammer
|
item.techreborn.hammer.name=Iron Hammer
|
||||||
|
item.techreborn.ironJackhammer.name=Iron Jackhammer
|
||||||
|
item.techreborn.steelJackhammer.name=Steel Jackhammer
|
||||||
|
item.techreborn.diamondJackhammer.name=Diamond Jackhammer
|
||||||
|
|
||||||
#Buckets
|
#Buckets
|
||||||
item.bucketberylium.name=Berylium Bucket
|
item.bucketberylium.name=Berylium Bucket
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 389 B |
Binary file not shown.
After Width: | Height: | Size: 327 B |
Binary file not shown.
After Width: | Height: | Size: 395 B |
Binary file not shown.
Before Width: | Height: | Size: 172 B |
Binary file not shown.
After Width: | Height: | Size: 389 B |
Loading…
Reference in a new issue