# Conflicts:
#	src/main/java/techreborn/items/tools/ItemWrench.java
This commit is contained in:
modmuss50 2016-02-29 08:15:23 +00:00
commit b0cb4f87c5
74 changed files with 1019 additions and 744 deletions

View file

@ -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:
# Recommended 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, recommended build of TechReborn. Currently TechReborn does not have a recommended 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, 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/)
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

View file

@ -19,8 +19,8 @@ apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
apply plugin: 'maven-publish'
sourceCompatibility = 1.7
targetCompatibility = 1.7
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {

View file

@ -1,3 +1,5 @@
NOTE: Starting in this version, Java 8 is REQUIRED to run TechReborn.
Version 0.7.12 Update Changelog:
Added:
-New recipe manager to list out missing items needed for recipes
@ -11,8 +13,23 @@ 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
-Iron jackhammer
-Steel jackhammer
-Diamond jackhammer
Changes:
-Updated JEI compatibility
@ -21,7 +38,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
-Drill tier and charge configs actually work
-JEI alloy smelter plugin not showing stack amount

6
gradlew vendored
View file

@ -42,6 +42,11 @@ case "`uname`" in
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@ -109,7 +114,6 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`

View file

@ -42,6 +42,7 @@ import techreborn.init.RecipeCompact;
import techreborn.lib.ModInfo;
import techreborn.packets.PacketAesu;
import techreborn.packets.PacketIdsu;
import techreborn.powernet.PowerEvent;
import techreborn.proxies.CommonProxy;
import techreborn.tiles.idsu.IDSUManager;
import techreborn.world.TROreGen;
@ -128,9 +129,10 @@ public class Core {
// IDSU manager
IDSUManager.INSTANCE = new IDSUManager();
MinecraftForge.EVENT_BUS.register(IDSUManager.INSTANCE);
FMLCommonHandler.instance().bus().register(new MultiblockServerTickHandler());
FMLCommonHandler.instance().bus().register(new TRTickHandler());
FMLCommonHandler.instance().bus().register(new OreUnifier());
MinecraftForge.EVENT_BUS.register(new MultiblockServerTickHandler());
MinecraftForge.EVENT_BUS.register(new TRTickHandler());
MinecraftForge.EVENT_BUS.register(new OreUnifier());
MinecraftForge.EVENT_BUS.register(new PowerEvent());
logHelper.info("Initialization Complete");
}

View file

@ -0,0 +1,22 @@
package techreborn.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.BaseTileBlock;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.tiles.TileCable;
public class BlockCable extends BaseTileBlock {
public BlockCable() {
super(Material.iron);
setUnlocalizedName("techreborn.cable");
setCreativeTab(TechRebornCreativeTabMisc.instance);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileCable();
}
}

View file

@ -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");
}

View file

@ -42,7 +42,15 @@ public abstract class BaseRecipeWrapper<T extends BaseRecipe> extends BlankRecip
for (int oreId : oreIds) {
String oreName = OreDictionary.getOreName(oreId);
List<ItemStack> ores = OreDictionary.getOres(oreName);
itemStackSet.addAll(ores);
for (ItemStack ore : ores) {
if (ore.stackSize != itemStack.stackSize) {
ItemStack oreCopy = ore.copy();
oreCopy.stackSize = itemStack.stackSize;
itemStackSet.add(oreCopy);
} else {
itemStackSet.add(ore);
}
}
}
return new ArrayList<>(itemStackSet);
}

View file

@ -99,6 +99,9 @@ public class ConfigTechReborn {
public static int IronChainsawCharge;
public static int DiamondChainsawCharge;
public static int AdvancedChainsawCharge;
public static int IronJackhammerCharge;
public static int DiamondJackhammerCharge;
public static int SteelJackhammerCharge;
public static int LapotronPackCharge;
public static int LithiumBatpackCharge;
public static int LapotronicOrbMaxCharge;
@ -114,6 +117,9 @@ public class ConfigTechReborn {
public static int IronChainsawTier;
public static int DiamondChainsawTier;
public static int AdvancedChainsawTier;
public static int IronJackhammerTier;
public static int DiamondJackhammerTier;
public static int SteelJackhammerTier;
public static int LapotronPackTier;
public static int LapotronicOrbTier;
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")
.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
.get(CATEGORY_POWER, "LapotronPack MaxCharge", 100000000, "Set the max charge for the LapotronPack")
.getInt();
@ -468,6 +486,15 @@ public class ConfigTechReborn {
AdvancedChainsawTier = config.get(CATEGORY_POWER, "AdvancedChainsaw Tier", 2, "Set the Tier of the advanced chainsaw")
.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")
.getInt();

View file

@ -8,28 +8,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import reborncore.common.tile.TileMachineBase;
import techreborn.Core;
import techreborn.blocks.BlockChunkLoader;
import techreborn.blocks.BlockComputerCube;
import techreborn.blocks.BlockDigitalChest;
import techreborn.blocks.BlockElectricCraftingTable;
import techreborn.blocks.BlockFusionCoil;
import techreborn.blocks.BlockFusionControlComputer;
import techreborn.blocks.BlockHighlyAdvancedMachine;
import techreborn.blocks.BlockIronFence;
import techreborn.blocks.BlockMachineCasing;
import techreborn.blocks.BlockMachineFrame;
import techreborn.blocks.BlockOre;
import techreborn.blocks.BlockOre2;
import techreborn.blocks.BlockPlayerDetector;
import techreborn.blocks.BlockQuantumChest;
import techreborn.blocks.BlockQuantumTank;
import techreborn.blocks.BlockRubberLeaves;
import techreborn.blocks.BlockRubberLog;
import techreborn.blocks.BlockRubberPlank;
import techreborn.blocks.BlockRubberSapling;
import techreborn.blocks.BlockStorage;
import techreborn.blocks.BlockStorage2;
import techreborn.blocks.BlockSupercondensator;
import techreborn.blocks.*;
import techreborn.blocks.generator.BlockDieselGenerator;
import techreborn.blocks.generator.BlockDragonEggSiphoner;
import techreborn.blocks.generator.BlockGasTurbine;
@ -79,28 +58,7 @@ import techreborn.itemblocks.ItemBlockQuantumTank;
import techreborn.itemblocks.ItemBlockRubberSapling;
import techreborn.itemblocks.ItemBlockStorage;
import techreborn.itemblocks.ItemBlockStorage2;
import techreborn.tiles.TileAesu;
import techreborn.tiles.TileAlloyFurnace;
import techreborn.tiles.TileAlloySmelter;
import techreborn.tiles.TileAssemblingMachine;
import techreborn.tiles.TileBlastFurnace;
import techreborn.tiles.TileCentrifuge;
import techreborn.tiles.TileChargeBench;
import techreborn.tiles.TileChemicalReactor;
import techreborn.tiles.TileChunkLoader;
import techreborn.tiles.TileDigitalChest;
import techreborn.tiles.TileImplosionCompressor;
import techreborn.tiles.TileIndustrialElectrolyzer;
import techreborn.tiles.TileIndustrialGrinder;
import techreborn.tiles.TileIndustrialSawmill;
import techreborn.tiles.TileMachineCasing;
import techreborn.tiles.TileMatterFabricator;
import techreborn.tiles.TilePlayerDectector;
import techreborn.tiles.TileQuantumChest;
import techreborn.tiles.TileQuantumTank;
import techreborn.tiles.TileRollingMachine;
import techreborn.tiles.TileThermalGenerator;
import techreborn.tiles.TileVacuumFreezer;
import techreborn.tiles.*;
import techreborn.tiles.fusionReactor.TileEntityFusionController;
import techreborn.tiles.generator.TileDieselGenerator;
import techreborn.tiles.generator.TileDragonEggSiphoner;
@ -183,6 +141,7 @@ public class ModBlocks {
public static Block rubberPlanks;
public static Block ironFence;
public static Block cable;
public static void init() {
thermalGenerator = new BlockThermalGenerator();
@ -403,6 +362,10 @@ public class ModBlocks {
ironFence = new BlockIronFence();
GameRegistry.registerBlock(ironFence, "ironFence");
cable = new BlockCable();
GameRegistry.registerBlock(cable, "cable");
GameRegistry.registerTileEntity(TileCable.class, "tilecable");
registerOreDict();
Core.logHelper.info("TechReborns Blocks Loaded");
}

View file

@ -12,21 +12,7 @@ import reborncore.common.powerSystem.PoweredItem;
import reborncore.common.util.BucketHandler;
import techreborn.Core;
import techreborn.events.OreUnifier;
import techreborn.items.ItemCells;
import techreborn.items.ItemCrushedOre;
import techreborn.items.ItemDusts;
import techreborn.items.ItemDustsSmall;
import techreborn.items.ItemGems;
import techreborn.items.ItemIngots;
import techreborn.items.ItemLapotronicOrb;
import techreborn.items.ItemLithiumBattery;
import techreborn.items.ItemMissingRecipe;
import techreborn.items.ItemNuggets;
import techreborn.items.ItemParts;
import techreborn.items.ItemPlates;
import techreborn.items.ItemPurifiedCrushedOre;
import techreborn.items.ItemReBattery;
import techreborn.items.ItemUUmatter;
import techreborn.items.*;
import techreborn.items.armor.ItemLapotronPack;
import techreborn.items.armor.ItemLithiumBatpack;
import techreborn.items.tools.*;
@ -93,8 +79,12 @@ public class ModItems {
public static Item ironChainsaw;
public static Item diamondChainsaw;
public static Item advancedChainsaw;
public static Item ironJackhammer;
public static Item steelJackhammer;
public static Item diamondJackhammer;
public static Item hammer;
public static Item wrench;
public static Item cables;
public static Item upgrades;
@ -149,20 +139,27 @@ 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");
advancedChainsaw = PoweredItem.createItem(ItemAdvancedChainsaw.class);
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);
GameRegistry.registerItem(hammer, "hammer");
@ -317,6 +314,9 @@ public class ModItems {
missingRecipe = new ItemMissingRecipe().setUnlocalizedName("missingRecipe");
GameRegistry.registerItem(missingRecipe, "mssingRecipe");
cables = new ItemCables();
GameRegistry.registerItem(cables, "cables");
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);

View file

@ -0,0 +1,69 @@
package techreborn.items;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import techreborn.client.TechRebornCreativeTab;
import techreborn.init.ModItems;
import techreborn.lib.ModInfo;
import java.security.InvalidParameterException;
import java.util.List;
/**
* Created by Mark on 27/02/2016.
*/
public class ItemCables extends ItemTextureBase {
public static ItemStack getCableByName(String name, int count) {
for (int i = 0; i < types.length; i++) {
if (types[i].equalsIgnoreCase(name)) {
return new ItemStack(ModItems.cables, count, i);
}
}
throw new InvalidParameterException("The cabel " + name + " could not be found.");
}
public static ItemStack getCableByName(String name) {
return getCableByName(name, 1);
}
public static final String[] types = new String[]
{"copper", "gold"};
public ItemCables() {
setCreativeTab(TechRebornCreativeTab.instance);
setHasSubtypes(true);
setUnlocalizedName("techreborn.cable");
}
@Override
// gets Unlocalized Name depending on meta data
public String getUnlocalizedName(ItemStack itemStack) {
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= types.length) {
meta = 0;
}
return super.getUnlocalizedName() + "." + types[meta];
}
// Adds Dusts SubItems To Creative Tab
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
for (int meta = 0; meta < types.length; ++meta) {
list.add(new ItemStack(item, 1, meta));
}
}
@Override
public String getTextureName(int damage) {
return ModInfo.MOD_ID + ":items/cables/" + types[damage];
}
@Override
public int getMaxMeta() {
return types.length;
}
}

View file

@ -1,50 +1,15 @@
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);
this.cost = 250;
}
@Override
@ -52,85 +17,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";

View file

@ -1,50 +1,15 @@
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);
this.cost = 250;
}
@Override
@ -52,85 +17,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";

View file

@ -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,41 +26,48 @@ 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) {
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_axe.canHarvestBlock(block, stack);
public float getDigSpeed(ItemStack stack, IBlockState state) {
if (!PoweredItem.canUseEnergy(cost, stack)) {
return unpoweredSpeed;
}
@Override
public float getDigSpeed(ItemStack stack, IBlockState state) {
if(!PoweredItem.canUseEnergy(cost, stack)){
return 2.0F;
if (OreDictUtils.isOre(state, "treeLeaves") && PoweredItem.canUseEnergy(cost, stack)) {
return 40F;
}
if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F) {
return efficiencyOnProperMaterial;
} else {
@ -64,13 +75,11 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
}
}
@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);
@ -81,7 +90,6 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
return false;
}
@Override
public double getMaxPower(ItemStack stack) {
return maxCharge;
@ -107,8 +115,7 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
return tier;
}
@SuppressWarnings(
{"rawtypes", "unchecked"})
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
ItemStack itemStack = new ItemStack(this, 1);
@ -133,7 +140,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

View file

@ -1,50 +1,15 @@
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);
this.cost = 250;
}
@Override
@ -52,85 +17,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";

View file

@ -1,50 +1,15 @@
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);
this.cost = 250;
}
@Override
@ -52,85 +17,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";

View file

@ -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;
}
}

View file

@ -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,40 +25,41 @@ 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 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
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 2.0F;
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;
@ -64,13 +68,11 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
}
}
@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);
@ -81,7 +83,6 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
return false;
}
@Override
public double getMaxPower(ItemStack stack) {
return maxCharge;
@ -107,8 +108,7 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
return tier;
}
@SuppressWarnings(
{"rawtypes", "unchecked"})
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
ItemStack itemStack = new ItemStack(this, 1);
@ -133,7 +133,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

View file

@ -1,8 +1,15 @@
package techreborn.items.tools;
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import techreborn.items.ItemPlates;
import techreborn.items.ItemTR;
public class ItemHammer extends ItemTR implements ITexturedItem {
@ -13,6 +20,12 @@ public class ItemHammer extends ItemTR implements ITexturedItem {
setMaxDamage(MaxDamage);
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
world.playSoundAtEntity(player, "techreborn:block_dismantle", 0.8F, 0.4F);
return true;
}
@Override
public Item setUnlocalizedName(String par1Str) {
iconName = par1Str;

View file

@ -0,0 +1,29 @@
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);
this.cost = 50;
}
@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;
}
}

View file

@ -0,0 +1,29 @@
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);
this.cost = 50;
}
@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;
}
}

View 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;
}
}

View 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;
}
}

View file

@ -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;
}
}

View file

@ -3,6 +3,7 @@ package techreborn.items.tools;
import ic2.api.tile.IWrenchable;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.BlockStaticLiquid;
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@ -16,6 +17,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidBase;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.items.ItemTR;
import techreborn.items.ItemTextureBase;
import java.util.ArrayList;
@ -25,11 +27,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");
}

View file

@ -0,0 +1,17 @@
package techreborn.powernet;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public interface IPowerCableContainer {
World getWorld();
BlockPos getPos();
boolean canConnectTo(EnumFacing facing);
PowerCable getPowerCable();
}

View file

@ -0,0 +1,67 @@
package techreborn.powernet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import reborncore.api.power.IEnergyInterfaceTile;
import java.util.ArrayList;
import java.util.List;
public class PowerCable {
List<PowerNode> nodes = new ArrayList<PowerNode>();
IPowerCableContainer container;
PowerNetwork network;
public PowerCable(IPowerCableContainer container) {
this.container = container;
}
public void blockUpdate(){
checkNodes();
}
public void checkNodes(){
nodes.clear();
for(EnumFacing dir : EnumFacing.VALUES){
if(!container.canConnectTo(dir)){
continue;
}
BlockPos blockPos = container.getPos().offset(dir);
if(container.getWorld().isBlockLoaded(blockPos)){
TileEntity tileEntity = container.getWorld().getTileEntity(blockPos);
if(network != null){
if(tileEntity instanceof IPowerCableContainer){
IPowerCableContainer powerCableContainer = (IPowerCableContainer) tileEntity;
if(powerCableContainer.getPowerCable() != null && powerCableContainer.getPowerCable().network != network){
network.merge(powerCableContainer.getPowerCable().network);
}
}
}
if(!(tileEntity instanceof IEnergyInterfaceTile)){
continue;
}
IEnergyInterfaceTile energyInterfaceTile = (IEnergyInterfaceTile) tileEntity;
PowerNode node = new PowerNode(blockPos, tileEntity, dir);
if(energyInterfaceTile.canAcceptEnergy(dir)){
// This tile will be classed as a receiver
node.type = PowerType.RECEIVER;
} else if(energyInterfaceTile.canProvideEnergy(dir)){
//This tile can then provide
node.type = PowerType.COLLECTOR;
}
}
}
}
public PowerNetwork getNetwork() {
return network;
}
public void setNetwork(PowerNetwork network) {
this.network = network;
}
}

View file

@ -0,0 +1,24 @@
package techreborn.powernet;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
public class PowerEvent extends Event {
World world;
public PowerEvent(World world) {
this.world = world;
}
public PowerEvent() {
}
@SubscribeEvent
public void worldTick(TickEvent.WorldTickEvent event){
MinecraftForge.EVENT_BUS.post(new PowerEvent(event.world));
}
}

View file

@ -0,0 +1,75 @@
package techreborn.powernet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import reborncore.api.power.IEnergyInterfaceTile;
import java.util.ArrayList;
import java.util.List;
public class PowerNetwork {
List<PowerCable> cables = new ArrayList<PowerCable>();
int networkPower;
double maxTransfer = 128;
public PowerNetwork() {
MinecraftForge.EVENT_BUS.register(this);
}
public PowerNetwork merge(PowerNetwork network){
cables.addAll(network.cables);
for(PowerCable cable : network.cables){
cable.setNetwork(this);
}
return this;
}
public void addCable(PowerCable cable){
cables.add(cable);
cable.setNetwork(this);
}
public void removeCable(PowerCable cable){
cables.remove(cable);
cable.setNetwork(null);
}
@SubscribeEvent
public void tick(PowerEvent event){
World world = event.world;
for(PowerCable cable : cables){
if(cable.container.getWorld() == world){
for(PowerNode node : cable.nodes){
TileEntity tileEntity = node.nodeTile;
if(!(tileEntity instanceof IEnergyInterfaceTile)){
continue;
}
IEnergyInterfaceTile iEnergyInterfaceTile = (IEnergyInterfaceTile) tileEntity;
switch (node.type){
case COLLECTOR:
if(iEnergyInterfaceTile.canProvideEnergy(node.facingFromCable)){
double transfur = Math.min(maxTransfer, Math.min(iEnergyInterfaceTile.getMaxOutput(), iEnergyInterfaceTile.getEnergy()));
networkPower += iEnergyInterfaceTile.useEnergy(transfur);
}
break;
case RECEIVER:
if(iEnergyInterfaceTile.canAcceptEnergy(node.facingFromCable)){
double transfur = Math.min(maxTransfer, Math.min(iEnergyInterfaceTile.getMaxOutput(), iEnergyInterfaceTile.getEnergy()));
networkPower -= iEnergyInterfaceTile.addEnergy(transfur);
}
break;
}
}
}
}
System.out.println(networkPower);
}
}

View file

@ -0,0 +1,23 @@
package techreborn.powernet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
public class PowerNode {
BlockPos nodePos;
TileEntity nodeTile;
PowerType type = PowerType.UNKNOWN;
EnumFacing facingFromCable;
public PowerNode(BlockPos nodePos, TileEntity nodeTile, EnumFacing facingFromCable) {
this.nodePos = nodePos;
this.nodeTile = nodeTile;
this.facingFromCable = facingFromCable;
}
}

View file

@ -0,0 +1,8 @@
package techreborn.powernet;
public enum PowerType {
COLLECTOR,
RECEIVER,
UNKNOWN
}

View file

@ -0,0 +1,48 @@
package techreborn.tiles;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import techreborn.powernet.IPowerCableContainer;
import techreborn.powernet.PowerCable;
import techreborn.powernet.PowerEvent;
import techreborn.powernet.PowerNetwork;
public class TileCable extends TileEntity implements IPowerCableContainer, ITickable{
PowerCable cable = null;
@Override
public boolean canConnectTo(EnumFacing facing) {
return true;
}
@Override
public PowerCable getPowerCable() {
return cable;
}
@Override
public void update() {
if(cable == null){
createCable();
} else {
cable.checkNodes();
}
}
public void createCable(){
if(cable != null){
cable.getNetwork().removeCable(cable);
cable = null;
}
PowerNetwork network = new PowerNetwork();
cable = new PowerCable(this);
cable.setNetwork(network);
network.addCable(cable);
cable.checkNodes();
}
}

View file

@ -12,7 +12,7 @@ public class TileWindMill extends TilePowerAcceptor {
super(2);
}
int basePower = 10;
int basePower = 4;
@Override
public void updateEntity() {
@ -22,7 +22,7 @@ public class TileWindMill extends TilePowerAcceptor {
if(worldObj.isThundering()){
actualPower *= 1.25;
}
addEnergy(actualPower * (pos.getY() - 64)); //Value taken from http://wiki.industrial-craft.net/?title=Wind_Mill Not worth making more complicated
addEnergy(actualPower); //Value taken from http://wiki.industrial-craft.net/?title=Wind_Mill Not worth making more complicated
}
}

View file

@ -0,0 +1,39 @@
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) {
if (stack != null && stack.getItem() != null && oreName != null) {
int id = OreDictionary.getOreID(oreName);
int[] ids = OreDictionary.getOreIDs(stack);
for (int i : ids) {
if (id == i) {
return true;
}
}
}
return false;
}
}

View file

@ -610,6 +610,9 @@ item.techreborn.advancedChainsaw.name=Advanced Chainsaw
item.techreborn.lapotronicorb.name=Lapotronic Energy Orb
item.techreborn.cloakingdevice.name=Cloaking Device
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
item.bucketberylium.name=Berylium Bucket

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 893 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 437 B

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 437 B

After

Width:  |  Height:  |  Size: 1,018 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,018 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,018 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 844 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 570 B

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.

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 432 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: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 B

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B