diff --git a/README.md b/README.md index 893607440..a8664d148 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,34 @@ TechReborn is a resurrection of GregTech 2.78 for modern Minecraft. It brings most of GT4's features and behaviors to Minecraft, with lots of tweaks, and a few editions. It also aims to be more compatible with other mods than GregTech, and has the ultimate goal of becoming a standalone mod, compatible with but not dependent on IC2. -TechReborn is currently in a beta state. +TechReborn is currently in a beta state. Crashes or bugs may happen at any time, so *please* do not use this on a world that is important to you, or at the very least back it up on every update. -We have permission to use Greg's textures, see here :https://i.imgur.com/YQEMrq5.png?1 +We have permission to use Greg's textures (see [here](https://i.imgur.com/YQEMrq5.png?1)). -The current main maintainer is @gigabit101 if you need any help please contact us. +The current main maintainer is [@gigabit101](https://github.com/gigabit101/) if you need any help please contact us (see 'Contact' section below). -@modmuss50 is a past maintainer of the mod(see http://techreborn.ninja/?p=20). +[@modmuss50](https://github.com/modmuss50/) is a past maintainer of the mod (see [here](http://techreborn.ninja/?p=20)). -1.7.10: +# Reccommended Builds: -[![Build Status](http://modmuss50.me:8080/job/TechReborn-1.7.10/badge/icon)](http://modmuss50.me:8080/job/TechReborn-1.7.10/) +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. + +# Jenkins Builds: + +Jenkins builds of TechReborn are compiled directly from this repository. Please remember to backup your worlds before using a jenkins build of TechReborn. 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.* [![Build Status](http://modmuss50.me:8080/job/TechReborn-1.8.9/badge/icon)](http://modmuss50.me:8080/job/TechReborn-1.8.9/) -REMOVED ALL THE JUNK FROM OTHER VERSION 2.78 ONLY +1.7.10: +--- + +*Please understand that the 1.7.10 version of TechReborn is not being maintained. We've moved onto TechReborn for Minecraft 1.8.9. If there is an extremely critical bug that you find in the 1.7.10 version, report it to the bug tracker and we will determine if it is drastic enough for a fix.* + +[![Build Status](http://modmuss50.me:8080/job/TechReborn-1.7.10/badge/icon)](http://modmuss50.me:8080/job/TechReborn-1.7.10/) + +REMOVED ALL THE JUNK FROM OTHER VERSION 2.78 ONLY \ No newline at end of file diff --git a/changelogs/sinceLastRelease.txt b/changelogs/sinceLastRelease.txt index 4045602ac..b31d43923 100644 --- a/changelogs/sinceLastRelease.txt +++ b/changelogs/sinceLastRelease.txt @@ -11,8 +11,20 @@ Added: -Diamond drill -Scrap -Iron fences --Iron fence gates -RF power tooltips +-Copper and Tin Worldgen +-Iron Hammer +-Basic plate recipes +-Solar panel +-Lava and water cells +-Tech Manual +-Wind and Water mills +-Iron chainsaw +-Diamond chainsaw +-Advanced chainsaw +-Wrench (do you even wrench bro?) +-New Power network +-Cables Changes: -Updated JEI compatibility @@ -21,7 +33,8 @@ Changes: -Rubber saplings now spawn in loot chests -Copper ingots now spawn in loot chests -Tin ingots now spawn in loot chests --Optimized imports Fixes: --Fixed Config localization issues \ No newline at end of file +-Fixed Config localization issues +-Drill tier and charge configs actually work +-JEI alloy smelter plugin not showing stack amount \ No newline at end of file diff --git a/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java b/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java index 4ac956f59..ff8601d29 100644 --- a/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java +++ b/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java @@ -53,6 +53,8 @@ public class BlockSolarPanel extends BaseTileBlock implements ITexturedBlock { boolean isActive = state.getValue(ACTIVE); if(side == EnumFacing.UP){ return prefix + "solar_panel_top_" + (isActive ? "on" : "off"); + } else if(side==EnumFacing.DOWN){ + return prefix + "machine_bottom"; } return prefix + "solar_panel_side_" + (isActive ? "on" : "off"); } diff --git a/src/main/java/techreborn/init/ModItems.java b/src/main/java/techreborn/init/ModItems.java index d55443b41..c82da9f02 100644 --- a/src/main/java/techreborn/init/ModItems.java +++ b/src/main/java/techreborn/init/ModItems.java @@ -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"); diff --git a/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java b/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java index 9484622c7..6b17a6a29 100644 --- a/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java @@ -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"; diff --git a/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java b/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java index 3371c0299..c66ffc6d3 100644 --- a/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java +++ b/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java @@ -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"; diff --git a/src/main/java/techreborn/items/tools/ItemChainsaw.java b/src/main/java/techreborn/items/tools/ItemChainsaw.java index 4fc009ee9..1e0aafa54 100644 --- a/src/main/java/techreborn/items/tools/ItemChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemChainsaw.java @@ -1,15 +1,19 @@ 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.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,40 +26,45 @@ import reborncore.api.power.IEnergyItemInfo; import reborncore.common.powerSystem.PoweredItem; import reborncore.common.util.TorchHelper; import techreborn.client.TechRebornCreativeTab; -import techreborn.config.ConfigTechReborn; +import techreborn.utils.OreDictUtils; 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 - public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) { - PoweredItem.useEnergy(cost, stack); - return true; - } - - @Override - public boolean canHarvestBlock(Block block, ItemStack stack) { - return Items.iron_axe.canHarvestBlock(block, stack); - } + @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 float getDigSpeed(ItemStack stack, IBlockState state) { + if(OreDictUtils.isOre(state, "treeLeaves")&&PoweredItem.canUseEnergy(cost, stack)){ + return 40F; + } if(!PoweredItem.canUseEnergy(cost, stack)){ - return 2.0F; + return unpoweredSpeed; } if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F) { return efficiencyOnProperMaterial; @@ -64,10 +73,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 +141,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 diff --git a/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java b/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java index 2cbcd7cfb..46050db93 100644 --- a/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java @@ -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"; diff --git a/src/main/java/techreborn/items/tools/ItemDiamondDrill.java b/src/main/java/techreborn/items/tools/ItemDiamondDrill.java index bcfb62cd3..8f174512e 100644 --- a/src/main/java/techreborn/items/tools/ItemDiamondDrill.java +++ b/src/main/java/techreborn/items/tools/ItemDiamondDrill.java @@ -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"; diff --git a/src/main/java/techreborn/items/tools/ItemDrill.java b/src/main/java/techreborn/items/tools/ItemDrill.java index f867ee8f7..6e9bbe180 100644 --- a/src/main/java/techreborn/items/tools/ItemDrill.java +++ b/src/main/java/techreborn/items/tools/ItemDrill.java @@ -1,11 +1,14 @@ 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.Items; @@ -22,122 +25,119 @@ 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 ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem { - public int maxCharge = ConfigTechReborn.IronDrillCharge; - public int cost = 250; - public static final int tier = ConfigTechReborn.IronDrillTier; - public double transferLimit = 100; + public int maxCharge = 1; + public int cost = 250; + public float unpoweredSpeed = 2.0F; + public static int tier = 1; + public double transferLimit = 100; - public ItemDrill() { - super(ToolMaterial.IRON); - efficiencyOnProperMaterial = 20F; - setCreativeTab(TechRebornCreativeTab.instance); - setMaxStackSize(1); - setMaxDamage(240); - setUnlocalizedName("techreborn.ironDrill"); - RebornCore.jsonDestroyer.registerObject(this); - } + public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed) { + super(material); + efficiencyOnProperMaterial = 20F; + setCreativeTab(TechRebornCreativeTab.instance); + setMaxStackSize(1); + setMaxDamage(240); + setUnlocalizedName(unlocalizedName); + RebornCore.jsonDestroyer.registerObject(this); + this.maxCharge = energyCapacity; + this.tier = tier; + this.unpoweredSpeed = unpoweredSpeed; + } - @Override - public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) { - PoweredItem.useEnergy(cost, stack); - return true; - } + @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) { - 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 unpoweredSpeed; + } + 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 float getDigSpeed(ItemStack stack, IBlockState state) { - if(!PoweredItem.canUseEnergy(cost, stack)){ - return 2.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 hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) { - return true; - } + @Override + public boolean isRepairable() { + return false; + } + @Override + public double getMaxPower(ItemStack stack) { + return maxCharge; + } - @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 canAcceptEnergy(ItemStack stack) { + return true; + } - @Override - public boolean isRepairable() { - return false; - } + @Override + public boolean canProvideEnergy(ItemStack stack) { + return false; + } + @Override + public double getMaxTransfer(ItemStack stack) { + return transferLimit; + } - @Override - public double getMaxPower(ItemStack stack) { - return maxCharge; - } + @Override + public int getStackTeir(ItemStack stack) { + return tier; + } - @Override - public boolean canAcceptEnergy(ItemStack stack) { - return true; - } + @SuppressWarnings({ "rawtypes", "unchecked" }) + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + itemList.add(itemStack); - @Override - public boolean canProvideEnergy(ItemStack stack) { - return false; - } + ItemStack charged = new ItemStack(this, 1); + PoweredItem.setEnergy(getMaxPower(charged), charged); + itemList.add(charged); + } - @Override - public double getMaxTransfer(ItemStack stack) { - return transferLimit; - } + @Override + public double getDurabilityForDisplay(ItemStack stack) { + double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); + return 1 - charge; - @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); + @Override + public boolean showDurabilityBar(ItemStack stack) { + return true; + } - ItemStack charged = new ItemStack(this, 1); - PoweredItem.setEnergy(getMaxPower(charged), charged); - itemList.add(charged); - } + @Override + public String getTextureName(int damage) { + return "techreborn:items/tool/nullDrill"; + } - @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/ironDrill"; - } - - @Override - public int getMaxMeta() { - return 1; - } + @Override + public int getMaxMeta() { + return 1; + } } diff --git a/src/main/java/techreborn/items/tools/ItemHammer.java b/src/main/java/techreborn/items/tools/ItemHammer.java index debdba05a..13474df60 100644 --- a/src/main/java/techreborn/items/tools/ItemHammer.java +++ b/src/main/java/techreborn/items/tools/ItemHammer.java @@ -22,7 +22,7 @@ public class ItemHammer extends ItemTR implements ITexturedItem { @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { - world.playSoundAtEntity(player, "minecraft:random.anvil_land", 1F, 1F); + world.playSoundAtEntity(player, "techreborn:block_dismantle", 0.8F, 0.4F); return true; } diff --git a/src/main/java/techreborn/items/tools/ItemIronChainsaw.java b/src/main/java/techreborn/items/tools/ItemIronChainsaw.java new file mode 100644 index 000000000..b2b5e3fa8 --- /dev/null +++ b/src/main/java/techreborn/items/tools/ItemIronChainsaw.java @@ -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; + } +} diff --git a/src/main/java/techreborn/items/tools/ItemIronDrill.java b/src/main/java/techreborn/items/tools/ItemIronDrill.java new file mode 100644 index 000000000..9a8bb2cb6 --- /dev/null +++ b/src/main/java/techreborn/items/tools/ItemIronDrill.java @@ -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; + } +} diff --git a/src/main/java/techreborn/items/tools/ItemWrench.java b/src/main/java/techreborn/items/tools/ItemWrench.java index 167df8164..ecdbf2a88 100644 --- a/src/main/java/techreborn/items/tools/ItemWrench.java +++ b/src/main/java/techreborn/items/tools/ItemWrench.java @@ -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"); + } diff --git a/src/main/java/techreborn/utils/OreDictUtils.java b/src/main/java/techreborn/utils/OreDictUtils.java new file mode 100644 index 000000000..231bf9a92 --- /dev/null +++ b/src/main/java/techreborn/utils/OreDictUtils.java @@ -0,0 +1,40 @@ +package techreborn.utils; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.oredict.OreDictionary; + +public class OreDictUtils { + + public static boolean isOre(Block block, String oreName) { + return isOre(new ItemStack(Item.getItemFromBlock(block)), oreName); + } + + public static boolean isOre(IBlockState state, String oreName) { + return isOre(new ItemStack(Item.getItemFromBlock(state.getBlock()), 1, state.getBlock().getMetaFromState(state)), oreName); + } + + public static boolean isOre(Item item, String oreName) { + return isOre(new ItemStack(item), oreName); + } + + public static boolean isOre(ItemStack stack, String oreName) { + int id = OreDictionary.getOreID(oreName); + + if (stack != null || stack.getItem() != null) { + int[] ids = OreDictionary.getOreIDs(stack); + + for (int i : ids) { + if (id == i) { + return true; + } + } + } + + return false; + } +} diff --git a/src/main/resources/assets/techreborn/textures/blocks/storage/copper_block.png b/src/main/resources/assets/techreborn/textures/blocks/storage/copper_block.png index fc8871b90..1820e285f 100644 Binary files a/src/main/resources/assets/techreborn/textures/blocks/storage/copper_block.png and b/src/main/resources/assets/techreborn/textures/blocks/storage/copper_block.png differ diff --git a/src/main/resources/assets/techreborn/textures/items/cables/copper.png b/src/main/resources/assets/techreborn/textures/items/cables/copper.png new file mode 100644 index 000000000..65f3f432d Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/items/cables/copper.png differ diff --git a/src/main/resources/assets/techreborn/textures/items/cables/gold.png b/src/main/resources/assets/techreborn/textures/items/cables/gold.png new file mode 100644 index 000000000..b57d45fdf Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/items/cables/gold.png differ diff --git a/src/main/resources/assets/techreborn/textures/items/tool/ironChainsaw.png b/src/main/resources/assets/techreborn/textures/items/tool/ironChainsaw.png index 35530ab45..1c412fdaa 100644 Binary files a/src/main/resources/assets/techreborn/textures/items/tool/ironChainsaw.png and b/src/main/resources/assets/techreborn/textures/items/tool/ironChainsaw.png differ diff --git a/src/main/resources/assets/techreborn/textures/items/tool/nullChainsaw.png b/src/main/resources/assets/techreborn/textures/items/tool/nullChainsaw.png new file mode 100644 index 000000000..a55b7a571 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/items/tool/nullChainsaw.png differ diff --git a/src/main/resources/assets/techreborn/textures/items/tool/nullDrill.png b/src/main/resources/assets/techreborn/textures/items/tool/nullDrill.png new file mode 100644 index 000000000..f51a78218 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/items/tool/nullDrill.png differ diff --git a/src/main/resources/assets/techreborn/textures/items/tool/rebattery.png b/src/main/resources/assets/techreborn/textures/items/tool/rebattery.png index 90c7044bd..9c654d367 100644 Binary files a/src/main/resources/assets/techreborn/textures/items/tool/rebattery.png and b/src/main/resources/assets/techreborn/textures/items/tool/rebattery.png differ diff --git a/src/main/resources/assets/techreborn/textures/items/tool/rebatteryEmpty.png b/src/main/resources/assets/techreborn/textures/items/tool/rebatteryEmpty.png new file mode 100644 index 000000000..ab1a04e29 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/items/tool/rebatteryEmpty.png differ