rethink things and remove IControllable from Tables - control the lasers!
This commit is contained in:
parent
a5b4dc3742
commit
d0854772d8
5 changed files with 8 additions and 26 deletions
|
@ -32,7 +32,6 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||||
import buildcraft.BuildCraftSilicon;
|
import buildcraft.BuildCraftSilicon;
|
||||||
import buildcraft.api.core.IInvSlot;
|
import buildcraft.api.core.IInvSlot;
|
||||||
import buildcraft.api.power.ILaserTarget;
|
import buildcraft.api.power.ILaserTarget;
|
||||||
import buildcraft.api.tiles.IControllable;
|
|
||||||
import buildcraft.core.inventory.InvUtils;
|
import buildcraft.core.inventory.InvUtils;
|
||||||
import buildcraft.core.inventory.InventoryCopy;
|
import buildcraft.core.inventory.InventoryCopy;
|
||||||
import buildcraft.core.inventory.InventoryIterator;
|
import buildcraft.core.inventory.InventoryIterator;
|
||||||
|
@ -233,9 +232,6 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
|
||||||
if (worldObj.isRemote) {
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mode == IControllable.Mode.Off) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
updateRecipe();
|
updateRecipe();
|
||||||
searchNeighborsForIngredients();
|
searchNeighborsForIngredients();
|
||||||
locateAndBindIngredients();
|
locateAndBindIngredients();
|
||||||
|
@ -440,12 +436,12 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCraft() {
|
public boolean canCraft() {
|
||||||
return craftable && !justCrafted && mode != IControllable.Mode.Off;
|
return craftable && !justCrafted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasWork() {
|
public boolean hasWork() {
|
||||||
return requiresLaserEnergy() && super.hasWork();
|
return requiresLaserEnergy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,7 +28,6 @@ import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.api.recipes.CraftingResult;
|
import buildcraft.api.recipes.CraftingResult;
|
||||||
import buildcraft.api.recipes.IFlexibleCrafter;
|
import buildcraft.api.recipes.IFlexibleCrafter;
|
||||||
import buildcraft.api.recipes.IFlexibleRecipe;
|
import buildcraft.api.recipes.IFlexibleRecipe;
|
||||||
import buildcraft.api.tiles.IControllable;
|
|
||||||
import buildcraft.core.network.CommandWriter;
|
import buildcraft.core.network.CommandWriter;
|
||||||
import buildcraft.core.network.ICommandReceiver;
|
import buildcraft.core.network.ICommandReceiver;
|
||||||
import buildcraft.core.network.PacketCommand;
|
import buildcraft.core.network.PacketCommand;
|
||||||
|
@ -79,8 +78,7 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getEnergy() >= currentRecipe.craft(this, true).energyCost
|
if (getEnergy() >= currentRecipe.craft(this, true).energyCost) {
|
||||||
&& mode != IControllable.Mode.Off) {
|
|
||||||
setEnergy(0);
|
setEnergy(0);
|
||||||
|
|
||||||
if (currentRecipe.canBeCrafted(this)) {
|
if (currentRecipe.canBeCrafted(this)) {
|
||||||
|
@ -316,7 +314,7 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasWork() {
|
public boolean hasWork() {
|
||||||
return currentRecipe != null && super.hasWork();
|
return currentRecipe != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class TileChargingTable extends TileLaserTableBase implements IHasWork {
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (getEnergy() > 0 && mode != Mode.Off) {
|
if (getEnergy() > 0) {
|
||||||
if (getRequiredEnergy() > 0) {
|
if (getRequiredEnergy() > 0) {
|
||||||
ItemStack stack = this.getStackInSlot(0);
|
ItemStack stack = this.getStackInSlot(0);
|
||||||
IEnergyContainerItem containerItem = (IEnergyContainerItem) stack.getItem();
|
IEnergyContainerItem containerItem = (IEnergyContainerItem) stack.getItem();
|
||||||
|
|
|
@ -79,8 +79,7 @@ public class TileIntegrationTable extends TileLaserTableBase implements IFlexibl
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getEnergy() >= craftingPreview.energyCost
|
if (getEnergy() >= craftingPreview.energyCost) {
|
||||||
&& mode != IControllable.Mode.Off) {
|
|
||||||
setEnergy(0);
|
setEnergy(0);
|
||||||
craftingPreview = null;
|
craftingPreview = null;
|
||||||
|
|
||||||
|
@ -185,7 +184,7 @@ public class TileIntegrationTable extends TileLaserTableBase implements IFlexibl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasWork() {
|
public boolean hasWork() {
|
||||||
return craftingPreview != null && super.hasWork();
|
return craftingPreview != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,7 +22,7 @@ import buildcraft.core.TileBuildCraft;
|
||||||
import buildcraft.core.inventory.SimpleInventory;
|
import buildcraft.core.inventory.SimpleInventory;
|
||||||
import buildcraft.core.utils.AverageUtil;
|
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;
|
public int clientRequiredEnergy = 0;
|
||||||
protected SimpleInventory inv = new SimpleInventory(getSizeInventory(), "inv", 64);
|
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, 4, lRecentEnergy & 0xFFFF);
|
||||||
iCrafting.sendProgressBarUpdate(container, 5, (lRecentEnergy >>> 16) & 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue