diff --git a/src/main/java/techreborn/Core.java b/src/main/java/techreborn/Core.java index a38f5d705..64dcef0b6 100644 --- a/src/main/java/techreborn/Core.java +++ b/src/main/java/techreborn/Core.java @@ -92,7 +92,7 @@ public class Core { RecipeManager.init(); //Has to be done after the recipes have been added CompatManager.postInit(event); - //RecipeHanderer.addOreDicRecipes(); + LogHelper.info(RecipeHanderer.recipeList.size() + " recipes loaded"); } diff --git a/src/main/java/techreborn/api/recipe/BaseRecipe.java b/src/main/java/techreborn/api/recipe/BaseRecipe.java index 10dc5a84f..8566f24c7 100644 --- a/src/main/java/techreborn/api/recipe/BaseRecipe.java +++ b/src/main/java/techreborn/api/recipe/BaseRecipe.java @@ -9,7 +9,7 @@ import java.util.List; /** * Extend this to add a recipe */ -public abstract class BaseRecipe implements IBaseRecipeType { +public abstract class BaseRecipe implements IBaseRecipeType , Cloneable { public ArrayList inputs; @@ -32,7 +32,7 @@ public abstract class BaseRecipe implements IBaseRecipeType { @Override public List getOutputs() { - return outputs; + return (List) outputs.clone(); } @Override @@ -64,4 +64,9 @@ public abstract class BaseRecipe implements IBaseRecipeType { public boolean onCraft(TileEntity tile) { return true; } + + @Override + public Object clone()throws CloneNotSupportedException{ + return super.clone(); + } } diff --git a/src/main/java/techreborn/api/recipe/IBaseRecipeType.java b/src/main/java/techreborn/api/recipe/IBaseRecipeType.java index c8d3d10c1..a4c20dd69 100644 --- a/src/main/java/techreborn/api/recipe/IBaseRecipeType.java +++ b/src/main/java/techreborn/api/recipe/IBaseRecipeType.java @@ -57,4 +57,6 @@ public interface IBaseRecipeType { * @return return true if fluid was taken and should craft */ public boolean onCraft(TileEntity tile); + + public Object clone()throws CloneNotSupportedException; } diff --git a/src/main/java/techreborn/api/recipe/RecipeCrafter.java b/src/main/java/techreborn/api/recipe/RecipeCrafter.java index 6187fd739..216214c00 100644 --- a/src/main/java/techreborn/api/recipe/RecipeCrafter.java +++ b/src/main/java/techreborn/api/recipe/RecipeCrafter.java @@ -125,7 +125,7 @@ public class RecipeCrafter { } } if (canGiveInvAll) { - currentRecipe = recipe;//Sets the current recipe then syncs + setCurrentRecipe(recipe);//Sets the current recipe then syncs this.currentNeededTicks = (int)(currentRecipe.tickTime() * (1.0 - speedMultiplier)); this.currentTickTime = 0; syncIsActive(); @@ -150,6 +150,7 @@ public class RecipeCrafter { ArrayList filledSlots = new ArrayList();//The slots that have been filled if (canGiveInvAll && currentRecipe.onCraft(parentTile)) { for (int i = 0; i < currentRecipe.getOutputs().size(); i++) { + System.out.println(currentRecipe.getOutputs().get(i).stackSize); if (!filledSlots.contains(outputSlots[i])) {//checks it has not been filled fitStack(currentRecipe.getOutputs().get(i), outputSlots[i]);//fills the slot with the output stack filledSlots.add(outputSlots[i]); @@ -323,4 +324,12 @@ public class RecipeCrafter { return new S35PacketUpdateTileEntity(this.parentTile.xCoord, this.parentTile.yCoord, this.parentTile.zCoord, 1, nbtTag); } + + public void setCurrentRecipe(IBaseRecipeType recipe){ + try { + this.currentRecipe = (IBaseRecipeType) recipe.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + } } diff --git a/src/main/java/techreborn/blocks/BlockMachineBase.java b/src/main/java/techreborn/blocks/BlockMachineBase.java index 462740590..a02ecb9a4 100644 --- a/src/main/java/techreborn/blocks/BlockMachineBase.java +++ b/src/main/java/techreborn/blocks/BlockMachineBase.java @@ -12,7 +12,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import techreborn.client.TechRebornCreativeTab; -public class BlockMachineBase extends BlockContainer{ +public class BlockMachineBase extends BlockContainer { public BlockMachineBase(Material material) { diff --git a/src/main/java/techreborn/tiles/TileAlloySmelter.java b/src/main/java/techreborn/tiles/TileAlloySmelter.java index cfd71ff9d..44ca45441 100644 --- a/src/main/java/techreborn/tiles/TileAlloySmelter.java +++ b/src/main/java/techreborn/tiles/TileAlloySmelter.java @@ -92,14 +92,16 @@ public class TileAlloySmelter extends TileMachineBase implements IWrenchable, IE } @Override - public void invalidate(){ + public void invalidate() + { energy.invalidate(); - super.invalidate(); } @Override - public void onChunkUnload(){ + public void onChunkUnload() + { energy.onChunkUnload(); + super.onChunkUnload(); } @Override diff --git a/src/main/java/techreborn/tiles/TileAssemblingMachine.java b/src/main/java/techreborn/tiles/TileAssemblingMachine.java index 49f28704f..24547ae4b 100644 --- a/src/main/java/techreborn/tiles/TileAssemblingMachine.java +++ b/src/main/java/techreborn/tiles/TileAssemblingMachine.java @@ -106,13 +106,15 @@ public class TileAssemblingMachine extends TileMachineBase implements IWrenchabl public void invalidate() { energy.invalidate(); + super.invalidate(); } @Override public void onChunkUnload() { energy.onChunkUnload(); + super.onChunkUnload(); } - + @Override public void addWailaInfo(List info) { diff --git a/src/main/java/techreborn/tiles/TileBlastFurnace.java b/src/main/java/techreborn/tiles/TileBlastFurnace.java index 130285453..e3d754d62 100644 --- a/src/main/java/techreborn/tiles/TileBlastFurnace.java +++ b/src/main/java/techreborn/tiles/TileBlastFurnace.java @@ -241,15 +241,18 @@ public class TileBlastFurnace extends TileMachineBase implements IWrenchable, II return inventory.isItemValidForSlot(p_94041_1_, p_94041_2_); } - @Override - public void invalidate() { - energy.invalidate(); - } - - @Override - public void onChunkUnload() { - energy.onChunkUnload(); - } + @Override + public void invalidate() + { + energy.invalidate(); + super.invalidate(); + } + @Override + public void onChunkUnload() + { + energy.onChunkUnload(); + super.onChunkUnload(); + } public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); diff --git a/src/main/java/techreborn/tiles/TileCentrifuge.java b/src/main/java/techreborn/tiles/TileCentrifuge.java index c34a79df3..92b27ba22 100644 --- a/src/main/java/techreborn/tiles/TileCentrifuge.java +++ b/src/main/java/techreborn/tiles/TileCentrifuge.java @@ -113,11 +113,13 @@ public class TileCentrifuge extends TileMachineBase implements IWrenchable, IEn public void invalidate() { energy.invalidate(); + super.invalidate(); } @Override public void onChunkUnload() { energy.onChunkUnload(); + super.onChunkUnload(); } @Override diff --git a/src/main/java/techreborn/tiles/TileChemicalReactor.java b/src/main/java/techreborn/tiles/TileChemicalReactor.java index bdcb9f102..ec55ab143 100644 --- a/src/main/java/techreborn/tiles/TileChemicalReactor.java +++ b/src/main/java/techreborn/tiles/TileChemicalReactor.java @@ -106,11 +106,13 @@ public class TileChemicalReactor extends TileMachineBase implements IWrenchable, public void invalidate() { energy.invalidate(); + super.invalidate(); } @Override public void onChunkUnload() { energy.onChunkUnload(); + super.onChunkUnload(); } @Override diff --git a/src/main/java/techreborn/tiles/TileChunkLoader.java b/src/main/java/techreborn/tiles/TileChunkLoader.java index ce9b76165..3bb91cffd 100644 --- a/src/main/java/techreborn/tiles/TileChunkLoader.java +++ b/src/main/java/techreborn/tiles/TileChunkLoader.java @@ -31,7 +31,18 @@ public class TileChunkLoader extends TileMachineBase implements IWrenchable, IEn energy.updateEntity(); } - + @Override + public void invalidate() + { + energy.invalidate(); + super.invalidate(); + } + @Override + public void onChunkUnload() + { + energy.onChunkUnload(); + super.onChunkUnload(); + } @Override public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) diff --git a/src/main/java/techreborn/tiles/TileDragonEggSiphoner.java b/src/main/java/techreborn/tiles/TileDragonEggSiphoner.java index 01b81804d..27e687220 100644 --- a/src/main/java/techreborn/tiles/TileDragonEggSiphoner.java +++ b/src/main/java/techreborn/tiles/TileDragonEggSiphoner.java @@ -85,11 +85,13 @@ public class TileDragonEggSiphoner extends TileMachineBase implements IWrenchabl public void invalidate() { energy.invalidate(); + super.invalidate(); } @Override public void onChunkUnload() { energy.onChunkUnload(); + super.onChunkUnload(); } @Override diff --git a/src/main/java/techreborn/tiles/TileGasTurbine.java b/src/main/java/techreborn/tiles/TileGasTurbine.java index c49a49c5d..070c23dfb 100644 --- a/src/main/java/techreborn/tiles/TileGasTurbine.java +++ b/src/main/java/techreborn/tiles/TileGasTurbine.java @@ -277,6 +277,7 @@ public class TileGasTurbine extends TileEntity implements IWrenchable, public void onChunkUnload() { energySource.onChunkUnload(); + super.onChunkUnload(); } @Override diff --git a/src/main/java/techreborn/tiles/TileGrinder.java b/src/main/java/techreborn/tiles/TileGrinder.java index f5e146614..6515f4357 100644 --- a/src/main/java/techreborn/tiles/TileGrinder.java +++ b/src/main/java/techreborn/tiles/TileGrinder.java @@ -99,14 +99,18 @@ public class TileGrinder extends TileMachineBase implements IWrenchable, IEnergy tank.writeToNBT(tagCompound); crafter.writeToNBT(tagCompound); } - + @Override - public void invalidate() { + public void invalidate() + { energy.invalidate(); + super.invalidate(); } @Override - public void onChunkUnload() { + public void onChunkUnload() + { energy.onChunkUnload(); + super.onChunkUnload(); } /* IFluidHandler */ diff --git a/src/main/java/techreborn/tiles/TileHeatGenerator.java b/src/main/java/techreborn/tiles/TileHeatGenerator.java index a03825804..58a94df2a 100644 --- a/src/main/java/techreborn/tiles/TileHeatGenerator.java +++ b/src/main/java/techreborn/tiles/TileHeatGenerator.java @@ -102,11 +102,13 @@ public class TileHeatGenerator extends TileMachineBase implements IWrenchable, I public void invalidate() { energy.invalidate(); + super.invalidate(); } @Override public void onChunkUnload() { energy.onChunkUnload(); + super.onChunkUnload(); } @Override diff --git a/src/main/java/techreborn/tiles/TileImplosionCompressor.java b/src/main/java/techreborn/tiles/TileImplosionCompressor.java index 72cf44a5c..57202b852 100644 --- a/src/main/java/techreborn/tiles/TileImplosionCompressor.java +++ b/src/main/java/techreborn/tiles/TileImplosionCompressor.java @@ -1,5 +1,6 @@ package techreborn.tiles; +import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer; import ic2.api.energy.prefab.BasicSink; import ic2.api.energy.tile.IEnergyTile; import ic2.api.tile.IWrenchable; @@ -72,7 +73,8 @@ public class TileImplosionCompressor extends TileMachineBase implements IWrencha @Override public void updateEntity() { - super.updateEntity(); + System.out.println("hello"); + super.updateEntity(); crafter.updateEntity(); energy.updateEntity(); } @@ -109,11 +111,13 @@ public class TileImplosionCompressor extends TileMachineBase implements IWrencha public void invalidate() { energy.invalidate(); + super.invalidate(); } @Override public void onChunkUnload() { energy.onChunkUnload(); + super.onChunkUnload(); } } diff --git a/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java b/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java index 9996a5329..c282ac3ae 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java @@ -104,11 +104,13 @@ public class TileIndustrialElectrolyzer extends TileMachineBase implements IWren public void invalidate() { energy.invalidate(); + super.invalidate(); } @Override public void onChunkUnload() { energy.onChunkUnload(); + super.onChunkUnload(); } @Override diff --git a/src/main/java/techreborn/tiles/TileIndustrialSawmill.java b/src/main/java/techreborn/tiles/TileIndustrialSawmill.java index e9183818f..2d76ddd48 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialSawmill.java +++ b/src/main/java/techreborn/tiles/TileIndustrialSawmill.java @@ -108,11 +108,13 @@ public class TileIndustrialSawmill extends TileMachineBase implements IWrenchabl public void invalidate() { energy.invalidate(); + super.invalidate(); } @Override public void onChunkUnload() { energy.onChunkUnload(); + super.onChunkUnload(); } @Override diff --git a/src/main/java/techreborn/tiles/TileLathe.java b/src/main/java/techreborn/tiles/TileLathe.java index 60e427d86..4037dd25d 100644 --- a/src/main/java/techreborn/tiles/TileLathe.java +++ b/src/main/java/techreborn/tiles/TileLathe.java @@ -105,11 +105,13 @@ public class TileLathe extends TileMachineBase implements IWrenchable, IEnergyTi public void invalidate() { energy.invalidate(); + super.invalidate(); } @Override public void onChunkUnload() { energy.onChunkUnload(); + super.onChunkUnload(); } @Override diff --git a/src/main/java/techreborn/tiles/TileMatterFabricator.java b/src/main/java/techreborn/tiles/TileMatterFabricator.java index dcf8334a0..656f18e36 100644 --- a/src/main/java/techreborn/tiles/TileMatterFabricator.java +++ b/src/main/java/techreborn/tiles/TileMatterFabricator.java @@ -87,11 +87,13 @@ public class TileMatterFabricator extends TileMachineBase implements IWrenchable public void invalidate() { energy.invalidate(); + super.invalidate(); } @Override public void onChunkUnload() { energy.onChunkUnload(); + super.onChunkUnload(); } } diff --git a/src/main/java/techreborn/tiles/TilePlateCuttingMachine.java b/src/main/java/techreborn/tiles/TilePlateCuttingMachine.java index c960360f4..5583930f1 100644 --- a/src/main/java/techreborn/tiles/TilePlateCuttingMachine.java +++ b/src/main/java/techreborn/tiles/TilePlateCuttingMachine.java @@ -111,5 +111,18 @@ public class TilePlateCuttingMachine extends TileMachineBase implements IWrencha } } + @Override + public void invalidate() + { + energy.invalidate(); + super.invalidate(); + } + @Override + public void onChunkUnload() + { + energy.onChunkUnload(); + super.onChunkUnload(); + } + } diff --git a/src/main/java/techreborn/tiles/TileRollingMachine.java b/src/main/java/techreborn/tiles/TileRollingMachine.java index f3644037a..7241c1769 100644 --- a/src/main/java/techreborn/tiles/TileRollingMachine.java +++ b/src/main/java/techreborn/tiles/TileRollingMachine.java @@ -192,4 +192,17 @@ public class TileRollingMachine extends TileMachineBase implements IWrenchable, tagCompound.setBoolean("isRunning", isRunning); tagCompound.setInteger("tickTime", tickTime); } + + @Override + public void invalidate() + { + energy.invalidate(); + super.invalidate(); + } + @Override + public void onChunkUnload() + { + energy.onChunkUnload(); + super.onChunkUnload(); + } } diff --git a/src/main/java/techreborn/tiles/TileSemifluidGenerator.java b/src/main/java/techreborn/tiles/TileSemifluidGenerator.java index f20d9be71..800da2c64 100644 --- a/src/main/java/techreborn/tiles/TileSemifluidGenerator.java +++ b/src/main/java/techreborn/tiles/TileSemifluidGenerator.java @@ -282,6 +282,7 @@ public class TileSemifluidGenerator extends TileEntity implements IWrenchable, public void onChunkUnload() { energySource.onChunkUnload(); + super.onChunkUnload(); } @Override diff --git a/src/main/java/techreborn/tiles/TileThermalGenerator.java b/src/main/java/techreborn/tiles/TileThermalGenerator.java index e5a2af385..292dd4090 100644 --- a/src/main/java/techreborn/tiles/TileThermalGenerator.java +++ b/src/main/java/techreborn/tiles/TileThermalGenerator.java @@ -251,6 +251,7 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, public void onChunkUnload() { energySource.onChunkUnload(); + super.onChunkUnload(); } @Override