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(); RecipeManager.init();
//Has to be done after the recipes have been added //Has to be done after the recipes have been added
CompatManager.postInit(event); CompatManager.postInit(event);
//RecipeHanderer.addOreDicRecipes();
LogHelper.info(RecipeHanderer.recipeList.size() + " recipes loaded"); LogHelper.info(RecipeHanderer.recipeList.size() + " recipes loaded");
} }

View file

@ -9,7 +9,7 @@ import java.util.List;
/** /**
* Extend this to add a recipe * Extend this to add a recipe
*/ */
public abstract class BaseRecipe implements IBaseRecipeType { public abstract class BaseRecipe implements IBaseRecipeType , Cloneable {
public ArrayList<ItemStack> inputs; public ArrayList<ItemStack> inputs;
@ -32,7 +32,7 @@ public abstract class BaseRecipe implements IBaseRecipeType {
@Override @Override
public List<ItemStack> getOutputs() { public List<ItemStack> getOutputs() {
return outputs; return (List<ItemStack>) outputs.clone();
} }
@Override @Override
@ -64,4 +64,9 @@ public abstract class BaseRecipe implements IBaseRecipeType {
public boolean onCraft(TileEntity tile) { public boolean onCraft(TileEntity tile) {
return true; 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 * @return return true if fluid was taken and should craft
*/ */
public boolean onCraft(TileEntity tile); public boolean onCraft(TileEntity tile);
public Object clone()throws CloneNotSupportedException;
} }

View file

@ -125,7 +125,7 @@ public class RecipeCrafter {
} }
} }
if (canGiveInvAll) { 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.currentNeededTicks = (int)(currentRecipe.tickTime() * (1.0 - speedMultiplier));
this.currentTickTime = 0; this.currentTickTime = 0;
syncIsActive(); syncIsActive();
@ -150,6 +150,7 @@ public class RecipeCrafter {
ArrayList<Integer> filledSlots = new ArrayList<Integer>();//The slots that have been filled ArrayList<Integer> filledSlots = new ArrayList<Integer>();//The slots that have been filled
if (canGiveInvAll && currentRecipe.onCraft(parentTile)) { if (canGiveInvAll && currentRecipe.onCraft(parentTile)) {
for (int i = 0; i < currentRecipe.getOutputs().size(); i++) { 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 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 fitStack(currentRecipe.getOutputs().get(i), outputSlots[i]);//fills the slot with the output stack
filledSlots.add(outputSlots[i]); filledSlots.add(outputSlots[i]);
@ -323,4 +324,12 @@ public class RecipeCrafter {
return new S35PacketUpdateTileEntity(this.parentTile.xCoord, this.parentTile.yCoord, return new S35PacketUpdateTileEntity(this.parentTile.xCoord, this.parentTile.yCoord,
this.parentTile.zCoord, 1, nbtTag); this.parentTile.zCoord, 1, nbtTag);
} }
public void setCurrentRecipe(IBaseRecipeType recipe){
try {
this.currentRecipe = (IBaseRecipeType) recipe.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
}
} }

View file

@ -12,7 +12,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
public class BlockMachineBase extends BlockContainer{ public class BlockMachineBase extends BlockContainer {
public BlockMachineBase(Material material) public BlockMachineBase(Material material)
{ {

View file

@ -92,14 +92,16 @@ public class TileAlloySmelter extends TileMachineBase implements IWrenchable, IE
} }
@Override @Override
public void invalidate(){ public void invalidate()
{
energy.invalidate(); energy.invalidate();
super.invalidate(); super.invalidate();
} }
@Override @Override
public void onChunkUnload(){ public void onChunkUnload()
{
energy.onChunkUnload(); energy.onChunkUnload();
super.onChunkUnload();
} }
@Override @Override

View file

@ -106,13 +106,15 @@ public class TileAssemblingMachine extends TileMachineBase implements IWrenchabl
public void invalidate() public void invalidate()
{ {
energy.invalidate(); energy.invalidate();
super.invalidate();
} }
@Override @Override
public void onChunkUnload() public void onChunkUnload()
{ {
energy.onChunkUnload(); energy.onChunkUnload();
super.onChunkUnload();
} }
@Override @Override
public void addWailaInfo(List<String> info) public void addWailaInfo(List<String> info)
{ {

View file

@ -241,15 +241,18 @@ public class TileBlastFurnace extends TileMachineBase implements IWrenchable, II
return inventory.isItemValidForSlot(p_94041_1_, p_94041_2_); return inventory.isItemValidForSlot(p_94041_1_, p_94041_2_);
} }
@Override @Override
public void invalidate() { public void invalidate()
energy.invalidate(); {
} energy.invalidate();
super.invalidate();
@Override }
public void onChunkUnload() { @Override
energy.onChunkUnload(); public void onChunkUnload()
} {
energy.onChunkUnload();
super.onChunkUnload();
}
public Packet getDescriptionPacket() { public Packet getDescriptionPacket() {
NBTTagCompound nbtTag = new NBTTagCompound(); NBTTagCompound nbtTag = new NBTTagCompound();

View file

@ -113,11 +113,13 @@ public class TileCentrifuge extends TileMachineBase implements IWrenchable, IEn
public void invalidate() public void invalidate()
{ {
energy.invalidate(); energy.invalidate();
super.invalidate();
} }
@Override @Override
public void onChunkUnload() public void onChunkUnload()
{ {
energy.onChunkUnload(); energy.onChunkUnload();
super.onChunkUnload();
} }
@Override @Override

View file

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

View file

@ -31,7 +31,18 @@ public class TileChunkLoader extends TileMachineBase implements IWrenchable, IEn
energy.updateEntity(); energy.updateEntity();
} }
@Override
public void invalidate()
{
energy.invalidate();
super.invalidate();
}
@Override
public void onChunkUnload()
{
energy.onChunkUnload();
super.onChunkUnload();
}
@Override @Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)

View file

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

View file

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

View file

@ -99,14 +99,18 @@ public class TileGrinder extends TileMachineBase implements IWrenchable, IEnergy
tank.writeToNBT(tagCompound); tank.writeToNBT(tagCompound);
crafter.writeToNBT(tagCompound); crafter.writeToNBT(tagCompound);
} }
@Override @Override
public void invalidate() { public void invalidate()
{
energy.invalidate(); energy.invalidate();
super.invalidate();
} }
@Override @Override
public void onChunkUnload() { public void onChunkUnload()
{
energy.onChunkUnload(); energy.onChunkUnload();
super.onChunkUnload();
} }
/* IFluidHandler */ /* IFluidHandler */

View file

@ -102,11 +102,13 @@ public class TileHeatGenerator extends TileMachineBase implements IWrenchable, I
public void invalidate() public void invalidate()
{ {
energy.invalidate(); energy.invalidate();
super.invalidate();
} }
@Override @Override
public void onChunkUnload() public void onChunkUnload()
{ {
energy.onChunkUnload(); energy.onChunkUnload();
super.onChunkUnload();
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package techreborn.tiles; package techreborn.tiles;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import ic2.api.energy.prefab.BasicSink; import ic2.api.energy.prefab.BasicSink;
import ic2.api.energy.tile.IEnergyTile; import ic2.api.energy.tile.IEnergyTile;
import ic2.api.tile.IWrenchable; import ic2.api.tile.IWrenchable;
@ -72,7 +73,8 @@ public class TileImplosionCompressor extends TileMachineBase implements IWrencha
@Override @Override
public void updateEntity() { public void updateEntity() {
super.updateEntity(); System.out.println("hello");
super.updateEntity();
crafter.updateEntity(); crafter.updateEntity();
energy.updateEntity(); energy.updateEntity();
} }
@ -109,11 +111,13 @@ public class TileImplosionCompressor extends TileMachineBase implements IWrencha
public void invalidate() public void invalidate()
{ {
energy.invalidate(); energy.invalidate();
super.invalidate();
} }
@Override @Override
public void onChunkUnload() public void onChunkUnload()
{ {
energy.onChunkUnload(); energy.onChunkUnload();
super.onChunkUnload();
} }
} }

View file

@ -104,11 +104,13 @@ public class TileIndustrialElectrolyzer extends TileMachineBase implements IWren
public void invalidate() public void invalidate()
{ {
energy.invalidate(); energy.invalidate();
super.invalidate();
} }
@Override @Override
public void onChunkUnload() public void onChunkUnload()
{ {
energy.onChunkUnload(); energy.onChunkUnload();
super.onChunkUnload();
} }
@Override @Override

View file

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

View file

@ -105,11 +105,13 @@ public class TileLathe extends TileMachineBase implements IWrenchable, IEnergyTi
public void invalidate() public void invalidate()
{ {
energy.invalidate(); energy.invalidate();
super.invalidate();
} }
@Override @Override
public void onChunkUnload() public void onChunkUnload()
{ {
energy.onChunkUnload(); energy.onChunkUnload();
super.onChunkUnload();
} }
@Override @Override

View file

@ -87,11 +87,13 @@ public class TileMatterFabricator extends TileMachineBase implements IWrenchable
public void invalidate() public void invalidate()
{ {
energy.invalidate(); energy.invalidate();
super.invalidate();
} }
@Override @Override
public void onChunkUnload() public void onChunkUnload()
{ {
energy.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.setBoolean("isRunning", isRunning);
tagCompound.setInteger("tickTime", tickTime); 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() public void onChunkUnload()
{ {
energySource.onChunkUnload(); energySource.onChunkUnload();
super.onChunkUnload();
} }
@Override @Override

View file

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