rethink things and remove IControllable from Tables - control the lasers!

This commit is contained in:
asiekierka 2014-12-13 14:10:11 +01:00
parent a5b4dc3742
commit d0854772d8
5 changed files with 8 additions and 26 deletions

View file

@ -32,7 +32,6 @@ import net.minecraftforge.oredict.OreDictionary;
import buildcraft.BuildCraftSilicon;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.power.ILaserTarget;
import buildcraft.api.tiles.IControllable;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.inventory.InventoryCopy;
import buildcraft.core.inventory.InventoryIterator;
@ -233,9 +232,6 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
if (worldObj.isRemote) {
return;
}
if (mode == IControllable.Mode.Off) {
return;
}
updateRecipe();
searchNeighborsForIngredients();
locateAndBindIngredients();
@ -440,12 +436,12 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
@Override
public boolean canCraft() {
return craftable && !justCrafted && mode != IControllable.Mode.Off;
return craftable && !justCrafted;
}
@Override
public boolean hasWork() {
return requiresLaserEnergy() && super.hasWork();
return requiresLaserEnergy();
}
@Override

View file

@ -28,7 +28,6 @@ import buildcraft.BuildCraftCore;
import buildcraft.api.recipes.CraftingResult;
import buildcraft.api.recipes.IFlexibleCrafter;
import buildcraft.api.recipes.IFlexibleRecipe;
import buildcraft.api.tiles.IControllable;
import buildcraft.core.network.CommandWriter;
import buildcraft.core.network.ICommandReceiver;
import buildcraft.core.network.PacketCommand;
@ -79,8 +78,7 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory,
}
}
if (getEnergy() >= currentRecipe.craft(this, true).energyCost
&& mode != IControllable.Mode.Off) {
if (getEnergy() >= currentRecipe.craft(this, true).energyCost) {
setEnergy(0);
if (currentRecipe.canBeCrafted(this)) {
@ -316,7 +314,7 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory,
@Override
public boolean hasWork() {
return currentRecipe != null && super.hasWork();
return currentRecipe != null;
}
@Override

View file

@ -17,7 +17,7 @@ public class TileChargingTable extends TileLaserTableBase implements IHasWork {
public void updateEntity() {
super.updateEntity();
if (getEnergy() > 0 && mode != Mode.Off) {
if (getEnergy() > 0) {
if (getRequiredEnergy() > 0) {
ItemStack stack = this.getStackInSlot(0);
IEnergyContainerItem containerItem = (IEnergyContainerItem) stack.getItem();

View file

@ -79,8 +79,7 @@ public class TileIntegrationTable extends TileLaserTableBase implements IFlexibl
return;
}
if (getEnergy() >= craftingPreview.energyCost
&& mode != IControllable.Mode.Off) {
if (getEnergy() >= craftingPreview.energyCost) {
setEnergy(0);
craftingPreview = null;
@ -185,7 +184,7 @@ public class TileIntegrationTable extends TileLaserTableBase implements IFlexibl
@Override
public boolean hasWork() {
return craftingPreview != null && super.hasWork();
return craftingPreview != null;
}
@Override

View file

@ -22,7 +22,7 @@ import buildcraft.core.TileBuildCraft;
import buildcraft.core.inventory.SimpleInventory;
import buildcraft.core.utils.AverageUtil;
public abstract class TileLaserTableBase extends TileBuildCraft implements ILaserTarget, IInventory, IHasWork, IControllable {
public abstract class TileLaserTableBase extends TileBuildCraft implements ILaserTarget, IInventory, IHasWork {
public int clientRequiredEnergy = 0;
protected SimpleInventory inv = new SimpleInventory(getSizeInventory(), "inv", 64);
@ -194,15 +194,4 @@ public abstract class TileLaserTableBase extends TileBuildCraft implements ILase
iCrafting.sendProgressBarUpdate(container, 4, lRecentEnergy & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 5, (lRecentEnergy >>> 16) & 0xFFFF);
}
@Override
public boolean hasWork() {
return mode != IControllable.Mode.Off;
}
@Override
public boolean acceptsControlMode(Mode mode) {
return mode == IControllable.Mode.On ||
mode == IControllable.Mode.Off;
}
}