My mind is blown :D Not sure whats up

This commit is contained in:
modmuss50 2015-06-06 21:41:41 +01:00
parent ee798923f5
commit 4d76a3071d
24 changed files with 110 additions and 23 deletions

View file

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

View file

@ -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<ItemStack> inputs;
@ -32,7 +32,7 @@ public abstract class BaseRecipe implements IBaseRecipeType {
@Override
public List<ItemStack> getOutputs() {
return outputs;
return (List<ItemStack>) 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();
}
}

View file

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

View file

@ -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<Integer> filledSlots = new ArrayList<Integer>();//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();
}
}
}

View file

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

View file

@ -106,11 +106,13 @@ public class TileAssemblingMachine extends TileMachineBase implements IWrenchabl
public void invalidate()
{
energy.invalidate();
super.invalidate();
}
@Override
public void onChunkUnload()
{
energy.onChunkUnload();
super.onChunkUnload();
}
@Override

View file

@ -242,13 +242,16 @@ public class TileBlastFurnace extends TileMachineBase implements IWrenchable, II
}
@Override
public void invalidate() {
public void invalidate()
{
energy.invalidate();
super.invalidate();
}
@Override
public void onChunkUnload() {
public void onChunkUnload()
{
energy.onChunkUnload();
super.onChunkUnload();
}
public Packet getDescriptionPacket() {

View file

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

View file

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

View file

@ -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)

View file

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

View file

@ -277,6 +277,7 @@ public class TileGasTurbine extends TileEntity implements IWrenchable,
public void onChunkUnload()
{
energySource.onChunkUnload();
super.onChunkUnload();
}
@Override

View file

@ -101,12 +101,16 @@ public class TileGrinder extends TileMachineBase implements IWrenchable, IEnergy
}
@Override
public void invalidate() {
public void invalidate()
{
energy.invalidate();
super.invalidate();
}
@Override
public void onChunkUnload() {
public void onChunkUnload()
{
energy.onChunkUnload();
super.onChunkUnload();
}
/* IFluidHandler */

View file

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

View file

@ -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,6 +73,7 @@ public class TileImplosionCompressor extends TileMachineBase implements IWrencha
@Override
public void 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();
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -282,6 +282,7 @@ public class TileSemifluidGenerator extends TileEntity implements IWrenchable,
public void onChunkUnload()
{
energySource.onChunkUnload();
super.onChunkUnload();
}
@Override

View file

@ -251,6 +251,7 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable,
public void onChunkUnload()
{
energySource.onChunkUnload();
super.onChunkUnload();
}
@Override