diff --git a/build.gradle b/build.gradle index 03fe41a95..afe56bbc7 100644 --- a/build.gradle +++ b/build.gradle @@ -127,7 +127,7 @@ dependencies { // shade 'IC2-Classic-API-STANDALONE:IC2-Classic-API-STANDALONE:1.1.0.19-5:api' deobfCompile 'RebornCore:RebornCore-1.8.9:1.4.4.+:universal' deobfCompile "mezz.jei:jei_1.8.9:2.27.+" - deobfCompile 'MCMultiPart:MCMultiPart:1.0.6:universal' + deobfCompile 'MCMultiPart:MCMultiPart:1.0.8:universal' println("Downloading dependencies that have no maven :/") //This is done becuase diff --git a/src/main/java/techreborn/Core.java b/src/main/java/techreborn/Core.java index 415a6ef53..2e2eb55ab 100644 --- a/src/main/java/techreborn/Core.java +++ b/src/main/java/techreborn/Core.java @@ -102,6 +102,10 @@ public class Core { ModLoot.init(); //Multiparts ModParts.init(); + // Compat + for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { + compatModule.init(event); + } // Recipes StopWatch watch = new StopWatch(); watch.start(); @@ -110,10 +114,6 @@ public class Core { watch.stop(); //Client only init, needs to be done before parts system proxy.init(); - // Compat - for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { - compatModule.init(event); - } // WorldGen GameRegistry.registerWorldGenerator(new TROreGen(), 0); GameRegistry.registerWorldGenerator(new TreeGenerator(), 0); diff --git a/src/main/java/techreborn/blocks/BlockFusionControlComputer.java b/src/main/java/techreborn/blocks/BlockFusionControlComputer.java index 494752443..fc962a748 100644 --- a/src/main/java/techreborn/blocks/BlockFusionControlComputer.java +++ b/src/main/java/techreborn/blocks/BlockFusionControlComputer.java @@ -1,6 +1,7 @@ package techreborn.blocks; import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; @@ -11,11 +12,10 @@ import techreborn.Core; import techreborn.client.GuiHandler; import techreborn.client.TechRebornCreativeTab; import techreborn.tiles.fusionReactor.TileEntityFusionController; +import techreborn.utils.damageSources.FusionDamageSource; public class BlockFusionControlComputer extends BlockMachineBase implements IAdvancedRotationTexture { - - public BlockFusionControlComputer(Material material) { super(); setUnlocalizedName("techreborn.fusioncontrolcomputer"); @@ -33,6 +33,15 @@ public class BlockFusionControlComputer extends BlockMachineBase implements IAdv return true; } + @Override + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) { + super.onEntityCollidedWithBlock(worldIn, pos, entityIn); + if(worldIn.getTileEntity(pos) instanceof TileEntityFusionController){ + if(((TileEntityFusionController) worldIn.getTileEntity(pos)).crafingTickTime != 0 && ((TileEntityFusionController) worldIn.getTileEntity(pos)).checkCoils()){ + entityIn.attackEntityFrom(new FusionDamageSource(), 200F); + } + } + } @Override public TileEntity createNewTileEntity(World world, int meta) { diff --git a/src/main/java/techreborn/blocks/BlockIronFurnace.java b/src/main/java/techreborn/blocks/BlockIronFurnace.java new file mode 100644 index 000000000..92eef07c3 --- /dev/null +++ b/src/main/java/techreborn/blocks/BlockIronFurnace.java @@ -0,0 +1,75 @@ +package techreborn.blocks; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import reborncore.common.blocks.BlockMachineBase; +import reborncore.common.blocks.IRotationTexture; +import techreborn.Core; +import techreborn.client.GuiHandler; +import techreborn.client.TechRebornCreativeTab; +import techreborn.init.ModBlocks; +import techreborn.tiles.TileAlloyFurnace; +import techreborn.tiles.TileIronFurnace; + +public class BlockIronFurnace extends BlockMachineBase implements IRotationTexture { + + public BlockIronFurnace() { + super(); + setUnlocalizedName("techreborn.ironfurnace"); + setCreativeTab(TechRebornCreativeTab.instance); + } + + @Override + public TileEntity createNewTileEntity(World world, int p_149915_2_) { + return new TileIronFurnace(); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + if (!player.isSneaking()) + player.openGui(Core.INSTANCE, GuiHandler.ironFurnace, world, x, y, z); + return true; + } + + @Override + public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + List items = new ArrayList(); + items.add(new ItemStack(this)); + return items; + } + + private final String prefix = "techreborn:blocks/machine/"; + + @Override + public String getFrontOff() { + return prefix + "alloy_furnace_front_off"; + } + + @Override + public String getFrontOn() { + return prefix + "alloy_furnace_front_on"; + } + + @Override + public String getSide() { + return prefix + "alloy_furnace_side"; + } + + @Override + public String getTop() { + return prefix + "alloy_furnace_top"; + } + + @Override + public String getBottom() { + return prefix + "machine_bottom"; + } +} diff --git a/src/main/java/techreborn/blocks/BlockReinforcedGlass.java b/src/main/java/techreborn/blocks/BlockReinforcedGlass.java new file mode 100644 index 000000000..c9255c3c9 --- /dev/null +++ b/src/main/java/techreborn/blocks/BlockReinforcedGlass.java @@ -0,0 +1,38 @@ +package techreborn.blocks; + +import me.modmuss50.jsonDestroyer.api.ITexturedBlock; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumFacing; +import reborncore.common.BaseBlock; +import reborncore.common.blocks.BlockMachineBase; +import techreborn.client.TechRebornCreativeTabMisc; + +public class BlockReinforcedGlass extends BaseBlock implements ITexturedBlock { + + public BlockReinforcedGlass(Material materialIn) { + super(materialIn); + setUnlocalizedName("techreborn.reinforcedglass"); + setCreativeTab(TechRebornCreativeTabMisc.instance); + setHardness(4.0F); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + private final String prefix = "techreborn:blocks/machine/"; + + @Override + public int amountOfStates() { + return 1; + } + + @Override + public String getTextureNameFromState(IBlockState arg0, EnumFacing arg1) { + return prefix + "reinforcedglass"; + } + +} diff --git a/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java b/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java index bc1588ba7..a3cf87dc5 100644 --- a/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java +++ b/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java @@ -1,8 +1,15 @@ package techreborn.blocks.machine; +import java.util.ArrayList; +import java.util.List; + import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.blocks.IRotationTexture; @@ -13,7 +20,6 @@ import techreborn.tiles.TileAlloyFurnace; public class BlockAlloyFurnace extends BlockMachineBase implements IRotationTexture { - public BlockAlloyFurnace(Material material) { super(); setUnlocalizedName("techreborn.alloyfurnace"); @@ -26,13 +32,18 @@ public class BlockAlloyFurnace extends BlockMachineBase implements IRotationText } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.alloyFurnaceID, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.alloyFurnaceID, world, x, y, z); return true; } + + @Override + public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + List items = new ArrayList(); + items.add(new ItemStack(this)); + return items; + } private final String prefix = "techreborn:blocks/machine/"; diff --git a/src/main/java/techreborn/blocks/machine/BlockAlloySmelter.java b/src/main/java/techreborn/blocks/machine/BlockAlloySmelter.java index 8bd98ff1b..46cf1764c 100644 --- a/src/main/java/techreborn/blocks/machine/BlockAlloySmelter.java +++ b/src/main/java/techreborn/blocks/machine/BlockAlloySmelter.java @@ -13,7 +13,6 @@ import techreborn.tiles.TileAlloySmelter; public class BlockAlloySmelter extends BlockMachineBase implements IRotationTexture { - public BlockAlloySmelter(Material material) { super(); setUnlocalizedName("techreborn.alloysmelter"); @@ -26,11 +25,9 @@ public class BlockAlloySmelter extends BlockMachineBase implements IRotationText } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.alloySmelterID, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.alloySmelterID, world, x, y, z); return true; } @@ -60,5 +57,4 @@ public class BlockAlloySmelter extends BlockMachineBase implements IRotationText public String getBottom() { return prefix + "machine_bottom"; } - } diff --git a/src/main/java/techreborn/blocks/machine/BlockAssemblingMachine.java b/src/main/java/techreborn/blocks/machine/BlockAssemblingMachine.java index f5b9f20d6..477eb1049 100644 --- a/src/main/java/techreborn/blocks/machine/BlockAssemblingMachine.java +++ b/src/main/java/techreborn/blocks/machine/BlockAssemblingMachine.java @@ -13,7 +13,6 @@ import techreborn.tiles.TileAssemblingMachine; public class BlockAssemblingMachine extends BlockMachineBase implements IRotationTexture { - public BlockAssemblingMachine(Material material) { super(); setUnlocalizedName("techreborn.assemblingmachine"); @@ -27,11 +26,9 @@ public class BlockAssemblingMachine extends BlockMachineBase implements IRotatio } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.assemblingmachineID, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.assemblingmachineID, world, x, y, z); return true; } @@ -61,5 +58,4 @@ public class BlockAssemblingMachine extends BlockMachineBase implements IRotatio public String getBottom() { return prefix + "assembling_machine_top"; } - } diff --git a/src/main/java/techreborn/blocks/machine/BlockBlastFurnace.java b/src/main/java/techreborn/blocks/machine/BlockBlastFurnace.java index 2e7ee3285..a5c5541d1 100644 --- a/src/main/java/techreborn/blocks/machine/BlockBlastFurnace.java +++ b/src/main/java/techreborn/blocks/machine/BlockBlastFurnace.java @@ -13,7 +13,6 @@ import techreborn.tiles.TileBlastFurnace; public class BlockBlastFurnace extends BlockMachineBase implements IRotationTexture { - public BlockBlastFurnace(Material material) { super(); setUnlocalizedName("techreborn.blastfurnace"); @@ -26,16 +25,12 @@ public class BlockBlastFurnace extends BlockMachineBase implements IRotationText } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, world, x, y, z); return true; } - - @Override public boolean isAdvanced() { return true; @@ -67,5 +62,4 @@ public class BlockBlastFurnace extends BlockMachineBase implements IRotationText public String getBottom() { return prefix + "assembling_machine_top"; } - } diff --git a/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java b/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java index 303c52c6b..60d17eaa7 100644 --- a/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java +++ b/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java @@ -12,8 +12,6 @@ import techreborn.tiles.TileCentrifuge; public class BlockCentrifuge extends BlockMachineBase implements IRotationTexture { - - public BlockCentrifuge() { super(); setUnlocalizedName("techreborn.centrifuge"); @@ -26,11 +24,10 @@ public class BlockCentrifuge extends BlockMachineBase implements IRotationTextur } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.centrifugeID, world, x, y, - z); + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + if (!player.isSneaking()) { + player.openGui(Core.INSTANCE, GuiHandler.centrifugeID, world, x, y, z); + } return true; } @@ -44,11 +41,11 @@ public class BlockCentrifuge extends BlockMachineBase implements IRotationTextur @Override public String getFrontOn() { return prefix + "industrial_centrifuge_side_on"; - } + } @Override public String getSide() { - return prefix + "advanced_machine_side"; + return getFrontOff(); } @Override @@ -60,5 +57,4 @@ public class BlockCentrifuge extends BlockMachineBase implements IRotationTextur public String getBottom() { return prefix + "industrial_centrifuge_bottom"; } - } diff --git a/src/main/java/techreborn/blocks/machine/BlockChargeBench.java b/src/main/java/techreborn/blocks/machine/BlockChargeBench.java index 01f1a1206..4d3d9de09 100644 --- a/src/main/java/techreborn/blocks/machine/BlockChargeBench.java +++ b/src/main/java/techreborn/blocks/machine/BlockChargeBench.java @@ -13,7 +13,6 @@ import techreborn.tiles.TileChargeBench; public class BlockChargeBench extends BlockMachineBase implements IRotationTexture { - public BlockChargeBench(Material material) { super(); setUnlocalizedName("techreborn.chargebench"); @@ -28,8 +27,7 @@ public class BlockChargeBench extends BlockMachineBase implements IRotationTextu @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.chargeBench, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.chargeBench, world, x, y, z); return true; } @@ -59,5 +57,4 @@ public class BlockChargeBench extends BlockMachineBase implements IRotationTextu public String getBottom() { return prefix + "chargeBench_side"; } - } diff --git a/src/main/java/techreborn/blocks/machine/BlockChemicalReactor.java b/src/main/java/techreborn/blocks/machine/BlockChemicalReactor.java index c1f4119db..c9f409f12 100644 --- a/src/main/java/techreborn/blocks/machine/BlockChemicalReactor.java +++ b/src/main/java/techreborn/blocks/machine/BlockChemicalReactor.java @@ -13,8 +13,6 @@ import techreborn.tiles.TileChemicalReactor; public class BlockChemicalReactor extends BlockMachineBase implements IRotationTexture { - - public BlockChemicalReactor(Material material) { super(); setUnlocalizedName("techreborn.chemicalreactor"); @@ -30,8 +28,7 @@ public class BlockChemicalReactor extends BlockMachineBase implements IRotationT public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.chemicalReactorID, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.chemicalReactorID, world, x, y, z); return true; } @@ -61,5 +58,4 @@ public class BlockChemicalReactor extends BlockMachineBase implements IRotationT public String getBottom() { return prefix + "industrial_centrifuge_bottom"; } - } diff --git a/src/main/java/techreborn/blocks/machine/BlockImplosionCompressor.java b/src/main/java/techreborn/blocks/machine/BlockImplosionCompressor.java index bad086f90..0567bcc39 100644 --- a/src/main/java/techreborn/blocks/machine/BlockImplosionCompressor.java +++ b/src/main/java/techreborn/blocks/machine/BlockImplosionCompressor.java @@ -13,7 +13,6 @@ import techreborn.tiles.TileImplosionCompressor; public class BlockImplosionCompressor extends BlockMachineBase implements IRotationTexture { - public BlockImplosionCompressor(Material material) { super(); setUnlocalizedName("techreborn.implosioncompressor"); @@ -26,11 +25,9 @@ public class BlockImplosionCompressor extends BlockMachineBase implements IRotat } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.implosionCompresserID, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.implosionCompresserID, world, x, y, z); return true; } @@ -60,5 +57,4 @@ public class BlockImplosionCompressor extends BlockMachineBase implements IRotat public String getBottom() { return prefix + "implosion_compressor_bottom"; } - } diff --git a/src/main/java/techreborn/blocks/machine/BlockIndustrialElectrolyzer.java b/src/main/java/techreborn/blocks/machine/BlockIndustrialElectrolyzer.java index 091ffd5d8..fa80ff122 100644 --- a/src/main/java/techreborn/blocks/machine/BlockIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/blocks/machine/BlockIndustrialElectrolyzer.java @@ -13,7 +13,6 @@ import techreborn.tiles.TileIndustrialElectrolyzer; public class BlockIndustrialElectrolyzer extends BlockMachineBase implements IRotationTexture { - public BlockIndustrialElectrolyzer(Material material) { super(); setUnlocalizedName("techreborn.industrialelectrolyzer"); @@ -26,11 +25,9 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase implements IRo } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.industrialElectrolyzerID, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.industrialElectrolyzerID, world, x, y, z); return true; } @@ -60,5 +57,4 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase implements IRo public String getBottom() { return prefix + "machine_bottom"; } - } diff --git a/src/main/java/techreborn/blocks/machine/BlockIndustrialGrinder.java b/src/main/java/techreborn/blocks/machine/BlockIndustrialGrinder.java index 22e6bedd1..6f9dd0610 100644 --- a/src/main/java/techreborn/blocks/machine/BlockIndustrialGrinder.java +++ b/src/main/java/techreborn/blocks/machine/BlockIndustrialGrinder.java @@ -14,7 +14,6 @@ import techreborn.tiles.TileIndustrialGrinder; public class BlockIndustrialGrinder extends BlockMachineBase implements IRotationTexture { - public BlockIndustrialGrinder(Material material) { super(); setUnlocalizedName("techreborn.industrialgrinder"); @@ -62,5 +61,4 @@ public class BlockIndustrialGrinder extends BlockMachineBase implements IRotatio public String getBottom() { return prefix + "industrial_centrifuge_bottom"; } - } diff --git a/src/main/java/techreborn/blocks/machine/BlockIndustrialSawmill.java b/src/main/java/techreborn/blocks/machine/BlockIndustrialSawmill.java index b7245743d..2d1f09be7 100644 --- a/src/main/java/techreborn/blocks/machine/BlockIndustrialSawmill.java +++ b/src/main/java/techreborn/blocks/machine/BlockIndustrialSawmill.java @@ -26,14 +26,12 @@ public class BlockIndustrialSawmill extends BlockMachineBase implements IRotatio } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(fillBlockWithFluid(world, new BlockPos(x, y, z), player)){ return true; } if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.sawMillID, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.sawMillID, world, x, y, z); return true; } @@ -63,6 +61,4 @@ public class BlockIndustrialSawmill extends BlockMachineBase implements IRotatio public String getBottom() { return prefix + "advanced_machine_side"; } - - } diff --git a/src/main/java/techreborn/blocks/machine/BlockMatterFabricator.java b/src/main/java/techreborn/blocks/machine/BlockMatterFabricator.java index 07baecbca..744315cfd 100644 --- a/src/main/java/techreborn/blocks/machine/BlockMatterFabricator.java +++ b/src/main/java/techreborn/blocks/machine/BlockMatterFabricator.java @@ -13,7 +13,6 @@ import techreborn.tiles.TileMatterFabricator; public class BlockMatterFabricator extends BlockMachineBase implements IAdvancedRotationTexture { - public BlockMatterFabricator(Material material) { super(); setUnlocalizedName("techreborn.matterfabricator"); @@ -26,11 +25,9 @@ public class BlockMatterFabricator extends BlockMachineBase implements IAdvanced } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.matterfabID, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.matterfabID, world, x, y, z); return true; } diff --git a/src/main/java/techreborn/blocks/machine/BlockRollingMachine.java b/src/main/java/techreborn/blocks/machine/BlockRollingMachine.java index 2f3dd46e4..9f186fb5e 100644 --- a/src/main/java/techreborn/blocks/machine/BlockRollingMachine.java +++ b/src/main/java/techreborn/blocks/machine/BlockRollingMachine.java @@ -13,8 +13,6 @@ import techreborn.tiles.TileRollingMachine; public class BlockRollingMachine extends BlockMachineBase implements IAdvancedRotationTexture { - - public BlockRollingMachine(Material material) { super(); setUnlocalizedName("techreborn.rollingmachine"); @@ -27,11 +25,9 @@ public class BlockRollingMachine extends BlockMachineBase implements IAdvancedRo } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world, - x, y, z); + player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world, x, y, z); return true; } diff --git a/src/main/java/techreborn/blocks/machine/BlockVacuumFreezer.java b/src/main/java/techreborn/blocks/machine/BlockVacuumFreezer.java index be0213265..0dba4d314 100644 --- a/src/main/java/techreborn/blocks/machine/BlockVacuumFreezer.java +++ b/src/main/java/techreborn/blocks/machine/BlockVacuumFreezer.java @@ -14,29 +14,23 @@ import techreborn.tiles.TileVacuumFreezer; public class BlockVacuumFreezer extends BlockMachineBase implements IAdvancedRotationTexture{ - public BlockVacuumFreezer(Material material) { super(); setUnlocalizedName("techreborn.vacuumfreezer"); setCreativeTab(TechRebornCreativeTab.instance); } - @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileVacuumFreezer(); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { TileVacuumFreezer tileVacuumFreezer = (TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)); tileVacuumFreezer.multiBlockStatus = tileVacuumFreezer.checkMachine() ? 1 : 0; - if (!player.isSneaking()) - player.openGui(Core.INSTANCE, GuiHandler.vacuumFreezerID, world, x, y, - z); + player.openGui(Core.INSTANCE, GuiHandler.vacuumFreezerID, world, x, y, z); return true; } diff --git a/src/main/java/techreborn/client/GuiHandler.java b/src/main/java/techreborn/client/GuiHandler.java index b303bcee2..1a5ed1f62 100644 --- a/src/main/java/techreborn/client/GuiHandler.java +++ b/src/main/java/techreborn/client/GuiHandler.java @@ -28,6 +28,7 @@ import techreborn.client.container.ContainerImplosionCompressor; import techreborn.client.container.ContainerIndustrialElectrolyzer; import techreborn.client.container.ContainerIndustrialGrinder; import techreborn.client.container.ContainerIndustrialSawmill; +import techreborn.client.container.ContainerIronFurnace; import techreborn.client.container.ContainerLesu; import techreborn.client.container.ContainerMatterFabricator; import techreborn.client.container.ContainerQuantumChest; @@ -60,6 +61,7 @@ import techreborn.client.gui.GuiImplosionCompressor; import techreborn.client.gui.GuiIndustrialElectrolyzer; import techreborn.client.gui.GuiIndustrialGrinder; import techreborn.client.gui.GuiIndustrialSawmill; +import techreborn.client.gui.GuiIronFurnace; import techreborn.client.gui.GuiLesu; import techreborn.client.gui.GuiMatterFabricator; import techreborn.client.gui.GuiQuantumChest; @@ -83,6 +85,7 @@ import techreborn.tiles.TileImplosionCompressor; import techreborn.tiles.TileIndustrialElectrolyzer; import techreborn.tiles.TileIndustrialGrinder; import techreborn.tiles.TileIndustrialSawmill; +import techreborn.tiles.TileIronFurnace; import techreborn.tiles.TileMatterFabricator; import techreborn.tiles.TileQuantumChest; import techreborn.tiles.TileQuantumTank; @@ -136,6 +139,7 @@ public class GuiHandler implements IGuiHandler { public static final int extractorID = 33; public static final int compressorID = 34; public static final int electricFurnaceID = 35; + public static final int ironFurnace = 36; @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { @@ -226,9 +230,9 @@ public class GuiHandler implements IGuiHandler { return new ContainerCompressor((TileCompressor) world.getTileEntity(new BlockPos(x, y, z)), player); }else if (ID == electricFurnaceID) { return new ContainerElectricFurnace((TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)), player); + }else if (ID == ironFurnace) { + return new ContainerIronFurnace((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)), player); } - - return null; } @@ -322,7 +326,10 @@ public class GuiHandler implements IGuiHandler { return new GuiCompressor(player, (TileCompressor) world.getTileEntity(new BlockPos(x, y, z))); }else if (ID == electricFurnaceID) { return new GuiElectricFurnace(player, (TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z))); + }else if (ID == ironFurnace) { + return new GuiIronFurnace(player, (TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z))); } + return null; } } diff --git a/src/main/java/techreborn/client/container/ContainerIronFurnace.java b/src/main/java/techreborn/client/container/ContainerIronFurnace.java new file mode 100644 index 000000000..199a64e41 --- /dev/null +++ b/src/main/java/techreborn/client/container/ContainerIronFurnace.java @@ -0,0 +1,58 @@ +package techreborn.client.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.inventory.SlotFurnaceFuel; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; +import techreborn.tiles.TileIronFurnace; + +public class ContainerIronFurnace extends RebornContainer { + + EntityPlayer player; + + TileIronFurnace tile; + + public int connectionStatus; + + public ContainerIronFurnace(TileIronFurnace tileGrinder, EntityPlayer player) { + super(); + tile = tileGrinder; + this.player = player; + + // input + this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 17)); + this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34)); + //Fuel + this.addSlotToContainer(new SlotFurnaceFuel(tileGrinder.inventory, 2, 56, 53)); + + int i; + + for (i = 0; i < 3; ++i) { + for (int j = 0; j < 9; ++j) { + this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for (i = 0; i < 9; ++i) { + this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, + 142)); + } + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return true; + } + + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(int id, int value) { + if (id == 10) { + this.connectionStatus = value; + } + } +} diff --git a/src/main/java/techreborn/client/gui/GuiCompressor.java b/src/main/java/techreborn/client/gui/GuiCompressor.java index 7ec1b4b9c..2d9dd1414 100644 --- a/src/main/java/techreborn/client/gui/GuiCompressor.java +++ b/src/main/java/techreborn/client/gui/GuiCompressor.java @@ -1,5 +1,7 @@ package techreborn.client.gui; +import org.lwjgl.util.Color; + import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; @@ -35,8 +37,9 @@ public class GuiCompressor extends GuiContainer { int j = 0; j = compressor.getProgressScaled(24); +// System.out.println("" + j); if (j > 0) { - this.drawTexturedModalRect(k + 50, l + 36, 176, 14, j + 1, 16); + this.drawTexturedModalRect(k + 80, l + 35, 176, 14, j + 2, 16); } j = compressor.getEnergyScaled(12); diff --git a/src/main/java/techreborn/client/gui/GuiElectricFurnace.java b/src/main/java/techreborn/client/gui/GuiElectricFurnace.java index aea1a02d8..deeca0488 100644 --- a/src/main/java/techreborn/client/gui/GuiElectricFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiElectricFurnace.java @@ -34,10 +34,10 @@ public class GuiElectricFurnace extends GuiContainer { int j = 0; -// j = furnace.getProgressScaled(24); -// if (j > 0) { -// this.drawTexturedModalRect(k + 50, l + 36, 176, 14, j + 1, 16); -// } + j = furnace.gaugeProgressScaled(24); + if (j > 0) { + this.drawTexturedModalRect(k + 78, l + 34, 176, 14, j + 1, 16); + } j = furnace.getEnergyScaled(12); if (j > 0) { diff --git a/src/main/java/techreborn/client/gui/GuiFusionReactor.java b/src/main/java/techreborn/client/gui/GuiFusionReactor.java index 42b17627b..1d152583b 100644 --- a/src/main/java/techreborn/client/gui/GuiFusionReactor.java +++ b/src/main/java/techreborn/client/gui/GuiFusionReactor.java @@ -50,16 +50,16 @@ public class GuiFusionReactor extends GuiContainer { public void initGui() { int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; - GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20, 20, ""); - buttonList.add(button); + //GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20, 20, ""); + //buttonList.add(button); super.initGui(); - CoordTriplet coordinates = new CoordTriplet(fusionController.getPos().getX() - (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetX() * 2), fusionController.getPos().getY() - 1, fusionController.getPos().getZ() - (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetZ() * 2)); - if(coordinates.equals(ClientProxy.multiblockRenderEvent.anchor)){ - ClientProxy.multiblockRenderEvent.setMultiblock(null); - button.displayString = "B"; - } else { - button.displayString = "A"; - } + // CoordTriplet coordinates = new CoordTriplet(fusionController.getPos().getX() - (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetX() * 2), fusionController.getPos().getY() - 1, fusionController.getPos().getZ() - (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetZ() * 2)); +// if(coordinates.equals(ClientProxy.multiblockRenderEvent.anchor)){ +// ClientProxy.multiblockRenderEvent.setMultiblock(null); +// button.displayString = "B"; +// } else { +// button.displayString = "A"; +// } } @Override @@ -86,19 +86,19 @@ public class GuiFusionReactor extends GuiContainer { @Override public void actionPerformed(GuiButton button) throws IOException { super.actionPerformed(button); - if(button.id == 212){ - if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){ - {//This code here makes a basic multiblock and then sets to the selected one. - MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor); - ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.partent = new Location(fusionController.getPos().getX(), fusionController.getPos().getY(), fusionController.getPos().getZ(), fusionController.getWorld()); - ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(fusionController.getPos().getX() , fusionController.getPos().getY() -1 , fusionController.getPos().getZ()); - } - button.displayString = "A"; - } else { - ClientProxy.multiblockRenderEvent.setMultiblock(null); - button.displayString = "B"; - } - } +// if(button.id == 212){ +// if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){ +// {//This code here makes a basic multiblock and then sets to the selected one. +// MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor); +// ClientProxy.multiblockRenderEvent.setMultiblock(set); +// ClientProxy.multiblockRenderEvent.partent = new Location(fusionController.getPos().getX(), fusionController.getPos().getY(), fusionController.getPos().getZ(), fusionController.getWorld()); +// ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(fusionController.getPos().getX() , fusionController.getPos().getY() -1 , fusionController.getPos().getZ()); +// } +// button.displayString = "A"; +// } else { +// ClientProxy.multiblockRenderEvent.setMultiblock(null); +// button.displayString = "B"; +// } +// } } } diff --git a/src/main/java/techreborn/client/gui/GuiGenerator.java b/src/main/java/techreborn/client/gui/GuiGenerator.java index da6263eea..fd155c2ac 100644 --- a/src/main/java/techreborn/client/gui/GuiGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiGenerator.java @@ -41,15 +41,15 @@ public class GuiGenerator extends GuiContainer { int j = 0; - j = generator.getEnergyScaled(12); + j = generator.getEnergyScaled(24); if (j > 0) { - this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); + this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16); } if (containerGenerator.burnTime != 0) { j = containerGenerator.getScaledBurnTime(13); - this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 1); + this.drawTexturedModalRect(k + 80, l + 38 + 12 - j, 176, 30 - j, 14, j + 1); } } diff --git a/src/main/java/techreborn/client/gui/GuiIronFurnace.java b/src/main/java/techreborn/client/gui/GuiIronFurnace.java new file mode 100644 index 000000000..dd2d22218 --- /dev/null +++ b/src/main/java/techreborn/client/gui/GuiIronFurnace.java @@ -0,0 +1,56 @@ +package techreborn.client.gui; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import techreborn.client.container.ContainerElectricFurnace; +import techreborn.client.container.ContainerIronFurnace; +import techreborn.tiles.TileIronFurnace; +import techreborn.tiles.teir1.TileElectricFurnace; + +public class GuiIronFurnace extends GuiContainer { + + public static final ResourceLocation texture = new ResourceLocation("minecraft", "textures/gui/container/furnace.png"); + + TileIronFurnace furnace; + ContainerIronFurnace containerGrinder; + + public GuiIronFurnace(EntityPlayer player, TileIronFurnace tilegrinder) { + super(new ContainerIronFurnace(tilegrinder, player)); + this.xSize = 176; + this.ySize = 167; + furnace = tilegrinder; + containerGrinder = (ContainerIronFurnace) this.inventorySlots; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(texture); + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + + int j = 0; + + j = furnace.gaugeProgressScaled(24); + if (j > 0) { + this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16); + } + + j = furnace.gaugeFuelScaled(12); + if (j > 0) { + this.drawTexturedModalRect(k + 57, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); + } + } + + protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { + String name = StatCollector.translateToLocal("tile.techreborn.ironfurnace.name"); + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); + } + +} diff --git a/src/main/java/techreborn/client/render/parts/ClientPartModelBakery.java b/src/main/java/techreborn/client/render/parts/ClientPartModelBakery.java index cd48e6d64..ce0d566f3 100644 --- a/src/main/java/techreborn/client/render/parts/ClientPartModelBakery.java +++ b/src/main/java/techreborn/client/render/parts/ClientPartModelBakery.java @@ -1,7 +1,9 @@ package techreborn.client.render.parts; import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ModelBakeEvent; +import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; @@ -20,7 +22,15 @@ public class ClientPartModelBakery { for(EnumCableType type : EnumCableType.values()){ event.modelRegistry.putObject(new ModelResourceLocation("techreborn:cable#type=" + type.getName().toLowerCase()), new RenderCablePart(type)); } - } + @SubscribeEvent + public void textureStichEvent(TextureStitchEvent event){ + for(EnumCableType type : EnumCableType.values()){ + event.map.registerSprite(new ResourceLocation(type.textureName)); + } + } + + + } diff --git a/src/main/java/techreborn/client/render/parts/RenderCablePart.java b/src/main/java/techreborn/client/render/parts/RenderCablePart.java index 217a93fdc..9332b28a7 100644 --- a/src/main/java/techreborn/client/render/parts/RenderCablePart.java +++ b/src/main/java/techreborn/client/render/parts/RenderCablePart.java @@ -63,8 +63,8 @@ public class RenderCablePart implements ISmartMultipartModel { ArrayList list = new ArrayList(); BlockFaceUV uv = new BlockFaceUV(new float[]{0.0F, 0.0F, 16.0F, 16.0F}, 0); BlockPartFace face = new BlockPartFace(null, 0, "", uv); - int thickness = 16 - (int) type.cableThickness * 2; - int lastThickness = 16 - thickness; + double thickness = type.cableThickness; + double lastThickness = 16 - thickness; addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture); if (state != null) { if (state.getValue(CableMultipart.UP)) { diff --git a/src/main/java/techreborn/compat/CompatManager.java b/src/main/java/techreborn/compat/CompatManager.java index 506ec2b31..f43a3956d 100644 --- a/src/main/java/techreborn/compat/CompatManager.java +++ b/src/main/java/techreborn/compat/CompatManager.java @@ -13,6 +13,7 @@ import techreborn.compat.recipes.RecipesBuildcraft; import techreborn.compat.recipes.RecipesThaumcraft; import techreborn.compat.waila.CompatModuleWaila; import techreborn.config.ConfigTechReborn; +import techreborn.parts.StandalonePartCompact; import techreborn.parts.TechRebornParts; public class CompatManager { @@ -45,6 +46,7 @@ public class CompatManager { registerCompact(RecipesThaumcraft.class, "Thaumcraft"); registerCompact(TechRebornParts.class, "mcmultipart"); registerCompact(ClientPartLoader.class, "mcmultipart", "@client"); + registerCompact(StandalonePartCompact.class, "!mcmultipart"); } public void registerCompact(Class moduleClass, Object... objs) { diff --git a/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java b/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java index e3f8272f8..1c52018a2 100644 --- a/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java +++ b/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java @@ -17,4 +17,6 @@ public class RecipeCategoryUids { public static final String ROLLING_MACHINE = "TechReborn.RollingMachine"; public static final String VACUUM_FREEZER = "TechReborn.VacuumFreezer"; public static final String GRINDER = "TechReborn.Grinder"; + public static final String EXTRACTOR = "TechReborn.Extractor"; + public static final String COMPRESSOR = "TechReborn.Compressor"; } diff --git a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java index 5f0639332..38aec2595 100644 --- a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java +++ b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java @@ -24,6 +24,8 @@ import techreborn.client.container.ContainerAssemblingMachine; import techreborn.client.container.ContainerBlastFurnace; import techreborn.client.container.ContainerCentrifuge; import techreborn.client.container.ContainerChemicalReactor; +import techreborn.client.container.ContainerCompressor; +import techreborn.client.container.ContainerExtractor; import techreborn.client.container.ContainerFusionReactor; import techreborn.client.container.ContainerGrinder; import techreborn.client.container.ContainerImplosionCompressor; @@ -38,12 +40,15 @@ import techreborn.client.gui.GuiAssemblingMachine; import techreborn.client.gui.GuiBlastFurnace; import techreborn.client.gui.GuiCentrifuge; import techreborn.client.gui.GuiChemicalReactor; +import techreborn.client.gui.GuiCompressor; +import techreborn.client.gui.GuiExtractor; import techreborn.client.gui.GuiFusionReactor; import techreborn.client.gui.GuiGrinder; import techreborn.client.gui.GuiImplosionCompressor; import techreborn.client.gui.GuiIndustrialElectrolyzer; import techreborn.client.gui.GuiIndustrialGrinder; import techreborn.client.gui.GuiIndustrialSawmill; +import techreborn.client.gui.GuiIronFurnace; import techreborn.client.gui.GuiRollingMachine; import techreborn.client.gui.GuiVacuumFreezer; import techreborn.compat.jei.alloySmelter.AlloySmelterRecipeCategory; @@ -56,6 +61,10 @@ import techreborn.compat.jei.centrifuge.CentrifugeRecipeCategory; import techreborn.compat.jei.centrifuge.CentrifugeRecipeHandler; import techreborn.compat.jei.chemicalReactor.ChemicalReactorRecipeCategory; import techreborn.compat.jei.chemicalReactor.ChemicalReactorRecipeHandler; +import techreborn.compat.jei.compressor.CompressorRecipeCategory; +import techreborn.compat.jei.compressor.CompressorRecipeHandler; +import techreborn.compat.jei.extractor.ExtractorRecipeCategory; +import techreborn.compat.jei.extractor.ExtractorRecipeHandler; import techreborn.compat.jei.fusionReactor.FusionReactorRecipeCategory; import techreborn.compat.jei.fusionReactor.FusionReactorRecipeHandler; import techreborn.compat.jei.grinder.GrinderRecipeCategory; @@ -94,7 +103,9 @@ public class TechRebornJeiPlugin extends BlankModPlugin { new IndustrialSawmillRecipeCategory(guiHelper), new RollingMachineRecipeCategory(guiHelper), new VacuumFreezerRecipeCategory(guiHelper), - new GrinderRecipeCategory(guiHelper) + new GrinderRecipeCategory(guiHelper), + new ExtractorRecipeCategory(guiHelper), + new CompressorRecipeCategory(guiHelper) ); registry.addRecipeHandlers( @@ -110,7 +121,9 @@ public class TechRebornJeiPlugin extends BlankModPlugin { new IndustrialSawmillRecipeHandler(jeiHelpers), new RollingMachineRecipeHandler(), new VacuumFreezerRecipeHandler(jeiHelpers), - new GrinderRecipeHandler(jeiHelpers) + new GrinderRecipeHandler(jeiHelpers), + new ExtractorRecipeHandler(jeiHelpers), + new CompressorRecipeHandler(jeiHelpers) ); registry.addRecipes(RecipeHandler.recipeList); @@ -144,6 +157,9 @@ public class TechRebornJeiPlugin extends BlankModPlugin { registry.addRecipeClickArea(GuiRollingMachine.class, 89, 32, 26, 25, RecipeCategoryUids.ROLLING_MACHINE); registry.addRecipeClickArea(GuiVacuumFreezer.class, 78, 36, 24, 16, RecipeCategoryUids.VACUUM_FREEZER); registry.addRecipeClickArea(GuiGrinder.class, 78, 36, 24, 16, RecipeCategoryUids.GRINDER); + registry.addRecipeClickArea(GuiExtractor.class, 78, 36, 24, 16, RecipeCategoryUids.EXTRACTOR); + registry.addRecipeClickArea(GuiCompressor.class, 78, 36, 24, 16, RecipeCategoryUids.COMPRESSOR); + registry.addRecipeClickArea(GuiIronFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING, VanillaRecipeCategoryUid.FUEL); IRecipeTransferRegistry recipeTransferRegistry = registry.getRecipeTransferRegistry(); @@ -162,6 +178,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin { recipeTransferRegistry.addRecipeTransferHandler(ContainerRollingMachine.class, RecipeCategoryUids.ROLLING_MACHINE, 0, 9, 11, 36); recipeTransferRegistry.addRecipeTransferHandler(ContainerVacuumFreezer.class, RecipeCategoryUids.VACUUM_FREEZER, 0, 1, 2, 36); recipeTransferRegistry.addRecipeTransferHandler(ContainerGrinder.class, RecipeCategoryUids.GRINDER, 0, 1, 2, 36); + recipeTransferRegistry.addRecipeTransferHandler(ContainerExtractor.class, RecipeCategoryUids.EXTRACTOR, 0, 1, 2, 36); + recipeTransferRegistry.addRecipeTransferHandler(ContainerCompressor.class, RecipeCategoryUids.COMPRESSOR, 0, 1, 2, 36); } diff --git a/src/main/java/techreborn/compat/jei/compressor/CompressorRecipeCategory.java b/src/main/java/techreborn/compat/jei/compressor/CompressorRecipeCategory.java new file mode 100644 index 000000000..a256eb44b --- /dev/null +++ b/src/main/java/techreborn/compat/jei/compressor/CompressorRecipeCategory.java @@ -0,0 +1,59 @@ +package techreborn.compat.jei.compressor; + +import javax.annotation.Nonnull; + +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.recipe.BlankRecipeCategory; +import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.util.StatCollector; +import techreborn.client.gui.GuiCompressor; +import techreborn.client.gui.GuiGrinder; +import techreborn.compat.jei.RecipeCategoryUids; +import techreborn.compat.jei.RecipeUtil; + +public class CompressorRecipeCategory extends BlankRecipeCategory { + private static final int[] INPUT_SLOTS = {0}; + private static final int[] OUTPUT_SLOTS = {1}; + + private final IDrawable background; + private final String title; + + public CompressorRecipeCategory(IGuiHelper guiHelper) { + background = guiHelper.createDrawable(GuiCompressor.texture, 55, 30, 82, 26); + title = StatCollector.translateToLocal("tile.techreborn.compressor.name"); + } + + @Nonnull + @Override + public String getUid() { + return RecipeCategoryUids.COMPRESSOR; + } + + @Nonnull + @Override + public String getTitle() { + return title; + } + + @Nonnull + @Override + public IDrawable getBackground() { + return background; + } + + @Override + public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) { + IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); + guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3); + + guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4); + + if (recipeWrapper instanceof CompressorRecipeWrapper) { + CompressorRecipeWrapper recipe = (CompressorRecipeWrapper) recipeWrapper; + RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); + } + } +} diff --git a/src/main/java/techreborn/compat/jei/compressor/CompressorRecipeHandler.java b/src/main/java/techreborn/compat/jei/compressor/CompressorRecipeHandler.java new file mode 100644 index 000000000..21d730664 --- /dev/null +++ b/src/main/java/techreborn/compat/jei/compressor/CompressorRecipeHandler.java @@ -0,0 +1,42 @@ +package techreborn.compat.jei.compressor; + +import javax.annotation.Nonnull; + +import mezz.jei.api.IJeiHelpers; +import mezz.jei.api.recipe.IRecipeHandler; +import mezz.jei.api.recipe.IRecipeWrapper; +import techreborn.api.recipe.machines.CompressorRecipe; +import techreborn.api.recipe.machines.GrinderRecipe; +import techreborn.compat.jei.RecipeCategoryUids; + +public class CompressorRecipeHandler implements IRecipeHandler { + @Nonnull + private final IJeiHelpers jeiHelpers; + + public CompressorRecipeHandler(@Nonnull IJeiHelpers jeiHelpers) { + this.jeiHelpers = jeiHelpers; + } + + @Nonnull + @Override + public Class getRecipeClass() { + return CompressorRecipe.class; + } + + @Nonnull + @Override + public String getRecipeCategoryUid() { + return RecipeCategoryUids.COMPRESSOR; + } + + @Nonnull + @Override + public IRecipeWrapper getRecipeWrapper(@Nonnull CompressorRecipe recipe) { + return new CompressorRecipeWrapper(jeiHelpers, recipe); + } + + @Override + public boolean isRecipeValid(@Nonnull CompressorRecipe recipe) { + return true; + } +} diff --git a/src/main/java/techreborn/compat/jei/compressor/CompressorRecipeWrapper.java b/src/main/java/techreborn/compat/jei/compressor/CompressorRecipeWrapper.java new file mode 100644 index 000000000..8c1e9dbcd --- /dev/null +++ b/src/main/java/techreborn/compat/jei/compressor/CompressorRecipeWrapper.java @@ -0,0 +1,33 @@ +package techreborn.compat.jei.compressor; + +import javax.annotation.Nonnull; + +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.IJeiHelpers; +import mezz.jei.api.gui.IDrawableAnimated; +import mezz.jei.api.gui.IDrawableStatic; +import net.minecraft.client.Minecraft; +import techreborn.api.recipe.machines.CompressorRecipe; +import techreborn.api.recipe.machines.GrinderRecipe; +import techreborn.client.gui.GuiCompressor; +import techreborn.client.gui.GuiGrinder; +import techreborn.compat.jei.BaseRecipeWrapper; + +public class CompressorRecipeWrapper extends BaseRecipeWrapper { + private final IDrawableAnimated progress; + + public CompressorRecipeWrapper(@Nonnull IJeiHelpers jeiHelpers, @Nonnull CompressorRecipe baseRecipe) { + super(baseRecipe); + IGuiHelper guiHelper = jeiHelpers.getGuiHelper(); + IDrawableStatic progressStatic = guiHelper.createDrawable(GuiCompressor.texture, 176, 14, 20, 11); + + int ticksPerCycle = baseRecipe.tickTime(); + this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle, IDrawableAnimated.StartDirection.LEFT, false); + } + + @Override + public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) { + super.drawAnimations(minecraft, recipeWidth, recipeHeight); + progress.draw(minecraft, 25, 7); + } +} diff --git a/src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeCategory.java b/src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeCategory.java new file mode 100644 index 000000000..6af5e4d57 --- /dev/null +++ b/src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeCategory.java @@ -0,0 +1,59 @@ +package techreborn.compat.jei.extractor; + +import javax.annotation.Nonnull; + +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.recipe.BlankRecipeCategory; +import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.util.StatCollector; +import techreborn.client.gui.GuiExtractor; +import techreborn.client.gui.GuiGrinder; +import techreborn.compat.jei.RecipeCategoryUids; +import techreborn.compat.jei.RecipeUtil; + +public class ExtractorRecipeCategory extends BlankRecipeCategory { + private static final int[] INPUT_SLOTS = {0}; + private static final int[] OUTPUT_SLOTS = {1}; + + private final IDrawable background; + private final String title; + + public ExtractorRecipeCategory(IGuiHelper guiHelper) { + background = guiHelper.createDrawable(GuiExtractor.texture, 55, 30, 82, 26); + title = StatCollector.translateToLocal("tile.techreborn.extractor.name"); + } + + @Nonnull + @Override + public String getUid() { + return RecipeCategoryUids.EXTRACTOR; + } + + @Nonnull + @Override + public String getTitle() { + return title; + } + + @Nonnull + @Override + public IDrawable getBackground() { + return background; + } + + @Override + public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) { + IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); + guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3); + + guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4); + + if (recipeWrapper instanceof ExtractorRecipeWrapper) { + ExtractorRecipeWrapper recipe = (ExtractorRecipeWrapper) recipeWrapper; + RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); + } + } +} diff --git a/src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeHandler.java b/src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeHandler.java new file mode 100644 index 000000000..1c719b1bf --- /dev/null +++ b/src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeHandler.java @@ -0,0 +1,42 @@ +package techreborn.compat.jei.extractor; + +import javax.annotation.Nonnull; + +import mezz.jei.api.IJeiHelpers; +import mezz.jei.api.recipe.IRecipeHandler; +import mezz.jei.api.recipe.IRecipeWrapper; +import techreborn.api.recipe.machines.ExtractorRecipe; +import techreborn.api.recipe.machines.GrinderRecipe; +import techreborn.compat.jei.RecipeCategoryUids; + +public class ExtractorRecipeHandler implements IRecipeHandler { + @Nonnull + private final IJeiHelpers jeiHelpers; + + public ExtractorRecipeHandler(@Nonnull IJeiHelpers jeiHelpers) { + this.jeiHelpers = jeiHelpers; + } + + @Nonnull + @Override + public Class getRecipeClass() { + return ExtractorRecipe.class; + } + + @Nonnull + @Override + public String getRecipeCategoryUid() { + return RecipeCategoryUids.EXTRACTOR; + } + + @Nonnull + @Override + public IRecipeWrapper getRecipeWrapper(@Nonnull ExtractorRecipe recipe) { + return new ExtractorRecipeWrapper(jeiHelpers, recipe); + } + + @Override + public boolean isRecipeValid(@Nonnull ExtractorRecipe recipe) { + return true; + } +} diff --git a/src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeWrapper.java b/src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeWrapper.java new file mode 100644 index 000000000..38c504e19 --- /dev/null +++ b/src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeWrapper.java @@ -0,0 +1,33 @@ +package techreborn.compat.jei.extractor; + +import javax.annotation.Nonnull; + +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.IJeiHelpers; +import mezz.jei.api.gui.IDrawableAnimated; +import mezz.jei.api.gui.IDrawableStatic; +import net.minecraft.client.Minecraft; +import techreborn.api.recipe.machines.ExtractorRecipe; +import techreborn.api.recipe.machines.GrinderRecipe; +import techreborn.client.gui.GuiExtractor; +import techreborn.client.gui.GuiGrinder; +import techreborn.compat.jei.BaseRecipeWrapper; + +public class ExtractorRecipeWrapper extends BaseRecipeWrapper { + private final IDrawableAnimated progress; + + public ExtractorRecipeWrapper(@Nonnull IJeiHelpers jeiHelpers, @Nonnull ExtractorRecipe baseRecipe) { + super(baseRecipe); + IGuiHelper guiHelper = jeiHelpers.getGuiHelper(); + IDrawableStatic progressStatic = guiHelper.createDrawable(GuiExtractor.texture, 176, 17, 22, 11); + + int ticksPerCycle = baseRecipe.tickTime(); + this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle, IDrawableAnimated.StartDirection.LEFT, false); + } + + @Override + public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) { + super.drawAnimations(minecraft, recipeWidth, recipeHeight); + progress.draw(minecraft, 25, 7); + } +} diff --git a/src/main/java/techreborn/init/ModBlocks.java b/src/main/java/techreborn/init/ModBlocks.java index f7c530946..6aa37ff8a 100644 --- a/src/main/java/techreborn/init/ModBlocks.java +++ b/src/main/java/techreborn/init/ModBlocks.java @@ -134,6 +134,8 @@ public class ModBlocks { public static Block storage; public static Block storage2; public static Block machineframe; + public static Block reinforcedglass; + public static Block ironFurnace; public static Block rubberLog; public static Block rubberLeaves; @@ -360,7 +362,13 @@ public class ModBlocks { ironFence = new BlockIronFence(); GameRegistry.registerBlock(ironFence, "ironFence"); - + + reinforcedglass = new BlockReinforcedGlass(Material.glass); + GameRegistry.registerBlock(reinforcedglass, "reinforcedglass"); + + ironFurnace = new BlockIronFurnace(); + GameRegistry.registerBlock(ironFurnace, "ironfurnace"); + GameRegistry.registerTileEntity(TileIronFurnace.class, "TileIronFurnaceTR"); registerOreDict(); Core.logHelper.info("TechReborns Blocks Loaded"); } diff --git a/src/main/java/techreborn/init/ModItems.java b/src/main/java/techreborn/init/ModItems.java index 410f82439..2443e5e2d 100644 --- a/src/main/java/techreborn/init/ModItems.java +++ b/src/main/java/techreborn/init/ModItems.java @@ -85,6 +85,8 @@ public class ModItems { public static Item diamondJackhammer; public static Item hammer; public static Item wrench; + public static Item lapatronCrystal; + public static Item energyCrystal; public static Item upgrades; @@ -129,6 +131,11 @@ public class ModItems { GameRegistry.registerItem(lapotronicOrb, "lapotronicOrb"); omniTool = PoweredItem.createItem(ItemOmniTool.class); GameRegistry.registerItem(omniTool, "omniTool"); + energyCrystal = PoweredItem.createItem(ItemEnergyCrystal.class); + GameRegistry.registerItem(energyCrystal, "energycrystal"); + lapatronCrystal = PoweredItem.createItem(ItemLapotronCrystal.class); + GameRegistry.registerItem(lapatronCrystal, "lapatroncrystal"); + manual = new ItemTechManual(); GameRegistry.registerItem(manual, "techmanuel"); diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 970899996..5d8501c8c 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -23,6 +23,8 @@ import techreborn.api.recipe.machines.AlloySmelterRecipe; import techreborn.api.recipe.machines.BlastFurnaceRecipe; import techreborn.api.recipe.machines.CentrifugeRecipe; import techreborn.api.recipe.machines.ChemicalReactorRecipe; +import techreborn.api.recipe.machines.CompressorRecipe; +import techreborn.api.recipe.machines.ExtractorRecipe; import techreborn.api.recipe.machines.GrinderRecipe; import techreborn.api.recipe.machines.ImplosionCompressorRecipe; import techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe; @@ -44,10 +46,10 @@ import techreborn.items.ItemIngots; import techreborn.items.ItemNuggets; import techreborn.items.ItemParts; import techreborn.items.ItemPlates; +import techreborn.parts.ItemStandaloneCables; import techreborn.utils.RecipeUtils; -public class - ModRecipes { +public class ModRecipes { public static ConfigTechReborn config; public static void init() { @@ -73,9 +75,54 @@ public class addGrinderRecipes(); addHammerRecipes(); addIc2ReplacementReicpes(); + addExtractorRecipes(); + addCompressorRecipes(); + addWireRecipes(); } - static void addIc2ReplacementReicpes(){ + static void addWireRecipes() { + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("copper", 6), + "XXX","CCC", "XXX", + 'C', "ingotCopper"); + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("tin", 9), + "XXX","CCC", "XXX", + 'C', "ingotTin"); + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("gold", 12), + "XXX","CCC", "XXX", + 'C', "ingotGold"); + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("hv", 8), + "XXX","CCC", "XXX", + 'C', ItemIngots.getIngotByName("refinediron")); + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("glassfiber", 6), + "GGG", + "SDS", + "GGG", + 'G', "blockGlass", + 'S', "ingotSilver", + 'D', Items.diamond); + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("glassfiber", 4), + "GGG", + "RDR", + "GGG", + 'G', "blockGlass", + 'R', Items.redstone, + 'D', Items.diamond); + + CraftingHelper.addShapelessOreRecipe(ItemStandaloneCables.getCableByName("insulatedcopper"), ItemParts.getPartByName("rubber"), ItemStandaloneCables.getCableByName("copper")); + CraftingHelper.addShapelessOreRecipe(ItemStandaloneCables.getCableByName("insulatedgold"), ItemParts.getPartByName("rubber"), ItemStandaloneCables.getCableByName("gold")); + CraftingHelper.addShapelessOreRecipe(ItemStandaloneCables.getCableByName("insulatedhv"), ItemParts.getPartByName("rubber"), ItemStandaloneCables.getCableByName("hv")); + } + + private static void addCompressorRecipes() { + RecipeHandler.addRecipe(new CompressorRecipe(new ItemStack(Items.diamond), new ItemStack(Items.coal), 400, 20)); + } + + static void addExtractorRecipes() { + RecipeHandler.addRecipe(new ExtractorRecipe(ItemParts.getPartByName("rubberSap"), ItemParts.getPartByName("rubber", 3), 400, 20)); + RecipeHandler.addRecipe(new ExtractorRecipe(new ItemStack(ModBlocks.rubberLog), ItemParts.getPartByName("rubber"), 400, 20)); + } + + static void addIc2ReplacementReicpes(){ CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.Grinder), "FFF", "SMS", @@ -113,6 +160,8 @@ public class } public static ItemStack hammerStack = new ItemStack(ModItems.hammer, 1, OreDictionary.WILDCARD_VALUE); + public static ItemStack batteryStack = new ItemStack(ModItems.reBattery, 1, OreDictionary.WILDCARD_VALUE); + public static Item hammer = ModItems.hammer; static void addHammerRecipes(){ @@ -149,9 +198,73 @@ public class 'A', "ingot" + name.substring(0, 1).toUpperCase() + name.substring(1)); } + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.ElectricFurnace), + "XCX", "RFR", "XXX", + 'C', ItemParts.getPartByName("electronicCircuit"), + 'F', new ItemStack(ModBlocks.ironFurnace), + 'R', Items.redstone); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.ironFurnace), + "III", "IXI", "III", + 'I', "ingotIron"); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.ironFurnace), + "XIX", "IXI", "IFI", + 'I', "ingotIron", + 'F', Blocks.furnace); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("electronicCircuit"), + "WWW", "SRS", "WWW", + 'R', ItemIngots.getIngotByName("refinediron"), + 'S', Items.redstone, + 'W', ItemStandaloneCables.getCableByName("insulatedcopper")); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.reBattery), + "XWX", "TRT", "TRT", + 'T', "ingotTin", + 'R', Items.redstone, + 'W', ItemStandaloneCables.getCableByName("insulatedcopper")); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.wrench), + "BAB", "BBB", "ABA", + 'B', "ingotBronze"); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.Extractor), + "TMT", "TCT", "XXX", + 'T', ModItems.treeTap, + 'M', BlockMachineFrame.getFrameByName("machine", 1), + 'C', ItemParts.getPartByName("electronicCircuit")); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.centrifuge), + "RCR", "AEA", "RCR", + 'R', ItemIngots.getIngotByName("refinediron"), + 'E', new ItemStack(ModBlocks.Extractor), + 'A', BlockMachineFrame.getFrameByName("advancedMachine", 1), + 'C', ItemParts.getPartByName("electronicCircuit")); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("advancedCircuit"), + "RGR", "LCL", "RGR", + 'R', Items.redstone, + 'G', Items.glowstone_dust, + 'L', "dyeBlue", + 'C', ItemParts.getPartByName("electronicCircuit")); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.energyCrystal), + "RRR", "RDR", "RRR", + 'R', Items.redstone, + 'D', Items.diamond); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.lapatronCrystal), + "LCL", "LEL", "LCL", + 'L', "dyeBlue", + 'E', new ItemStack(ModItems.energyCrystal), + 'C', ItemParts.getPartByName("electronicCircuit")); + + CraftingHelper.addShapelessOreRecipe(new ItemStack(ModBlocks.Generator), batteryStack, BlockMachineFrame.getFrameByName("machine", 1), Blocks.furnace); + CraftingHelper.addShapedOreRecipe(BlockMachineFrame.getFrameByName("machine", 1), "AAA", "AXA", "AAA", - 'A', ItemPlates.getPlateByName("iron")); + 'A', ItemIngots.getIngotByName("refinediron")); CraftingHelper.addShapedOreRecipe(BlockStorage.getStorageBlockByName("sapphire"), "AAA", "AAA", "AAA", @@ -162,15 +275,6 @@ public class 'A', "gemRuby"); - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 40), - "PLP", "RGB", "PYP", - 'P', "plateAluminum", - 'L', "dyeLime", - 'R', "dyeRed", - 'G', "paneGlass", - 'B', "dyeBlue", - 'Y', Items.glowstone_dust); - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("dataStorageCircuit"), "EEE", "ECE", "EEE", 'E', new ItemStack(Items.emerald), @@ -359,7 +463,6 @@ public class } static void addShapelessRecipes() { - for (String name : ArrayUtils.addAll(BlockStorage.types, BlockStorage2.types)) { ItemStack item = null; try { @@ -378,7 +481,6 @@ public class GameRegistry.addShapelessRecipe(BlockStorage.getStorageBlockByName(name), item, item, item, item, item, item, item, item, item); GameRegistry.addShapelessRecipe(item, BlockStorage.getStorageBlockByName(name, 9)); - } GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.rubberPlanks, 4), ModBlocks.rubberLog); @@ -395,7 +497,7 @@ public class CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.quantumTank), "EPE", "PCP", "EPE", 'P', "platePlatinum", - 'E', "circuitMaster", + 'E', ItemParts.getPartByName("advancedCircuit"), 'C', ModBlocks.quantumChest); CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.digitalChest), @@ -411,16 +513,15 @@ public class 'C', ItemParts.getPartByName("computerMonitor")); CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.AlloySmelter), - "IHI", "CFC", "IHI", - 'I', "plateInvar", - 'C', "circuitBasic", - 'H', new ItemStack(ModItems.parts, 1, 17), - 'F', ModBlocks.AlloyFurnace); + "XCX", "FMF", "XXX", + 'C', ItemParts.getPartByName("electronicCircuit"), + 'F', new ItemStack(ModBlocks.ElectricFurnace), + 'M', BlockMachineFrame.getFrameByName("machine", 1)); CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.LesuStorage), "LLL", "LCL", "LLL", 'L', "blockLapis", - 'C', "circuitBasic"); + 'C', ItemParts.getPartByName("electronicCircuit")); TechRebornAPI.addRollingOreMachinceRecipe(ItemParts.getPartByName("cupronickelHeatingCoil"), "NCN", "C C", "NCN", @@ -436,6 +537,7 @@ public class GameRegistry.addSmelting(ItemDusts.getDustByName("iron", 1), new ItemStack(Items.iron_ingot), 1F); GameRegistry.addSmelting(ItemDusts.getDustByName("gold", 1), new ItemStack(Items.gold_ingot), 1F); GameRegistry.addSmelting(ItemParts.getPartByName("rubberSap"), ItemParts.getPartByName("rubber"), 1F); + GameRegistry.addSmelting(new ItemStack(Items.iron_ingot), ItemIngots.getIngotByName("refinediron"), 1F); Core.logHelper.info("Smelting Recipes Added"); } @@ -1291,7 +1393,7 @@ public class CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("energyFlowCircuit", 4), "ATA", "LIL", "ATA", - 'T', "plateTungsten", + 'T', "ingotTungsten", 'I', "plateIridium", 'A', TechRebornAPI.recipeCompact.getItem("advancedCircuit"), 'L', TechRebornAPI.recipeCompact.getItem("lapotronCrystal")); @@ -1470,8 +1572,8 @@ public class CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.AlloyFurnace), "III", "F F", "III", - 'I', "plateIron", - 'F', TechRebornAPI.recipeCompact.getItem("ironFurnace")); + 'I', ItemIngots.getIngotByName("refinediron"), + 'F', new ItemStack(ModBlocks.ironFurnace)); CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.ChemicalReactor), "IMI", "CPC", "IEI", @@ -2364,7 +2466,7 @@ public class CraftingHelper.addShapedOreRecipe(TechRebornAPI.recipeCompact.getItem("solarPanel"), "PPP", "SZS", "CGC", 'P', "paneGlass", - 'S', new ItemStack(ModItems.parts, 1, 1), + 'S', ItemPlates.getPlateByName("silicon"), 'Z', TechRebornAPI.recipeCompact.getItem("carbonPlate"), 'G', TechRebornAPI.recipeCompact.getItem("generator"), 'C', TechRebornAPI.recipeCompact.getItem("electronicCircuit")); diff --git a/src/main/java/techreborn/init/RecipeCompact.java b/src/main/java/techreborn/init/RecipeCompact.java index 8616c9f1a..412f90df0 100644 --- a/src/main/java/techreborn/init/RecipeCompact.java +++ b/src/main/java/techreborn/init/RecipeCompact.java @@ -61,6 +61,8 @@ public class RecipeCompact implements IRecipeCompact { recipes.put("mvTransformer", ItemParts.getPartByName("mvTransformer")); recipes.put("hvTransformer", ItemParts.getPartByName("hvTransformer")); recipes.put("windMill", new ItemStack(ModBlocks.windMill)); + recipes.put("energyCrystal", new ItemStack(ModItems.energyCrystal)); + recipes.put("lapotronCrystal", new ItemStack(ModItems.lapatronCrystal)); inited = false; } diff --git a/src/main/java/techreborn/items/ItemEnergyCrystal.java b/src/main/java/techreborn/items/ItemEnergyCrystal.java new file mode 100644 index 000000000..9bd9e35ef --- /dev/null +++ b/src/main/java/techreborn/items/ItemEnergyCrystal.java @@ -0,0 +1,57 @@ +package techreborn.items; + +import net.minecraft.item.ItemStack; +import reborncore.api.power.IEnergyItemInfo; +import techreborn.client.TechRebornCreativeTab; +import techreborn.config.ConfigTechReborn; + + +public class ItemEnergyCrystal extends ItemTextureBase implements IEnergyItemInfo { + + public static final int maxCharge = 100000; + public static final int tier = 1; + public double transferLimit = 512; + + public ItemEnergyCrystal() { + super(); + setMaxStackSize(1); + setMaxDamage(13); + setUnlocalizedName("techreborn.energycrystal"); + setCreativeTab(TechRebornCreativeTab.instance); + } + + @Override + public double getMaxPower(ItemStack stack) { + return maxCharge; + } + + @Override + public boolean canAcceptEnergy(ItemStack stack) { + return true; + } + + @Override + public boolean canProvideEnergy(ItemStack stack) { + return true; + } + + @Override + public double getMaxTransfer(ItemStack stack) { + return transferLimit; + } + + @Override + public int getStackTeir(ItemStack stack) { + return tier; + } + + @Override + public String getTextureName(int damage) { + return "techreborn:items/energycrystal"; + } + + @Override + public int getMaxMeta() { + return 1; + } +} diff --git a/src/main/java/techreborn/items/ItemIngots.java b/src/main/java/techreborn/items/ItemIngots.java index e9a3f18c0..b9395a285 100644 --- a/src/main/java/techreborn/items/ItemIngots.java +++ b/src/main/java/techreborn/items/ItemIngots.java @@ -29,7 +29,7 @@ public class ItemIngots extends ItemTextureBase { "bronze", "cadmium", "chrome", "copper", "cupronickel", "electrum", "indium", "invar", "iridium", "kanthal", "lead", "lodestone", "magnalium", "nichrome", "nickel", "osmium", "platinum", "silver", "steel", "tellurium", "tin", "titanium", - "tungsten", "hotTungstensteel", "tungstensteel", "zinc"}; + "tungsten", "hotTungstensteel", "tungstensteel", "zinc", "refinediron"}; public ItemIngots() { diff --git a/src/main/java/techreborn/items/ItemLapotronCrystal.java b/src/main/java/techreborn/items/ItemLapotronCrystal.java new file mode 100644 index 000000000..b0220a789 --- /dev/null +++ b/src/main/java/techreborn/items/ItemLapotronCrystal.java @@ -0,0 +1,57 @@ +package techreborn.items; + +import net.minecraft.item.ItemStack; +import reborncore.api.power.IEnergyItemInfo; +import techreborn.client.TechRebornCreativeTab; +import techreborn.config.ConfigTechReborn; + + +public class ItemLapotronCrystal extends ItemTextureBase implements IEnergyItemInfo { + + public static final int maxCharge = 100000; + public static final int tier = 2; + public double transferLimit = 512; + + public ItemLapotronCrystal() { + super(); + setMaxStackSize(1); + setMaxDamage(13); + setUnlocalizedName("techreborn.lapotroncrystal"); + setCreativeTab(TechRebornCreativeTab.instance); + } + + @Override + public double getMaxPower(ItemStack stack) { + return maxCharge; + } + + @Override + public boolean canAcceptEnergy(ItemStack stack) { + return true; + } + + @Override + public boolean canProvideEnergy(ItemStack stack) { + return true; + } + + @Override + public double getMaxTransfer(ItemStack stack) { + return transferLimit; + } + + @Override + public int getStackTeir(ItemStack stack) { + return tier; + } + + @Override + public String getTextureName(int damage) { + return "techreborn:items/lapotroncrystal"; + } + + @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 7319feda5..5992cd85a 100644 --- a/src/main/java/techreborn/items/tools/ItemWrench.java +++ b/src/main/java/techreborn/items/tools/ItemWrench.java @@ -32,10 +32,9 @@ public class ItemWrench extends ItemTR implements ITexturedItem { public ItemWrench() { setCreativeTab(TechRebornCreativeTabMisc.instance); setUnlocalizedName("techreborn.wrench"); - + setMaxStackSize(1); } - @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { if(world.isAirBlock(pos) || !player.isSneaking()){ @@ -45,6 +44,9 @@ public class ItemWrench extends ItemTR implements ITexturedItem { if(tile == null){ return false; } + if(!(tile instanceof IInventory)){ + return false; + } List items = new ArrayList(); IInventory inventory = (IInventory) tile; diff --git a/src/main/java/techreborn/parts/CableMultipart.java b/src/main/java/techreborn/parts/CableMultipart.java index 01781c2bb..5c1e0ec3d 100644 --- a/src/main/java/techreborn/parts/CableMultipart.java +++ b/src/main/java/techreborn/parts/CableMultipart.java @@ -3,6 +3,7 @@ package techreborn.parts; import mcmultipart.MCMultiPartMod; import mcmultipart.microblock.IMicroblock; import mcmultipart.multipart.*; +import mcmultipart.raytrace.PartMOP; import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; @@ -10,12 +11,10 @@ import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ITickable; +import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; @@ -24,16 +23,14 @@ import net.minecraftforge.common.property.Properties; import reborncore.api.power.IEnergyInterfaceTile; import reborncore.common.misc.Functions; import reborncore.common.misc.vecmath.Vecs3dCube; +import techreborn.utils.damageSources.ElectrialShockSource; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Created by mark on 02/03/2016. */ -public abstract class CableMultipart extends Multipart implements IOccludingPart, ISlottedPart, ITickable, ICableType { +public abstract class CableMultipart extends Multipart implements IOccludingPart, ISlottedPart, ITickable, ICableType, ICollidableMultipart { public Vecs3dCube[] boundingBoxes = new Vecs3dCube[14]; public float center = 0.6F; @@ -57,7 +54,7 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart public void refreshBounding() { float centerFirst = center - offset; - double w = getCableType().cableThickness / 16; + double w = (getCableType().cableThickness / 16) - 0.5; boundingBoxes[6] = new Vecs3dCube(centerFirst - w - 0.03, centerFirst - w - 0.08, centerFirst - w - 0.03, centerFirst + w + 0.08, centerFirst + w + 0.04, centerFirst + w + 0.08); @@ -225,7 +222,11 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart @Override public void update() { - + if(getWorld() != null){ + if(getWorld().getTotalWorldTime() % 80 == 0){ + checkConnectedSides(); + } + } } @Override @@ -262,5 +263,30 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart return "techreborn:cable"; } + @Override + public float getHardness(PartMOP hit) { + return 1F; + } + @Override + public List getDrops() { + List list = new ArrayList<>(); + list.add(new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal())); + return list; + } + + + @Override + public void onEntityCollided(Entity entity) { + if(getCableType().canKill && entity instanceof EntityLivingBase){ + entity.attackEntityFrom(new ElectrialShockSource(), 1F); + getWorld().playSoundAtEntity(entity, "techreborn:cable_shock", 0.6F, 1F); + getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0, 0,0); + } + } + + @Override + public void onEntityStanding(Entity entity) { + + } } diff --git a/src/main/java/techreborn/parts/EnumCableType.java b/src/main/java/techreborn/parts/EnumCableType.java index 4aaf85bf1..df6c727f5 100644 --- a/src/main/java/techreborn/parts/EnumCableType.java +++ b/src/main/java/techreborn/parts/EnumCableType.java @@ -4,23 +4,23 @@ import net.minecraft.util.IStringSerializable; import techreborn.parts.types.*; public enum EnumCableType implements IStringSerializable { - COPPER("copper", "minecraft:blocks/iron_block", 128, 4.0F, true, CopperCable.class), - TIN("tin", "minecraft:blocks/iron_block", 32, 4.0F, true, TinCable.class), - GOLD("gold", "minecraft:blocks/iron_block", 512, 3.0F, true, GoldCable.class), - HV("hv", "minecraft:blocks/iron_block", 2048, 6.0F, true, HVCable.class), - GLASSFIBER("glassfiber", "minecraft:blocks/iron_block", 8192, 4.0F, false, GlassFiberCable.class), - ICOPPER("insulatedcopper", "minecraft:blocks/iron_block", 128, 6.0F, false, InsulatedCopperCable.class), - IGOLD("insulatedgold", "minecraft:blocks/iron_block", 512, 6.0F, false, InsulatedGoldCable.class), - IHV("insulatedhv", "minecraft:blocks/iron_block", 2048, 10.0F, false, InsulatedHVCable.class); + COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, CopperCable.class), + TIN("tin", "minecraft:blocks/iron_block", 32, 4.0, true, TinCable.class), + GOLD("gold", "minecraft:blocks/iron_block", 512, 3.0, true, GoldCable.class), + HV("hv", "minecraft:blocks/iron_block", 2048, 6.0, true, HVCable.class), + GLASSFIBER("glassfiber", "minecraft:blocks/iron_block", 8192, 4.0, false, GlassFiberCable.class), + ICOPPER("insulatedcopper", "techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false, InsulatedCopperCable.class), + IGOLD("insulatedgold", "minecraft:blocks/iron_block", 512, 6.0, false, InsulatedGoldCable.class), + IHV("insulatedhv", "minecraft:blocks/iron_block", 2048, 10.0, false, InsulatedHVCable.class); private String friendlyName; public String textureName = "minecraft:blocks/iron_block"; public int transferRate= 128; - public float cableThickness = 3.0F; + public double cableThickness = 3.0; public boolean canKill = false; public Class cableClass; - EnumCableType(String friendlyName, String textureName, int transferRate, float cableThickness, boolean canKill, Class cableClass) { + EnumCableType(String friendlyName, String textureName, int transferRate, double cableThickness, boolean canKill, Class cableClass) { this.friendlyName = friendlyName; this.textureName = textureName; this.transferRate = transferRate; diff --git a/src/main/java/techreborn/parts/ItemCables.java b/src/main/java/techreborn/parts/ItemCables.java index 142fe799c..625f37677 100644 --- a/src/main/java/techreborn/parts/ItemCables.java +++ b/src/main/java/techreborn/parts/ItemCables.java @@ -14,8 +14,6 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import reborncore.RebornCore; import techreborn.client.TechRebornCreativeTab; -import techreborn.init.ModItems; -import techreborn.items.ItemTextureBase; import techreborn.lib.ModInfo; import java.security.InvalidParameterException; @@ -25,19 +23,6 @@ import java.util.List; * Created by Mark on 27/02/2016. */ public class ItemCables extends ItemMultiPart implements ITexturedItem { - - public static ItemStack getCableByName(String name, int count) { - for (int i = 0; i < EnumCableType.values().length; i++) { - if (EnumCableType.values()[i].name().equalsIgnoreCase(name)) { - return new ItemStack(TechRebornParts.cables, count, i); - } - } - throw new InvalidParameterException("The cable " + name + " could not be found."); - } - - public static ItemStack getCableByName(String name) { - return getCableByName(name, 1); - } public ItemCables() { setCreativeTab(TechRebornCreativeTab.instance); @@ -45,6 +30,7 @@ public class ItemCables extends ItemMultiPart implements ITexturedItem { setUnlocalizedName("techreborn.cable"); setNoRepair(); RebornCore.jsonDestroyer.registerObject(this); + ItemStandaloneCables.mcPartCable = this; } @Override diff --git a/src/main/java/techreborn/parts/ItemStandaloneCables.java b/src/main/java/techreborn/parts/ItemStandaloneCables.java new file mode 100644 index 000000000..bbfd9d068 --- /dev/null +++ b/src/main/java/techreborn/parts/ItemStandaloneCables.java @@ -0,0 +1,77 @@ +package techreborn.parts; + +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import reborncore.RebornCore; +import techreborn.client.TechRebornCreativeTab; +import techreborn.items.ItemTR; +import techreborn.items.ItemTextureBase; +import techreborn.lib.ModInfo; + +import java.security.InvalidParameterException; +import java.util.List; + +/** + * Created by Mark on 06/03/2016. + */ +public class ItemStandaloneCables extends ItemTextureBase { + + public static Item mcPartCable; + + public static ItemStack getCableByName(String name, int count) { + for (int i = 0; i < EnumCableType.values().length; i++) { + if (EnumCableType.values()[i].getName().equalsIgnoreCase(name)) { + return new ItemStack(mcPartCable != null? mcPartCable : StandalonePartCompact.itemStandaloneCable, count, i); + } + } + throw new InvalidParameterException("The cable " + name + " could not be found."); + } + + public static ItemStack getCableByName(String name) { + return getCableByName(name, 1); + } + + public ItemStandaloneCables() { + setCreativeTab(TechRebornCreativeTab.instance); + setHasSubtypes(true); + setUnlocalizedName("techreborn.cable"); + setNoRepair(); + RebornCore.jsonDestroyer.registerObject(this); + } + + @Override + // gets Unlocalized Name depending on meta data + public String getUnlocalizedName(ItemStack itemStack) { + int meta = itemStack.getItemDamage(); + if (meta < 0 || meta >= EnumCableType.values().length) { + meta = 0; + } + + return super.getUnlocalizedName() + "." + EnumCableType.values()[meta]; + } + + // Adds Dusts SubItems To Creative Tab + public void getSubItems(Item item, CreativeTabs creativeTabs, List list) { + for (int meta = 0; meta < EnumCableType.values().length; ++meta) { + list.add(new ItemStack(item, 1, meta)); + } + } + + @Override + public String getTextureName(int damage) { + return ModInfo.MOD_ID + ":items/cables/" + EnumCableType.values()[damage]; + } + + @Override + public int getMaxMeta() { + return EnumCableType.values().length; + } + + @Override + public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) { + return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory"); + } +} diff --git a/src/main/java/techreborn/parts/StandalonePartCompact.java b/src/main/java/techreborn/parts/StandalonePartCompact.java new file mode 100644 index 000000000..9d8cd3722 --- /dev/null +++ b/src/main/java/techreborn/parts/StandalonePartCompact.java @@ -0,0 +1,37 @@ +package techreborn.parts; + +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; +import techreborn.compat.ICompatModule; + +/** + * Created by Mark on 06/03/2016. + */ +public class StandalonePartCompact implements ICompatModule { + + public static ItemStandaloneCables itemStandaloneCable; + + @Override + public void preInit(FMLPreInitializationEvent event) { + + } + + @Override + public void init(FMLInitializationEvent event) { + itemStandaloneCable = new ItemStandaloneCables(); + GameRegistry.registerItem(itemStandaloneCable, "cables"); + } + + @Override + public void postInit(FMLPostInitializationEvent event) { + + } + + @Override + public void serverStarting(FMLServerStartingEvent event) { + + } +} diff --git a/src/main/java/techreborn/proxies/ClientProxy.java b/src/main/java/techreborn/proxies/ClientProxy.java index 4e93cbe87..197c97f19 100644 --- a/src/main/java/techreborn/proxies/ClientProxy.java +++ b/src/main/java/techreborn/proxies/ClientProxy.java @@ -24,7 +24,8 @@ public class ClientProxy extends CommonProxy { MinecraftForge.EVENT_BUS.register(new VersionCheckerClient()); MinecraftForge.EVENT_BUS.register(new StackToolTipEvent()); multiblockRenderEvent = new MultiblockRenderEvent(); - MinecraftForge.EVENT_BUS.register(multiblockRenderEvent); + //MinecraftForge.EVENT_BUS.register(multiblockRenderEvent); + //TODO FIX ME ClientRegistry.registerKeyBinding(KeyBindings.config); ClientMultiBlocks.init(); } diff --git a/src/main/java/techreborn/tiles/TileIronFurnace.java b/src/main/java/techreborn/tiles/TileIronFurnace.java new file mode 100644 index 000000000..3c4eed541 --- /dev/null +++ b/src/main/java/techreborn/tiles/TileIronFurnace.java @@ -0,0 +1,349 @@ +package techreborn.tiles; + +import ic2.api.tile.IWrenchable; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFurnace; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemHoe; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.item.ItemTool; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraftforge.fml.common.registry.GameRegistry; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import reborncore.common.blocks.BlockMachineBase; +import reborncore.common.tile.TileMachineBase; +import reborncore.common.util.Inventory; +import reborncore.common.util.ItemUtils; +import techreborn.api.recipe.IBaseRecipeType; +import techreborn.api.recipe.RecipeHandler; +import techreborn.init.ModBlocks; +import techreborn.lib.Reference; + +public class TileIronFurnace extends TileMachineBase implements IInventory { + + public int tickTime; + public Inventory inventory = new Inventory(3, "TileIronFurnace", 64, this); + + int input1 = 0; + int output = 1; + int fuelslot = 2; + + boolean active = false; + public int fuel; + public int fuelGague; + public int progress; + public int fuelScale = 200; + + public int gaugeProgressScaled (int scale) + { + return (progress * scale) / fuelScale; + } + + public int gaugeFuelScaled (int scale) + { + if (fuelGague == 0) + { + fuelGague = fuel; + if (fuelGague == 0) + { + fuelGague = fuelScale; + } + } + return (fuel * scale) / fuelGague; + } + + @Override + public void updateEntity () + { + boolean burning = isBurning(); + boolean updateInventory = false; + if (fuel <= 0 && canSmelt()) + { + fuel = fuelGague = (int) (getItemBurnTime(getStackInSlot(fuelslot))); + if (fuel > 0) + { + if (getStackInSlot(fuelslot).getItem().hasContainerItem()) // Fuel slot + { + setInventorySlotContents(fuelslot, new ItemStack(getStackInSlot(fuelslot).getItem().getContainerItem())); + } + else if(getStackInSlot(fuelslot).stackSize > 1) + { + decrStackSize(fuelslot, 1); + } + else if (getStackInSlot(fuelslot).stackSize == 1) + { + setInventorySlotContents(fuelslot, null); + } + updateInventory = true; + } + } + if (isBurning() && canSmelt()) + { + updateState(); + + progress++; + if (progress >= fuelScale) + { + progress = 0; + cookItems(); + updateInventory = true; + } + } + else + { + progress = 0; + updateState(); + } + if (fuel > 0) + { + fuel--; + } + if (burning != isBurning()) + { + this.active = true; + updateInventory = true; + } + if (updateInventory) + { + markDirty(); + } + } + + public void cookItems () + { + if (this.canSmelt()) + { + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1)); + + if (getStackInSlot(output) == null) + { + setInventorySlotContents(output, itemstack.copy()); + } + else if (getStackInSlot(output).isItemEqual(itemstack)) + { + getStackInSlot(output).stackSize += itemstack.stackSize; + } + if(getStackInSlot(input1).stackSize > 1) + { + this.decrStackSize(input1, 1); + } + else + { + setInventorySlotContents(input1, null); + } + } + } + + public boolean canSmelt () + { + if (getStackInSlot(input1) == null) + { + return false; + } + else + { + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1)); + if (itemstack == null) + return false; + if (getStackInSlot(output) == null) + return true; + if (!getStackInSlot(output).isItemEqual(itemstack)) + return false; + int result = getStackInSlot(output).stackSize + itemstack.stackSize; + return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize()); + } + } + + public boolean isBurning () + { + return fuel > 0; + } + + public ItemStack getResultFor (ItemStack stack) + { + ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack); + if (result != null) + { + return result.copy(); + } + return null; + } + + public static int getItemBurnTime (ItemStack stack) + { + if (stack == null) + { + return 0; + } + else + { + Item item = stack.getItem(); + + if (stack.getItem() instanceof ItemBlock && Block.getBlockFromItem(item) != null) + { + Block block = Block.getBlockFromItem(item); + + if (block == Blocks.wooden_slab) + { + return 150; + } + + if (block == Blocks.log) + { + return 1200; + } + + if (block.getMaterial() == Material.wood) + { + return 300; + } + + if (block == Blocks.coal_block) + { + return 16000; + } + } + + if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) + return 200; + if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) + return 200; + if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) + return 200; + if (item == Items.stick) + return 100; + if (item == Items.coal) + return 1600; + if (item == Items.lava_bucket) + return 20000; + if (item == new ItemStack(Blocks.sapling).getItem()) + return 100; + if (item == Items.blaze_rod) + return 2400; + return GameRegistry.getFuelValue(stack); + } + } + + public void updateState(){ + IBlockState blockState = worldObj.getBlockState(pos); + if(blockState.getBlock() instanceof BlockMachineBase){ + BlockMachineBase blockMachineBase = (BlockMachineBase) blockState.getBlock(); + if(blockState.getValue(BlockMachineBase.ACTIVE) != progress > 0) + blockMachineBase.setActive(progress > 0, worldObj, pos); + } + } + + @Override + public void readFromNBT(NBTTagCompound tagCompound) { + super.readFromNBT(tagCompound); + inventory.readFromNBT(tagCompound); + + } + + @Override + public void writeToNBT(NBTTagCompound tagCompound) { + super.writeToNBT(tagCompound); + inventory.writeToNBT(tagCompound); + + } + + @Override + public int getSizeInventory() { + return inventory.getSizeInventory(); + } + + @Override + public ItemStack getStackInSlot(int slot) { + return inventory.getStackInSlot(slot); + } + + @Override + public ItemStack decrStackSize(int slot, int amount) { + return inventory.decrStackSize(slot, amount); + } + + @Override + public ItemStack removeStackFromSlot(int slot) { + return inventory.removeStackFromSlot(slot); + } + + @Override + public void setInventorySlotContents(int slot, ItemStack stack) { + inventory.setInventorySlotContents(slot, stack); + } + + + @Override + public int getInventoryStackLimit() { + return inventory.getInventoryStackLimit(); + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) { + return inventory.isUseableByPlayer(player); + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack stack) { + return inventory.isItemValidForSlot(slot, stack); + } + + @Override + public void openInventory(EntityPlayer player) { + inventory.openInventory(player); + } + + @Override + public void closeInventory(EntityPlayer player) { + inventory.closeInventory(player); + } + + + @Override + public int getField(int id) { + return inventory.getField(id); + } + + @Override + public void setField(int id, int value) { + inventory.setField(id, value); + } + + @Override + public int getFieldCount() { + return inventory.getFieldCount(); + } + + @Override + public void clear() { + inventory.clear(); + } + + @Override + public String getName() { + return inventory.getName(); + } + + @Override + public boolean hasCustomName() { + return inventory.hasCustomName(); + } + + @Override + public IChatComponent getDisplayName() { + return inventory.getDisplayName(); + } +} diff --git a/src/main/java/techreborn/tiles/generator/TileGenerator.java b/src/main/java/techreborn/tiles/generator/TileGenerator.java index 981132238..5424d0a0e 100644 --- a/src/main/java/techreborn/tiles/generator/TileGenerator.java +++ b/src/main/java/techreborn/tiles/generator/TileGenerator.java @@ -5,6 +5,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; @@ -140,7 +141,7 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn @Override public double getMaxPower() { - return ConfigTechReborn.ThermalGeneratorCharge; + return 10000; } @Override @@ -213,5 +214,16 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn public ItemStack getWrenchDrop(EntityPlayer p0) { return new ItemStack(ModBlocks.Generator); } + + @Override + public void readFromNBT(NBTTagCompound tagCompound) { + super.readFromNBT(tagCompound); + inventory.readFromNBT(tagCompound); + } + @Override + public void writeToNBT(NBTTagCompound tagCompound) { + super.writeToNBT(tagCompound); + inventory.writeToNBT(tagCompound); + } } diff --git a/src/main/java/techreborn/tiles/teir1/TileCompressor.java b/src/main/java/techreborn/tiles/teir1/TileCompressor.java index a624e8f30..dea952dce 100644 --- a/src/main/java/techreborn/tiles/teir1/TileCompressor.java +++ b/src/main/java/techreborn/tiles/teir1/TileCompressor.java @@ -62,7 +62,7 @@ public class TileCompressor extends TilePowerAcceptor implements IWrenchable, II @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { - return new ItemStack(ModBlocks.AlloySmelter, 1); + return new ItemStack(ModBlocks.Compressor, 1); } public boolean isComplete() { @@ -83,15 +83,6 @@ public class TileCompressor extends TilePowerAcceptor implements IWrenchable, II crafter.writeToNBT(tagCompound); } -// @Override -// public void addWailaInfo(List info){ -// super.addWailaInfo(info); -// info.add("Power Stored " + energy.getEnergyStored() + "/" + energy.getCapacity() +" EU"); -// if(crafter.currentRecipe !=null){ -// info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t"); -// } -// } - @Override public int getSizeInventory() { return inventory.getSizeInventory(); diff --git a/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java b/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java index f7f4be240..8490b306c 100644 --- a/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java +++ b/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java @@ -1,33 +1,148 @@ package techreborn.tiles.teir1; import ic2.api.tile.IWrenchable; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; +import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.util.Inventory; import techreborn.init.ModBlocks; -public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory{ +public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory { public Inventory inventory = new Inventory(6, "TileElectricFurnace", 64, this); + int input1 = 0; + int output = 1; public int capacity = 1000; + public int progress; + public int fuelScale = 100; + public int cost = 10; public TileElectricFurnace() { super(1); } - @Override - public void updateEntity() + public int gaugeProgressScaled (int scale) { - super.updateEntity(); - if(!worldObj.isRemote) + return (progress * scale) / fuelScale; + } + + @Override + public void updateEntity () + { + boolean burning = isBurning(); + boolean updateInventory = false; + if (getEnergy() <= cost && canSmelt()) { - + if (getEnergy() > cost) + { + updateInventory = true; + } + } + if (isBurning() && canSmelt()) + { + updateState(); + + progress++; + if (progress >= fuelScale) + { + progress = 0; + cookItems(); + updateInventory = true; + } + } + else + { + progress = 0; + updateState(); + } + if (burning != isBurning()) + { + updateInventory = true; + } + if (updateInventory) + { + markDirty(); + } + } + + public void cookItems () + { + if (this.canSmelt()) + { + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1)); + + if (getStackInSlot(output) == null) + { + useEnergy(cost); + setInventorySlotContents(output, itemstack.copy()); + } + else if (getStackInSlot(output).isItemEqual(itemstack)) + { + useEnergy(cost); + getStackInSlot(output).stackSize += itemstack.stackSize; + } + if(getStackInSlot(input1).stackSize > 1) + { + useEnergy(cost); + this.decrStackSize(input1, 1); + } + else + { + useEnergy(cost); + setInventorySlotContents(input1, null); + } + } + } + + public boolean canSmelt () + { + if (getStackInSlot(input1) == null) + { + return false; + } + else + { + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1)); + if (itemstack == null) + return false; + if (getStackInSlot(output) == null) + return true; + if (!getStackInSlot(output).isItemEqual(itemstack)) + return false; + int result = getStackInSlot(output).stackSize + itemstack.stackSize; + return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize()); + } + } + + public boolean isBurning () + { + return getEnergy() > cost; + } + + public ItemStack getResultFor (ItemStack stack) + { + ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack); + if (result != null) + { + return result.copy(); + } + return null; + } + + public void updateState(){ + IBlockState blockState = worldObj.getBlockState(pos); + if(blockState.getBlock() instanceof BlockMachineBase){ + BlockMachineBase blockMachineBase = (BlockMachineBase) blockState.getBlock(); + if(blockState.getValue(BlockMachineBase.ACTIVE) != progress > 0) + blockMachineBase.setActive(progress > 0, worldObj, pos); } } @@ -67,25 +182,14 @@ public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchabl public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); inventory.readFromNBT(tagCompound); -// crafter.readFromNBT(tagCompound); } @Override public void writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); inventory.writeToNBT(tagCompound); -// crafter.writeToNBT(tagCompound); } -// @Override -// public void addWailaInfo(List info){ -// super.addWailaInfo(info); -// info.add("Power Stored " + energy.getEnergyStored() + "/" + energy.getCapacity() +" EU"); -// if(crafter.currentRecipe !=null){ -// info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t"); -// } -// } - @Override public int getSizeInventory() { return inventory.getSizeInventory(); @@ -146,13 +250,6 @@ public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchabl return slotIndex == 2; } -// public int getProgressScaled(int scale) { -// if (crafter.currentTickTime != 0) { -// return crafter.currentTickTime * scale / crafter.currentNeededTicks; -// } -// return 0; -// } - @Override public double getMaxPower() { return capacity; diff --git a/src/main/java/techreborn/tiles/teir1/TileExtractor.java b/src/main/java/techreborn/tiles/teir1/TileExtractor.java index f370467a8..c37fa537c 100644 --- a/src/main/java/techreborn/tiles/teir1/TileExtractor.java +++ b/src/main/java/techreborn/tiles/teir1/TileExtractor.java @@ -62,7 +62,7 @@ public class TileExtractor extends TilePowerAcceptor implements IWrenchable, IIn @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { - return new ItemStack(ModBlocks.AlloySmelter, 1); + return new ItemStack(ModBlocks.Extractor, 1); } public boolean isComplete() { @@ -83,15 +83,6 @@ public class TileExtractor extends TilePowerAcceptor implements IWrenchable, IIn crafter.writeToNBT(tagCompound); } -// @Override -// public void addWailaInfo(List info){ -// super.addWailaInfo(info); -// info.add("Power Stored " + energy.getEnergyStored() + "/" + energy.getCapacity() +" EU"); -// if(crafter.currentRecipe !=null){ -// info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t"); -// } -// } - @Override public int getSizeInventory() { return inventory.getSizeInventory(); diff --git a/src/main/java/techreborn/tiles/teir1/TileGrinder.java b/src/main/java/techreborn/tiles/teir1/TileGrinder.java index 4abe16445..b93fdb6ce 100644 --- a/src/main/java/techreborn/tiles/teir1/TileGrinder.java +++ b/src/main/java/techreborn/tiles/teir1/TileGrinder.java @@ -33,7 +33,6 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInve public void updateEntity() { super.updateEntity(); crafter.updateEntity(); -// upgrades.tick(); charge(3); } @@ -62,7 +61,7 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInve @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { - return new ItemStack(ModBlocks.AlloySmelter, 1); + return new ItemStack(ModBlocks.Grinder, 1); } public boolean isComplete() { @@ -83,15 +82,6 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInve crafter.writeToNBT(tagCompound); } -// @Override -// public void addWailaInfo(List info){ -// super.addWailaInfo(info); -// info.add("Power Stored " + energy.getEnergyStored() + "/" + energy.getCapacity() +" EU"); -// if(crafter.currentRecipe !=null){ -// info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t"); -// } -// } - @Override public int getSizeInventory() { return inventory.getSizeInventory(); diff --git a/src/main/java/techreborn/utils/damageSources/ElectrialShockSource.java b/src/main/java/techreborn/utils/damageSources/ElectrialShockSource.java new file mode 100644 index 000000000..325877c6c --- /dev/null +++ b/src/main/java/techreborn/utils/damageSources/ElectrialShockSource.java @@ -0,0 +1,12 @@ +package techreborn.utils.damageSources; + +import net.minecraft.util.DamageSource; + +/** + * Created by mark on 06/03/2016. + */ +public class ElectrialShockSource extends DamageSource { + public ElectrialShockSource() { + super("shock"); + } +} diff --git a/src/main/java/techreborn/utils/damageSources/FusionDamageSource.java b/src/main/java/techreborn/utils/damageSources/FusionDamageSource.java new file mode 100644 index 000000000..39e7d6f81 --- /dev/null +++ b/src/main/java/techreborn/utils/damageSources/FusionDamageSource.java @@ -0,0 +1,12 @@ +package techreborn.utils.damageSources; + +import net.minecraft.util.DamageSource; + +/** + * Created by Mark on 05/03/2016. + */ +public class FusionDamageSource extends DamageSource { + public FusionDamageSource() { + super("fusion"); + } +} diff --git a/src/main/resources/assets/techreborn/lang/en_US.lang b/src/main/resources/assets/techreborn/lang/en_US.lang index 2371c21d0..959943e8b 100644 --- a/src/main/resources/assets/techreborn/lang/en_US.lang +++ b/src/main/resources/assets/techreborn/lang/en_US.lang @@ -67,6 +67,7 @@ tile.techreborn.storage2.tin.name=Tin Block tile.techreborn.solarpanel.name=Solar panel tile.techreborn.watermill.name=Water Mill tile.techreborn.windmill.name=Wind Mill +tile.techreborn.ironfurnace.name=Iron Furnace #Blocks tile.techreborn.rubberlog.name=Rubber Wood @@ -268,6 +269,18 @@ item.techreborn.dust.zinc.name=Zinc Dust item.techreborn.dust.galena.name=Galena Dust item.techreborn.dust.greenSapphire.name=Green Sapphire Dust item.techreborn.dust.sawDust.name=Saw Dust +item.techreborn.lapotroncrystal.name=Lapotron Crystal +item.techreborn.energycrystal.name=Energy Crystal +item.techreborn.ingot.refinediron.name=Refined Iron +item.techreborn.wrench.name=Wrench +item.techreborn.cable.COPPER.name=Copper Cable +item.techreborn.cable.TIN.name=Tin Cable +item.techreborn.cable.GOLD.name=Gold Cable +item.techreborn.cable.HV.name=HV Cable +item.techreborn.cable.GLASSFIBER.name=Glass Fiber Cable +item.techreborn.cable.ICOPPER.name=Insulated Copper Cable +item.techreborn.cable.IGOLD.name=Insulated Gold Cable +item.techreborn.cable.IHV.name=Insulated HV Cable #Small Dusts diff --git a/src/main/resources/assets/techreborn/sounds.json b/src/main/resources/assets/techreborn/sounds.json index 744cf2902..058d87ef0 100644 --- a/src/main/resources/assets/techreborn/sounds.json +++ b/src/main/resources/assets/techreborn/sounds.json @@ -1,4 +1,5 @@ { "sap_extract": { "category": "block", "sounds":["sap_extract"] }, - "block_dismantle": { "category": "block", "sounds":["block_dismantle"] } + "block_dismantle": { "category": "block", "sounds":["block_dismantle"] }, + "cable_shock": { "category": "block", "sounds":["cable_shock"] } } \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/sounds/cable_shock.ogg b/src/main/resources/assets/techreborn/sounds/cable_shock.ogg new file mode 100644 index 000000000..d23d5b3ed Binary files /dev/null and b/src/main/resources/assets/techreborn/sounds/cable_shock.ogg differ