From 1e24d1f116c525f7827160580fd2c5b0ba97712c Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sat, 5 Mar 2016 18:10:36 +0000 Subject: [PATCH 01/36] Texture Rendering for cables --- .../render/parts/ClientPartModelBakery.java | 12 ++++++++++- .../client/render/parts/RenderCablePart.java | 4 ++-- .../java/techreborn/parts/CableMultipart.java | 2 +- .../java/techreborn/parts/EnumCableType.java | 20 +++++++++---------- 4 files changed, 24 insertions(+), 14 deletions(-) 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/parts/CableMultipart.java b/src/main/java/techreborn/parts/CableMultipart.java index 01781c2bb..3c17e80c6 100644 --- a/src/main/java/techreborn/parts/CableMultipart.java +++ b/src/main/java/techreborn/parts/CableMultipart.java @@ -57,7 +57,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); 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; From 71062a55bd288b915344d49d4160443cc072db00 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sat, 5 Mar 2016 19:09:07 +0000 Subject: [PATCH 02/36] Fusion reactor now kills the player, coils to come soon --- .../blocks/BlockFusionControlComputer.java | 13 +++++- .../client/gui/GuiFusionReactor.java | 46 +++++++++---------- .../damageSources/FusionDamageSource.java | 12 +++++ 3 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 src/main/java/techreborn/utils/damageSources/FusionDamageSource.java 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/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/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"); + } +} From 694aae55ff7b4211223c883c14ff09330c3f0778 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 19:42:22 +0000 Subject: [PATCH 03/36] some recipe things --- src/main/java/techreborn/init/ModRecipes.java | 7 +++++++ src/main/java/techreborn/items/ItemIngots.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 970899996..4688638bd 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -44,6 +44,7 @@ import techreborn.items.ItemIngots; import techreborn.items.ItemNuggets; import techreborn.items.ItemParts; import techreborn.items.ItemPlates; +import techreborn.parts.ItemCables; import techreborn.utils.RecipeUtils; public class @@ -149,6 +150,12 @@ public class 'A', "ingot" + name.substring(0, 1).toUpperCase() + name.substring(1)); } + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("electronicCircuit"), + "WWW", "SRS", "WWW", + 'R', ItemIngots.getIngotByName("refinediron"), + 'S', Items.redstone, + 'W', ItemCables.getCableByName("insulatedcopper")); + CraftingHelper.addShapedOreRecipe(BlockMachineFrame.getFrameByName("machine", 1), "AAA", "AXA", "AAA", 'A', ItemPlates.getPlateByName("iron")); 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() { From cda9b4ff81ec749d4a70bb36d73cbc44b2722096 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 20:37:04 +0000 Subject: [PATCH 04/36] spent a hour trying to figure out why I was crashing --- src/main/java/techreborn/init/ModRecipes.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 4688638bd..a470204bf 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -150,11 +150,11 @@ public class 'A', "ingot" + name.substring(0, 1).toUpperCase() + name.substring(1)); } - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("electronicCircuit"), - "WWW", "SRS", "WWW", - 'R', ItemIngots.getIngotByName("refinediron"), - 'S', Items.redstone, - 'W', ItemCables.getCableByName("insulatedcopper")); +// CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("electronicCircuit"), +// "WWW", "SRS", "WWW", +// 'R', ItemIngots.getIngotByName("refinediron"), +// 'S', Items.redstone, +// 'W', ItemCables.getCableByName("insulatedcopper")); CraftingHelper.addShapedOreRecipe(BlockMachineFrame.getFrameByName("machine", 1), "AAA", "AXA", "AAA", From 5400dff4d3cd4f5a14549801e1b6ff619746b433 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 22:27:38 +0000 Subject: [PATCH 05/36] some recipes --- src/main/java/techreborn/init/ModRecipes.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index a470204bf..a6ad80969 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -4,6 +4,7 @@ import java.security.InvalidParameterException; import org.apache.commons.lang3.ArrayUtils; +import net.minecraft.client.model.ModelPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -44,7 +45,9 @@ import techreborn.items.ItemIngots; import techreborn.items.ItemNuggets; import techreborn.items.ItemParts; import techreborn.items.ItemPlates; +import techreborn.parts.EnumCableType; import techreborn.parts.ItemCables; +import techreborn.parts.TechRebornParts; import techreborn.utils.RecipeUtils; public class @@ -114,6 +117,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(){ @@ -154,11 +159,20 @@ public class // "WWW", "SRS", "WWW", // 'R', ItemIngots.getIngotByName("refinediron"), // 'S', Items.redstone, -// 'W', ItemCables.getCableByName("insulatedcopper")); +// 'W', ItemCables.getCableByName("copper")); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("advancedCircuit"), + "RGR", "LCL", "RGR", + 'R', Items.redstone, + 'G', Items.glowstone_dust, + 'L', Items.dye, 4, + '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", @@ -1298,7 +1312,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")); @@ -2371,7 +2385,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")); From 3302d633858e7e999673ade1c66871cdd5372b16 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 22:50:39 +0000 Subject: [PATCH 06/36] Added lapatron and energy crystals --- src/main/java/techreborn/init/ModItems.java | 7 +++ .../java/techreborn/init/RecipeCompact.java | 2 + .../techreborn/items/ItemEnergyCrystal.java | 57 +++++++++++++++++++ .../techreborn/items/ItemLapotronCrystal.java | 57 +++++++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 src/main/java/techreborn/items/ItemEnergyCrystal.java create mode 100644 src/main/java/techreborn/items/ItemLapotronCrystal.java 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/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/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; + } +} From 382c38ed10d6aa62a5570e2ab3a0d892efc5f387 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 22:50:51 +0000 Subject: [PATCH 07/36] added a few more recipes --- src/main/java/techreborn/init/ModRecipes.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index a6ad80969..cf1ead96a 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -4,7 +4,6 @@ import java.security.InvalidParameterException; import org.apache.commons.lang3.ArrayUtils; -import net.minecraft.client.model.ModelPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -45,9 +44,6 @@ import techreborn.items.ItemIngots; import techreborn.items.ItemNuggets; import techreborn.items.ItemParts; import techreborn.items.ItemPlates; -import techreborn.parts.EnumCableType; -import techreborn.parts.ItemCables; -import techreborn.parts.TechRebornParts; import techreborn.utils.RecipeUtils; public class @@ -165,9 +161,20 @@ public class "RGR", "LCL", "RGR", 'R', Items.redstone, 'G', Items.glowstone_dust, - 'L', Items.dye, 4, + '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), @@ -183,15 +190,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), From f1cbfc471ba9215867048bd731f8c00d8ea2faf3 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 22:56:52 +0000 Subject: [PATCH 08/36] set wrench stack size to 1 --- src/main/java/techreborn/items/tools/ItemWrench.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/techreborn/items/tools/ItemWrench.java b/src/main/java/techreborn/items/tools/ItemWrench.java index 7319feda5..7597718db 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()){ From a9ad808dcb22703b36c824d846a839207ecfd37c Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 23:00:12 +0000 Subject: [PATCH 09/36] Added missing localization --- src/main/resources/assets/techreborn/lang/en_US.lang | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/resources/assets/techreborn/lang/en_US.lang b/src/main/resources/assets/techreborn/lang/en_US.lang index 2371c21d0..00b375c33 100644 --- a/src/main/resources/assets/techreborn/lang/en_US.lang +++ b/src/main/resources/assets/techreborn/lang/en_US.lang @@ -268,6 +268,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 From bbfa430e96fabd6cf002e628326d6f32a7e2427b Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 23:04:40 +0000 Subject: [PATCH 10/36] Added recipe to wrench --- src/main/java/techreborn/init/ModRecipes.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index cf1ead96a..09fc94111 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -157,6 +157,10 @@ public class // 'S', Items.redstone, // 'W', ItemCables.getCableByName("copper")); + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.wrench), + "BAB", "BBB", "ABA", + 'B', "ingotBronze"); + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("advancedCircuit"), "RGR", "LCL", "RGR", 'R', Items.redstone, From e96fe4bea7c3d99a7ddb83adc18a03b2dea577ac Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 23:31:22 +0000 Subject: [PATCH 11/36] grinder now returns grinder --- src/main/java/techreborn/tiles/teir1/TileGrinder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/techreborn/tiles/teir1/TileGrinder.java b/src/main/java/techreborn/tiles/teir1/TileGrinder.java index 4abe16445..d550b0129 100644 --- a/src/main/java/techreborn/tiles/teir1/TileGrinder.java +++ b/src/main/java/techreborn/tiles/teir1/TileGrinder.java @@ -62,7 +62,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() { From 0f505c8b6b95d14ae9df82034c2a0382675b97ce Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 23:31:32 +0000 Subject: [PATCH 12/36] More Recipes --- src/main/java/techreborn/init/ModRecipes.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 09fc94111..26604b4a6 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -150,16 +150,29 @@ public class "AAA", "AAA", "AAA", 'A', "ingot" + name.substring(0, 1).toUpperCase() + name.substring(1)); } - + //TODO can't use cables in recipes // CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("electronicCircuit"), // "WWW", "SRS", "WWW", // 'R', ItemIngots.getIngotByName("refinediron"), // 'S', Items.redstone, // 'W', ItemCables.getCableByName("copper")); - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.wrench), - "BAB", "BBB", "ABA", - 'B', "ingotBronze"); + 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", From 087c97780f994c4577938edfae6dd4a488a3ffa1 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sat, 5 Mar 2016 23:31:46 +0000 Subject: [PATCH 13/36] Added reinforced Glass --- .../blocks/BlockReinforcedGlass.java | 38 +++++++++++++++++++ src/main/java/techreborn/init/ModBlocks.java | 4 ++ 2 files changed, 42 insertions(+) create mode 100644 src/main/java/techreborn/blocks/BlockReinforcedGlass.java 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/init/ModBlocks.java b/src/main/java/techreborn/init/ModBlocks.java index f7c530946..89e1dc9c2 100644 --- a/src/main/java/techreborn/init/ModBlocks.java +++ b/src/main/java/techreborn/init/ModBlocks.java @@ -134,6 +134,7 @@ public class ModBlocks { public static Block storage; public static Block storage2; public static Block machineframe; + public static Block reinforcedglass; public static Block rubberLog; public static Block rubberLeaves; @@ -360,6 +361,9 @@ public class ModBlocks { ironFence = new BlockIronFence(); GameRegistry.registerBlock(ironFence, "ironFence"); + + reinforcedglass = new BlockReinforcedGlass(Material.glass); + GameRegistry.registerBlock(reinforcedglass, "reinforcedglass"); registerOreDict(); Core.logHelper.info("TechReborns Blocks Loaded"); From 391b28e50f31aa3c20150e523744e1ff21e5969a Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 13:20:38 +0000 Subject: [PATCH 14/36] Added Extractor JEI support thanks @mezz for making this so easy :) --- .../compat/jei/RecipeCategoryUids.java | 1 + .../compat/jei/TechRebornJeiPlugin.java | 13 +++- .../extractor/ExtractorRecipeCategory.java | 59 +++++++++++++++++++ .../jei/extractor/ExtractorRecipeHandler.java | 42 +++++++++++++ .../jei/extractor/ExtractorRecipeWrapper.java | 33 +++++++++++ src/main/java/techreborn/init/ModRecipes.java | 9 ++- 6 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeCategory.java create mode 100644 src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeHandler.java create mode 100644 src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeWrapper.java diff --git a/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java b/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java index e3f8272f8..f88327cc7 100644 --- a/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java +++ b/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java @@ -17,4 +17,5 @@ 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"; } diff --git a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java index 5f0639332..816325df8 100644 --- a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java +++ b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java @@ -24,6 +24,7 @@ import techreborn.client.container.ContainerAssemblingMachine; import techreborn.client.container.ContainerBlastFurnace; import techreborn.client.container.ContainerCentrifuge; import techreborn.client.container.ContainerChemicalReactor; +import techreborn.client.container.ContainerExtractor; import techreborn.client.container.ContainerFusionReactor; import techreborn.client.container.ContainerGrinder; import techreborn.client.container.ContainerImplosionCompressor; @@ -38,6 +39,7 @@ import techreborn.client.gui.GuiAssemblingMachine; import techreborn.client.gui.GuiBlastFurnace; import techreborn.client.gui.GuiCentrifuge; import techreborn.client.gui.GuiChemicalReactor; +import techreborn.client.gui.GuiExtractor; import techreborn.client.gui.GuiFusionReactor; import techreborn.client.gui.GuiGrinder; import techreborn.client.gui.GuiImplosionCompressor; @@ -56,6 +58,8 @@ 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.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 +98,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin { new IndustrialSawmillRecipeCategory(guiHelper), new RollingMachineRecipeCategory(guiHelper), new VacuumFreezerRecipeCategory(guiHelper), - new GrinderRecipeCategory(guiHelper) + new GrinderRecipeCategory(guiHelper), + new ExtractorRecipeCategory(guiHelper) ); registry.addRecipeHandlers( @@ -110,7 +115,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin { new IndustrialSawmillRecipeHandler(jeiHelpers), new RollingMachineRecipeHandler(), new VacuumFreezerRecipeHandler(jeiHelpers), - new GrinderRecipeHandler(jeiHelpers) + new GrinderRecipeHandler(jeiHelpers), + new ExtractorRecipeHandler(jeiHelpers) ); registry.addRecipes(RecipeHandler.recipeList); @@ -144,6 +150,7 @@ 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); IRecipeTransferRegistry recipeTransferRegistry = registry.getRecipeTransferRegistry(); @@ -162,7 +169,7 @@ 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); } private static void addDebugRecipes(IModRegistry registry) { 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/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 26604b4a6..666de795c 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -23,6 +23,7 @@ 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.ExtractorRecipe; import techreborn.api.recipe.machines.GrinderRecipe; import techreborn.api.recipe.machines.ImplosionCompressorRecipe; import techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe; @@ -73,9 +74,15 @@ public class addGrinderRecipes(); addHammerRecipes(); addIc2ReplacementReicpes(); + addExtractorRecipes(); } - static void addIc2ReplacementReicpes(){ + 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", From 6462569b73cc2af95954402b1c9ba328e2b7e0b2 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 6 Mar 2016 13:30:31 +0000 Subject: [PATCH 15/36] Temp fix for #371 --- src/main/java/techreborn/proxies/ClientProxy.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(); } From fcb8cc0a8e3096616bfb89f91c2ece221163315c Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 13:33:35 +0000 Subject: [PATCH 16/36] Compressor Jei Support --- .../compat/jei/RecipeCategoryUids.java | 1 + .../compat/jei/TechRebornJeiPlugin.java | 13 +++- .../compressor/CompressorRecipeCategory.java | 59 +++++++++++++++++++ .../compressor/CompressorRecipeHandler.java | 42 +++++++++++++ .../compressor/CompressorRecipeWrapper.java | 33 +++++++++++ src/main/java/techreborn/init/ModRecipes.java | 8 ++- 6 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 src/main/java/techreborn/compat/jei/compressor/CompressorRecipeCategory.java create mode 100644 src/main/java/techreborn/compat/jei/compressor/CompressorRecipeHandler.java create mode 100644 src/main/java/techreborn/compat/jei/compressor/CompressorRecipeWrapper.java diff --git a/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java b/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java index f88327cc7..1c52018a2 100644 --- a/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java +++ b/src/main/java/techreborn/compat/jei/RecipeCategoryUids.java @@ -18,4 +18,5 @@ public class RecipeCategoryUids { 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 816325df8..63faa1a00 100644 --- a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java +++ b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java @@ -24,6 +24,7 @@ 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; @@ -39,6 +40,7 @@ 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; @@ -58,6 +60,8 @@ 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; @@ -99,7 +103,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin { new RollingMachineRecipeCategory(guiHelper), new VacuumFreezerRecipeCategory(guiHelper), new GrinderRecipeCategory(guiHelper), - new ExtractorRecipeCategory(guiHelper) + new ExtractorRecipeCategory(guiHelper), + new CompressorRecipeCategory(guiHelper) ); registry.addRecipeHandlers( @@ -116,7 +121,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin { new RollingMachineRecipeHandler(), new VacuumFreezerRecipeHandler(jeiHelpers), new GrinderRecipeHandler(jeiHelpers), - new ExtractorRecipeHandler(jeiHelpers) + new ExtractorRecipeHandler(jeiHelpers), + new CompressorRecipeHandler(jeiHelpers) ); registry.addRecipes(RecipeHandler.recipeList); @@ -151,6 +157,7 @@ public class TechRebornJeiPlugin extends BlankModPlugin { 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); IRecipeTransferRegistry recipeTransferRegistry = registry.getRecipeTransferRegistry(); @@ -170,6 +177,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin { 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); + } private static void addDebugRecipes(IModRegistry registry) { 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/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 666de795c..f2fefa7d7 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -23,6 +23,7 @@ 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; @@ -75,9 +76,14 @@ public class addHammerRecipes(); addIc2ReplacementReicpes(); addExtractorRecipes(); + addCompressorRecipes(); } - static void addExtractorRecipes() { + 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)); } From 8b5a2dc87aae59bbdc60c180b788fb6c308137b8 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 6 Mar 2016 13:37:46 +0000 Subject: [PATCH 17/36] Fixes recipe crashing --- src/main/java/techreborn/init/ModRecipes.java | 13 +++++++------ src/main/java/techreborn/parts/ItemCables.java | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 666de795c..2e3f91069 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -45,6 +45,7 @@ import techreborn.items.ItemIngots; import techreborn.items.ItemNuggets; import techreborn.items.ItemParts; import techreborn.items.ItemPlates; +import techreborn.parts.ItemCables; import techreborn.utils.RecipeUtils; public class @@ -157,12 +158,12 @@ public class "AAA", "AAA", "AAA", 'A', "ingot" + name.substring(0, 1).toUpperCase() + name.substring(1)); } - //TODO can't use cables in recipes -// CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("electronicCircuit"), -// "WWW", "SRS", "WWW", -// 'R', ItemIngots.getIngotByName("refinediron"), -// 'S', Items.redstone, -// 'W', ItemCables.getCableByName("copper")); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("electronicCircuit"), + "WWW", "SRS", "WWW", + 'R', ItemIngots.getIngotByName("refinediron"), + 'S', Items.redstone, + 'W', ItemCables.getCableByName("insulatedcopper")); CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.wrench), "BAB", "BBB", "ABA", diff --git a/src/main/java/techreborn/parts/ItemCables.java b/src/main/java/techreborn/parts/ItemCables.java index 142fe799c..680e79c07 100644 --- a/src/main/java/techreborn/parts/ItemCables.java +++ b/src/main/java/techreborn/parts/ItemCables.java @@ -28,7 +28,7 @@ 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)) { + if (EnumCableType.values()[i].getName().equalsIgnoreCase(name)) { return new ItemStack(TechRebornParts.cables, count, i); } } From 398309ab0c56a3aa7f0d3b4a850678eed4041554 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 13:48:48 +0000 Subject: [PATCH 18/36] Added refined Iron Recipe --- src/main/java/techreborn/init/ModRecipes.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index f2fefa7d7..74350741c 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -485,6 +485,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"); } From 066d329388ca41efb436911103b624a6ed894761 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 14:26:08 +0000 Subject: [PATCH 19/36] test recipe --- src/main/java/techreborn/init/ModRecipes.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index a61180cae..af99333cf 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -171,6 +171,8 @@ public class 'S', Items.redstone, 'W', ItemCables.getCableByName("insulatedcopper")); + CraftingHelper.addShapelessOreRecipe(ItemCables.getCableByName("insulatedcopper"), ItemParts.getPartByName("rubber")); + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.wrench), "BAB", "BBB", "ABA", 'B', "ingotBronze"); From a921751618acd98f13b8731dbcdd6e430ecdf346 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 6 Mar 2016 14:28:45 +0000 Subject: [PATCH 20/36] Fixed recipe issues, again --- src/main/java/techreborn/Core.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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); From 188cee7b3b5713923337a9baca9e751d4ee74a25 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 14:46:30 +0000 Subject: [PATCH 21/36] Added Cable recipes --- src/main/java/techreborn/init/ModRecipes.java | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index af99333cf..44cc010ac 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -49,8 +49,7 @@ import techreborn.items.ItemPlates; import techreborn.parts.ItemCables; import techreborn.utils.RecipeUtils; -public class - ModRecipes { +public class ModRecipes { public static ConfigTechReborn config; public static void init() { @@ -78,9 +77,43 @@ public class addIc2ReplacementReicpes(); addExtractorRecipes(); addCompressorRecipes(); + addWireRecipes(); } - private static void addCompressorRecipes() { + static void addWireRecipes() { + CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("copper", 6), + "XXX","CCC", "XXX", + 'C', "ingotCopper"); + CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("tin", 9), + "XXX","CCC", "XXX", + 'C', "ingotTin"); + CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("gold", 12), + "XXX","CCC", "XXX", + 'C', "ingotGold"); + CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("hv", 8), + "XXX","CCC", "XXX", + 'C', ItemIngots.getIngotByName("refinediron")); + CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("glassfiber", 6), + "GGG", + "SDS", + "GGG", + 'G', "blockGlass", + 'S', "ingotSilver", + 'D', Items.diamond); + CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("glassfiber", 4), + "GGG", + "RDR", + "GGG", + 'G', "blockGlass", + 'R', Items.redstone, + 'D', Items.diamond); + + CraftingHelper.addShapelessOreRecipe(ItemCables.getCableByName("insulatedcopper"), ItemParts.getPartByName("rubber"), ItemCables.getCableByName("copper")); + CraftingHelper.addShapelessOreRecipe(ItemCables.getCableByName("insulatedgold"), ItemParts.getPartByName("rubber"), ItemCables.getCableByName("gold")); + CraftingHelper.addShapelessOreRecipe(ItemCables.getCableByName("insulatedhv"), ItemParts.getPartByName("rubber"), ItemCables.getCableByName("hv")); + } + + private static void addCompressorRecipes() { RecipeHandler.addRecipe(new CompressorRecipe(new ItemStack(Items.diamond), new ItemStack(Items.coal), 400, 20)); } @@ -170,9 +203,7 @@ public class 'R', ItemIngots.getIngotByName("refinediron"), 'S', Items.redstone, 'W', ItemCables.getCableByName("insulatedcopper")); - - CraftingHelper.addShapelessOreRecipe(ItemCables.getCableByName("insulatedcopper"), ItemParts.getPartByName("rubber")); - + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.wrench), "BAB", "BBB", "ABA", 'B', "ingotBronze"); From 7a5c7df9c2880a72abfad020a895ea73b08e5b62 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 6 Mar 2016 14:51:13 +0000 Subject: [PATCH 22/36] Standalone Cable items --- .../java/techreborn/compat/CompatManager.java | 2 + src/main/java/techreborn/init/ModRecipes.java | 22 +++--- .../java/techreborn/parts/ItemCables.java | 16 +--- .../parts/ItemStandaloneCables.java | 77 +++++++++++++++++++ .../parts/StandalonePartCompact.java | 37 +++++++++ 5 files changed, 128 insertions(+), 26 deletions(-) create mode 100644 src/main/java/techreborn/parts/ItemStandaloneCables.java create mode 100644 src/main/java/techreborn/parts/StandalonePartCompact.java 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/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 44cc010ac..f92c8a41f 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -46,7 +46,7 @@ import techreborn.items.ItemIngots; import techreborn.items.ItemNuggets; import techreborn.items.ItemParts; import techreborn.items.ItemPlates; -import techreborn.parts.ItemCables; +import techreborn.parts.ItemStandaloneCables; import techreborn.utils.RecipeUtils; public class ModRecipes { @@ -81,26 +81,26 @@ public class ModRecipes { } static void addWireRecipes() { - CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("copper", 6), + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("copper", 6), "XXX","CCC", "XXX", 'C', "ingotCopper"); - CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("tin", 9), + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("tin", 9), "XXX","CCC", "XXX", 'C', "ingotTin"); - CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("gold", 12), + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("gold", 12), "XXX","CCC", "XXX", 'C', "ingotGold"); - CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("hv", 8), + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("hv", 8), "XXX","CCC", "XXX", 'C', ItemIngots.getIngotByName("refinediron")); - CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("glassfiber", 6), + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("glassfiber", 6), "GGG", "SDS", "GGG", 'G', "blockGlass", 'S', "ingotSilver", 'D', Items.diamond); - CraftingHelper.addShapedOreRecipe(ItemCables.getCableByName("glassfiber", 4), + CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("glassfiber", 4), "GGG", "RDR", "GGG", @@ -108,9 +108,9 @@ public class ModRecipes { 'R', Items.redstone, 'D', Items.diamond); - CraftingHelper.addShapelessOreRecipe(ItemCables.getCableByName("insulatedcopper"), ItemParts.getPartByName("rubber"), ItemCables.getCableByName("copper")); - CraftingHelper.addShapelessOreRecipe(ItemCables.getCableByName("insulatedgold"), ItemParts.getPartByName("rubber"), ItemCables.getCableByName("gold")); - CraftingHelper.addShapelessOreRecipe(ItemCables.getCableByName("insulatedhv"), ItemParts.getPartByName("rubber"), ItemCables.getCableByName("hv")); + 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() { @@ -202,7 +202,7 @@ public class ModRecipes { "WWW", "SRS", "WWW", 'R', ItemIngots.getIngotByName("refinediron"), 'S', Items.redstone, - 'W', ItemCables.getCableByName("insulatedcopper")); + 'W', ItemStandaloneCables.getCableByName("insulatedcopper")); CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.wrench), "BAB", "BBB", "ABA", diff --git a/src/main/java/techreborn/parts/ItemCables.java b/src/main/java/techreborn/parts/ItemCables.java index 680e79c07..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].getName().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) { + + } +} From f4d74f7486fca5ffbd794074e52faafd2f077b91 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 6 Mar 2016 15:02:17 +0000 Subject: [PATCH 23/36] Wrench crash fix, cable drop items, cables have hardness --- .../techreborn/items/tools/ItemWrench.java | 3 +++ .../java/techreborn/parts/CableMultipart.java | 24 +++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/main/java/techreborn/items/tools/ItemWrench.java b/src/main/java/techreborn/items/tools/ItemWrench.java index 7597718db..5992cd85a 100644 --- a/src/main/java/techreborn/items/tools/ItemWrench.java +++ b/src/main/java/techreborn/items/tools/ItemWrench.java @@ -44,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 3c17e80c6..18b57d32f 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; @@ -25,10 +26,7 @@ import reborncore.api.power.IEnergyInterfaceTile; import reborncore.common.misc.Functions; import reborncore.common.misc.vecmath.Vecs3dCube; -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. @@ -225,7 +223,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 +264,17 @@ 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; + } + } From 9161133585eaaed75554abc15ac788160f2aa04d Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 15:09:05 +0000 Subject: [PATCH 24/36] battery recipe --- src/main/java/techreborn/init/ModRecipes.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index f92c8a41f..4a3f5e7ab 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -203,6 +203,12 @@ public class ModRecipes { '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", From e7b7e44a480214d34280848f0dd7f8ce549828aa Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 15:15:53 +0000 Subject: [PATCH 25/36] Centrifuge texture fix (Still needs side on) --- .../blocks/machine/BlockCentrifuge.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java b/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java index 303c52c6b..d22b9cf2c 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 From b7212bec69b818fc3f47442d55c231b0b8580eba Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 15:20:38 +0000 Subject: [PATCH 26/36] Fixed generator not storing inv --- .../techreborn/tiles/generator/TileGenerator.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/techreborn/tiles/generator/TileGenerator.java b/src/main/java/techreborn/tiles/generator/TileGenerator.java index 981132238..385674374 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; @@ -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); + } } From a84075ff690f3011865a2bd33fbf9474bd414fe0 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 15:42:12 +0000 Subject: [PATCH 27/36] Nerfed generator and fix generator gui --- src/main/java/techreborn/client/gui/GuiGenerator.java | 6 +++--- src/main/java/techreborn/tiles/generator/TileGenerator.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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/tiles/generator/TileGenerator.java b/src/main/java/techreborn/tiles/generator/TileGenerator.java index 385674374..5424d0a0e 100644 --- a/src/main/java/techreborn/tiles/generator/TileGenerator.java +++ b/src/main/java/techreborn/tiles/generator/TileGenerator.java @@ -141,7 +141,7 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn @Override public double getMaxPower() { - return ConfigTechReborn.ThermalGeneratorCharge; + return 10000; } @Override From 961e82140239c65fa261974bd2db27d49ad3e7d0 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 15:58:34 +0000 Subject: [PATCH 28/36] Start on Iron furnace --- .../techreborn/blocks/BlockIronFurnace.java | 59 +++++++++++++++++++ .../techreborn/client/gui/GuiCompressor.java | 5 +- src/main/java/techreborn/init/ModBlocks.java | 4 ++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/main/java/techreborn/blocks/BlockIronFurnace.java diff --git a/src/main/java/techreborn/blocks/BlockIronFurnace.java b/src/main/java/techreborn/blocks/BlockIronFurnace.java new file mode 100644 index 000000000..8fc569cb3 --- /dev/null +++ b/src/main/java/techreborn/blocks/BlockIronFurnace.java @@ -0,0 +1,59 @@ +package techreborn.blocks; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +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.tiles.TileAlloyFurnace; + +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 null; + } + + @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.alloyFurnaceID, world, x, y, z); + return true; + } + + 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/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/init/ModBlocks.java b/src/main/java/techreborn/init/ModBlocks.java index 89e1dc9c2..883b3bb3b 100644 --- a/src/main/java/techreborn/init/ModBlocks.java +++ b/src/main/java/techreborn/init/ModBlocks.java @@ -135,6 +135,7 @@ public class ModBlocks { public static Block storage2; public static Block machineframe; public static Block reinforcedglass; + public static Block ironFurnace; public static Block rubberLog; public static Block rubberLeaves; @@ -364,6 +365,9 @@ public class ModBlocks { reinforcedglass = new BlockReinforcedGlass(Material.glass); GameRegistry.registerBlock(reinforcedglass, "reinforcedglass"); + + ironFurnace = new BlockIronFurnace(); + GameRegistry.registerBlock(ironFurnace, "ironfurnace"); registerOreDict(); Core.logHelper.info("TechReborns Blocks Loaded"); From 90f5d77a41baaa986c123d2f7bd425ac9c13e4b5 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 19:59:39 +0000 Subject: [PATCH 29/36] Finish on Iron furnace Added Jei support to Iron Furnace --- .../techreborn/blocks/BlockIronFurnace.java | 7 +- .../java/techreborn/client/GuiHandler.java | 11 +- .../container/ContainerIronFurnace.java | 58 +++ .../techreborn/client/gui/GuiIronFurnace.java | 56 +++ .../compat/jei/TechRebornJeiPlugin.java | 2 + src/main/java/techreborn/init/ModBlocks.java | 2 +- src/main/java/techreborn/init/ModRecipes.java | 9 + .../techreborn/tiles/TileIronFurnace.java | 353 ++++++++++++++++++ .../assets/techreborn/lang/en_US.lang | 1 + 9 files changed, 493 insertions(+), 6 deletions(-) create mode 100644 src/main/java/techreborn/client/container/ContainerIronFurnace.java create mode 100644 src/main/java/techreborn/client/gui/GuiIronFurnace.java create mode 100644 src/main/java/techreborn/tiles/TileIronFurnace.java diff --git a/src/main/java/techreborn/blocks/BlockIronFurnace.java b/src/main/java/techreborn/blocks/BlockIronFurnace.java index 8fc569cb3..be6525a8f 100644 --- a/src/main/java/techreborn/blocks/BlockIronFurnace.java +++ b/src/main/java/techreborn/blocks/BlockIronFurnace.java @@ -9,6 +9,7 @@ import techreborn.Core; import techreborn.client.GuiHandler; import techreborn.client.TechRebornCreativeTab; import techreborn.tiles.TileAlloyFurnace; +import techreborn.tiles.TileIronFurnace; public class BlockIronFurnace extends BlockMachineBase implements IRotationTexture { @@ -20,13 +21,13 @@ public class BlockIronFurnace extends BlockMachineBase implements IRotationTextu @Override public TileEntity createNewTileEntity(World world, int p_149915_2_) { - return null; + 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.alloyFurnaceID, world, x, y, z); + if (!player.isSneaking()) + player.openGui(Core.INSTANCE, GuiHandler.ironFurnace, 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/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/compat/jei/TechRebornJeiPlugin.java b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java index 63faa1a00..38aec2595 100644 --- a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java +++ b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java @@ -48,6 +48,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.GuiRollingMachine; import techreborn.client.gui.GuiVacuumFreezer; import techreborn.compat.jei.alloySmelter.AlloySmelterRecipeCategory; @@ -158,6 +159,7 @@ public class TechRebornJeiPlugin extends BlankModPlugin { 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(); diff --git a/src/main/java/techreborn/init/ModBlocks.java b/src/main/java/techreborn/init/ModBlocks.java index 883b3bb3b..6aa37ff8a 100644 --- a/src/main/java/techreborn/init/ModBlocks.java +++ b/src/main/java/techreborn/init/ModBlocks.java @@ -368,7 +368,7 @@ public class ModBlocks { 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/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 4a3f5e7ab..d4d1e5f9e 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -198,6 +198,15 @@ public class ModRecipes { 'A', "ingot" + name.substring(0, 1).toUpperCase() + name.substring(1)); } + 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"), diff --git a/src/main/java/techreborn/tiles/TileIronFurnace.java b/src/main/java/techreborn/tiles/TileIronFurnace.java new file mode 100644 index 000000000..10f653ee9 --- /dev/null +++ b/src/main/java/techreborn/tiles/TileIronFurnace.java @@ -0,0 +1,353 @@ +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; + byte direction; + private static final int[] slots_top = new int[] { 0 }; + private static final int[] slots_bottom = new int[] { 2, 1 }; + private static final int[] slots_sides = new int[] { 1 }; + + 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/resources/assets/techreborn/lang/en_US.lang b/src/main/resources/assets/techreborn/lang/en_US.lang index 00b375c33..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 From b99df6f0a8a88b2d1cc53579ae533034afbf859f Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 20:09:30 +0000 Subject: [PATCH 30/36] Iron furnace and Iron alloy furnace now return when broken --- .../techreborn/blocks/BlockIronFurnace.java | 15 ++++++++++++++ .../blocks/machine/BlockAlloyFurnace.java | 20 +++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/main/java/techreborn/blocks/BlockIronFurnace.java b/src/main/java/techreborn/blocks/BlockIronFurnace.java index be6525a8f..92eef07c3 100644 --- a/src/main/java/techreborn/blocks/BlockIronFurnace.java +++ b/src/main/java/techreborn/blocks/BlockIronFurnace.java @@ -1,13 +1,21 @@ 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; @@ -30,6 +38,13 @@ public class BlockIronFurnace extends BlockMachineBase implements IRotationTextu 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/"; diff --git a/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java b/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java index bc1588ba7..54b011969 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; @@ -26,13 +33,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/"; From 87d41aaa53752dfeec5e970b7d0836ad2137bf51 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 20:14:42 +0000 Subject: [PATCH 31/36] Small code clean up --- .../techreborn/blocks/machine/BlockAlloyFurnace.java | 1 - .../techreborn/blocks/machine/BlockAlloySmelter.java | 8 ++------ .../blocks/machine/BlockAssemblingMachine.java | 8 ++------ .../techreborn/blocks/machine/BlockBlastFurnace.java | 10 ++-------- .../techreborn/blocks/machine/BlockCentrifuge.java | 1 - .../techreborn/blocks/machine/BlockChargeBench.java | 5 +---- .../blocks/machine/BlockChemicalReactor.java | 6 +----- .../blocks/machine/BlockImplosionCompressor.java | 8 ++------ .../blocks/machine/BlockIndustrialElectrolyzer.java | 8 ++------ .../blocks/machine/BlockIndustrialGrinder.java | 2 -- .../blocks/machine/BlockIndustrialSawmill.java | 8 ++------ .../blocks/machine/BlockMatterFabricator.java | 7 ++----- .../techreborn/blocks/machine/BlockRollingMachine.java | 8 ++------ .../techreborn/blocks/machine/BlockVacuumFreezer.java | 10 ++-------- src/main/java/techreborn/tiles/TileIronFurnace.java | 4 ---- 15 files changed, 20 insertions(+), 74 deletions(-) diff --git a/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java b/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java index 54b011969..a3cf87dc5 100644 --- a/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java +++ b/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java @@ -20,7 +20,6 @@ import techreborn.tiles.TileAlloyFurnace; public class BlockAlloyFurnace extends BlockMachineBase implements IRotationTexture { - public BlockAlloyFurnace(Material material) { super(); setUnlocalizedName("techreborn.alloyfurnace"); 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 d22b9cf2c..60d17eaa7 100644 --- a/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java +++ b/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java @@ -57,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/tiles/TileIronFurnace.java b/src/main/java/techreborn/tiles/TileIronFurnace.java index 10f653ee9..3c4eed541 100644 --- a/src/main/java/techreborn/tiles/TileIronFurnace.java +++ b/src/main/java/techreborn/tiles/TileIronFurnace.java @@ -46,10 +46,6 @@ public class TileIronFurnace extends TileMachineBase implements IInventory { public int fuelGague; public int progress; public int fuelScale = 200; - byte direction; - private static final int[] slots_top = new int[] { 0 }; - private static final int[] slots_bottom = new int[] { 2, 1 }; - private static final int[] slots_sides = new int[] { 1 }; public int gaugeProgressScaled (int scale) { From d02424070dbe481c0b2e9b23cf6f3a5471d1bc87 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 20:22:43 +0000 Subject: [PATCH 32/36] Recipe tweak --- src/main/java/techreborn/init/ModRecipes.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index d4d1e5f9e..bf494c736 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -1569,8 +1569,8 @@ public class ModRecipes { 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", From 5f1d059058ab0f7c989de8f021fd6a3097e7e2bc Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 20:39:31 +0000 Subject: [PATCH 33/36] Added logic to Electric furnace --- .../client/gui/GuiElectricFurnace.java | 8 +- .../tiles/teir1/TileElectricFurnace.java | 155 +++++++++++++++--- 2 files changed, 135 insertions(+), 28 deletions(-) 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/tiles/teir1/TileElectricFurnace.java b/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java index f7f4be240..d4cc95494 100644 --- a/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java +++ b/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java @@ -1,33 +1,158 @@ package techreborn.tiles.teir1; import ic2.api.tile.IWrenchable; +import net.minecraft.block.Block; +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.inventory.ISidedInventory; +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.minecraftforge.fml.common.registry.GameRegistry; +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 +192,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 +260,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; From 059b197d5cd68c1fd0533613629f6761ed9a3d12 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 21:00:42 +0000 Subject: [PATCH 34/36] More recipe tweaks --- src/main/java/techreborn/init/ModRecipes.java | 21 +++++++++++-------- .../tiles/teir1/TileElectricFurnace.java | 10 --------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index bf494c736..5d8501c8c 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -198,6 +198,12 @@ public class ModRecipes { '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"); @@ -457,7 +463,6 @@ public class ModRecipes { } static void addShapelessRecipes() { - for (String name : ArrayUtils.addAll(BlockStorage.types, BlockStorage2.types)) { ItemStack item = null; try { @@ -476,7 +481,6 @@ public class ModRecipes { 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); @@ -493,7 +497,7 @@ public class ModRecipes { 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), @@ -509,16 +513,15 @@ public class ModRecipes { '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", diff --git a/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java b/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java index d4cc95494..8490b306c 100644 --- a/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java +++ b/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java @@ -1,25 +1,15 @@ package techreborn.tiles.teir1; import ic2.api.tile.IWrenchable; -import net.minecraft.block.Block; -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.inventory.ISidedInventory; -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.minecraftforge.fml.common.registry.GameRegistry; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.util.Inventory; From e6c510bbea29bcef76b71cee486bbb9ae8bb8fc3 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Sun, 6 Mar 2016 21:03:20 +0000 Subject: [PATCH 35/36] Fixed machines returning wrong itemstack when wrenched --- .../java/techreborn/tiles/teir1/TileCompressor.java | 11 +---------- .../java/techreborn/tiles/teir1/TileExtractor.java | 11 +---------- src/main/java/techreborn/tiles/teir1/TileGrinder.java | 10 ---------- 3 files changed, 2 insertions(+), 30 deletions(-) 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/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 d550b0129..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); } @@ -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(); From 57f91f3159ad0c22a7fac26f8819c1fbb6ac1f56 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 6 Mar 2016 21:42:27 +0000 Subject: [PATCH 36/36] Cables now shock the entity's --- build.gradle | 2 +- .../java/techreborn/parts/CableMultipart.java | 22 ++++++++++++++---- .../damageSources/ElectrialShockSource.java | 12 ++++++++++ .../resources/assets/techreborn/sounds.json | 3 ++- .../assets/techreborn/sounds/cable_shock.ogg | Bin 0 -> 6135 bytes 5 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 src/main/java/techreborn/utils/damageSources/ElectrialShockSource.java create mode 100644 src/main/resources/assets/techreborn/sounds/cable_shock.ogg 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/parts/CableMultipart.java b/src/main/java/techreborn/parts/CableMultipart.java index 18b57d32f..5c1e0ec3d 100644 --- a/src/main/java/techreborn/parts/CableMultipart.java +++ b/src/main/java/techreborn/parts/CableMultipart.java @@ -11,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; @@ -25,13 +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.*; /** * 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; @@ -277,4 +276,17 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart } + @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/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/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 0000000000000000000000000000000000000000..d23d5b3edbc07086a24278b8ce43885c132a2daa GIT binary patch literal 6135 zcmai13p|ut*MG*Hh9%Z2swzHp~DtU;5(TBrn0TH4pSnQo2OMZok2e)9(qMd&|qMafNA@$!Sh%Mj$*V8V! z#ArRBy9XTc-{2hXhYk*)xry1M9ndDmSQBFtV^g%gb4X~wk#KqhJv0&{;ti8t+KREZ zaf3l}UG>2#kTy}p>aNH z5F`b~>dU8^v?kp<2P3vlYxPn1hVVr_V8#>;}WQLu&d-F_LN!sSu`ZYb)%ZzIJ z2u|1mH}A^3GF~Smy75!_KRS7_9%yhDYZ(n6gteTAeG;ZLCmgU^QVR{m0yUwX7gZgq zR6D9rUA;Qa^M)=eX1%6%u4EzwJW*bIqv?auQG?Mj9ytk~w_-eQC3rqb@LEhbgiQR= zKF5qLiket;Gz=1M=$p%j-fq zstr4;;o>F0r&6NRK!pLU(*M(ZJ+kTly;=FU89-LRmaSo^)-WAAl1^*5p{&@#Z4mIO z70IwU9Jez9*BY@Ew4IT*?M$bx4^GSfbb`q35M+f#HHV?vfi*}*{o!VNBP<6ah=afs zB8&Xz=ZqLHKoPA1-|WCxIn(q*Vza~ow#Xtm8~BnWupp`EC7RX4TIj+nv0fE&RrC5E zB$M;>>bW_2Vh;v)YrFuy#0YYm3v+u|5#0`O7H4U6OgT@M&+P+q8dLd7EgFZwx_~~G zEO*Eq?DgnjO_tTGf>AOvPp`I~yu|MZEV%pgyC2{uz>ehMyr6n{FEIMUC;x4iylC#9 z@Ua4ZJM;wEQV@rZNt2^f-}mV$IPI#6XBq z{AVYI@)C;K87T$={TrPo9fqQ=qN#iH?DZyu4IB$lY-k2he7<(_azrJ5R}iOGNL|li zk_Z^iQbYl#qJ7eL$Y_XzBrzvkfVm2y;%CRb*Lk$!m)@V+qu)_3%DSNSni#p7T2jcA zz0n~am!d{)CU`xG8XJrm8$5qtW#T`9^;hITAZQrkm}JsYv90;>yRGGy9QQhJ)*(a3BV*mMY`j6o zH7Dh2Qp!|PntpP2Kr)M0UmPr`oW1>D+h38hGh7EW5IJ_?IzL5D0~TciqN&=DxUi(7 zWiK#jq}|G&9RNWM>2ODJ9&sTV4Uo(RNJbR0<$sPCKpnsl`*FaqSrDWFL2H4N8Hkkd zbn8${cRB2&j&u=TrsyG(aTQ?-$17?_rti?Ryp@4(f-j7d^wn&g;?L_^q@fiXOZPdv z+9U_ko)qK)L9y62>_cRDw?liOZ8uiFfZ2xE<7DIFS5JC?cKce#}6X&R^>!@P)NR>XQLLAJ( zb>Ylh$dnEh$^e-%qE4jL=@M0l#1CYOiXBCb(w|MF)P_95(TB*CQFY2d9eqUo)ZXl< zF;k)k_!I(a)L?eZ0bz(&&JR{ZRWU1b%3z(DOC-gGLiZq3Jfi6yi7)L;LB@U@k zD0P&fk0F%on2AV=*IxS2BE>`fl;>c=#HW}Eq=@t2Kop=J64DRdj2hDqUzp!#}V zW%+E~yJby=v$v1%Dl5yY=S0-o{MnYU+1th^OEDd#<*#pZZ{H4`y&cwB7lJC`y}oDA z(Rf`@{ciU5#+oQC7fRG9)9b}vphw7oUoU$uCRB%PxzGP901Wy*;~yPH)q`y}LN&o$ z%fkBYhc=~g{8-?mJboUpe6~7teN)A(wF@Q2D~mp6;pMS1bj%{nbMSmI@AYkij(b25 z_G!yu)E#4#*N8bF6jbw<#dxm_10 z!5|r}DOFd5K{GlML3)j5ld&>d5xWV^DCQnQpceD7K?|Ck=Fpa(sZ8+4F#AZdMVvi^ zpdzM_6jW9EnDz$ERwo1)G5e^2+?L1G)D_+clPR`Ow}U*VMnnLtrV80g)&ve))sbN2 z)(L=I(zjz5m#ysTz^w(WIBa!C0=7=oGZZUCfgNmRPX|nks%wZ*3u|o)8n9{?2^Y(F zmBR$Aa^o`y1b$WqsWU%Q#40|G;DD*iAUJ_j5eQWYBx*2Lm`@5e1E&J4G6=y&EmTjZ z+9(8dnfO%vTDPD;ehUz;%RxF4s%q7PLa~#p2mySNaBj1@XBrUh8e~=~3=|POLo9`? z2m)XDm~uJCaD<4grYpPP~D< zbthhr8}4L{!B9GP$m!O0<1v_KAzn_GqwZ*6)a(|7!2m6cK;0n@TNz?$E#;Aea2gz&h>j$i7_4A85%jocfJOOH01BMuPHG^(=82UYKS5~Xs0*Or z%YT?d1r_WZIMAFpkLW__vXB+B1jxnvA!wcWX%r4*MifKIpd~+E$y!bg90UBTI`N=G zSOWs6_ln{{$6@w~2qeM`8q8rhks<<V7q2F5rIjaLj!08n?)l4tXilx1b(x7P^A_}NUJa#1R$=RWCalb zA*ib!f}TptLf0iV?acL%@&-5`u@bRpV8&EzqAD!~JC$!EhiT3MHBKo~RC<7)tf>A- z1qATf0tomil&H&(Nc+1m`FkY)|0ux)b=C?u@V9P3YRWBD<@UqPCFc<(I5YbF3Avc0VGSKB@i&Dp9D!~Zwmeu75Nr6DhW;ssHW09yQJ9c3>Lh3mq z5OM_YNlP_LB!MN(PiPfbb{`4EC(^qD1Q0a{96iVgQ!AvU)&l#33?ZbQGZRvmLF1uE zpx9m4!xFRDHyV4##lF@8#kRHB+My!wzgK-m$l6(By2v95>g2J8z&SHdZ=;nMz zwj(1w96{T#f|P>aSw-Ka(Tp5mVmYd=q@d}1TB?h4fj0r$RKav3=wFQM3$Lh+?gTeV zv>arN&@w$^1ye<~0YMBY3{-f%p$EH9O6sMui2_`ql@ZYwAPFHDZSadp?r>!l-kDsxSe3A?P|Rb~zNQBb}6#d{)`!7<_)`&fH>XWO!_3uJ^y7ssH~*mn7?W}PWF zVzxgX59qF6AAiMhXbl_O6tzj!Iq*zv(*9o=APT?RD>!uSE1N z>w%o%WR9D3>&V5-?$k%?PBM$5MtKNWKE@lz?X3H?UZqDZ|=I<&#g7L)E-(Rvsre{ zl_^E4>$Ms^Gqc*^Z`))l(qe2UGE~uXi_#DG&yVY`+8r3pW0{O4u*@b0vyKT>yp~5f zO5eSr|3P#1%kP=WhXqtjhw{lpm*FFa$yDVF&QjA(oX`x9jZSkrY;IQmD~6RYx=_uY zdOWyc-`A`wPc|4Vw@~x%ltl3*;Pq1z5;>WJ7j~2vDbD44WyDj*`g1t`O z!^3mF*_y4<(br9lZ|`1MKiqjQ=KBNLt9lEhTF!<;jDsGt7m)Cc68kjLEOuV|#Ajl-qB9+K^pEH>_$q zx+i`%QMYYH`atcM#eO9f!1e(R<7GMi+&V>F<-Qp zDpiM1f!Q0|hnVF!5yO7d*l*VQTTycX>Q_rj*9WW~wBHX-O|w=C_0MQn4ldp!f{+iH zCM@ZRs1!)^RuBpDV!u`J8n%mz^+rCwzr!3_f6fcb4)7ut0q@O!`0-9Li7I(JoMwp!IM_iWv!N;|~EpB8b zmue^yybH$pCUm2&e2oN@(sF~g4PT~D$8MKWmFUjv}he_4HAzUBZ@Q_^pOI962 zS8zVh6o{iKrNu6^4y3CrALx}9*45n>l5$TU|?l8*PG9{i(zB=g-2#ffI&o>u+= zCOj~7z&yJyoT%nUxT0wN$tk!JHgVcuzERsRDNo@VE$`vonvb^bewQ1bW(y)lyPrLV z)?DFsv(lk^lddf=)n=*K#cNRg!CjJ?au;6Nc~nQ(ucv+up;)e%ltcuIJf6U6lW~2#i8~X_?inveEIQUk%b~k@lG%xkO&hGd)TvTmw)oJc{U-Mh6+oH! zYj&KHG}DN=HfBne9(r#)F`toZYtfkVF})Ba^X1et&vvfCOmJwp{lxpsnh*S=cAE7V zKl#cE?fozLWqAg|F)u&2LWc*qv)daK9OmkcSJr2hzVZCSUfl#Qx%!gNorKs{sqquv zze_nt##Xfu7ze7=olf{+v}&%;6j*$fxO*wc^72hV4Yy(@3m&cYQTlj{T-vgIoem`d z85fSX&FiJ5S3PGxH2=bzYM?b7;w$)&Z%S_YbSwffPEPdXzp*;AfsZ<+mO0)z60Eze zkXPNO+4MQa?dUx(>PT%_;5Ch3kN)B2cgJ`8+dVJZUuS9?uefB?lB=mGpYayQO)jo^ zzw)D_ej%C=Q+7UXFsJNLSk2%g>aD<@RQI!Zv#qSBuC+WB=7O-byi_Xp(>(EG+{{rFL>8$-3ht`}yP{e1Gct!{&*(+yRq3 zb&2}$7KV;STi<(l{Y3kw`$`fjvuYJnw6^h3+wxH6(T@Cj%TqSns!43wK5|haPGdnR*}Oy}0}qN=xorp^S6#M{;EWqp_vI-?Ld zhA_8x*rjj1$N1ImyjOhU%ix<$^CNZmwxUwimg(qfuPH4%hFMB<=|Hhn@KAa`Y7MkH zao_3+?WZb%7hL&1^+W`|;0v8sBZR|G-FF-?eKFV2#J#_NG$!lo$DvofZ{Rs=uifY% zY*WAA*2;qUc(_Y#dWSoE?P#{NeP8F6T)iUuTLtHL-ZYKqjx!n=&OfZsklXm=K7T*? zevME*HM@ZR>RZ{yw^OF8ztmxSe6Via&t4{+bgk^VOe-(XWsiToaa3?GB-q0{rTTcI zpV_%pRy-Gh