Fixes and stuff and things (too lazy to write a commit message but not lazy to write this long sentence)
This commit is contained in:
@@ -89,8 +89,6 @@ public abstract class CraftingTask implements ICraftingTask {
|
|||||||
child = NetworkUtils.createCraftingTask(network, pattern);
|
child = NetworkUtils.createCraftingTask(network, pattern);
|
||||||
|
|
||||||
childrenCreated[i] = true;
|
childrenCreated[i] = true;
|
||||||
|
|
||||||
network.updateCraftingTasks();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,11 +91,6 @@ public interface INetworkMaster {
|
|||||||
*/
|
*/
|
||||||
void cancelCraftingTask(@Nonnull ICraftingTask task);
|
void cancelCraftingTask(@Nonnull ICraftingTask task);
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends a update packet to all crafting monitors with the crafting task status.
|
|
||||||
*/
|
|
||||||
void updateCraftingTasks();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of crafting patterns in this network, do NOT modify this list
|
* @return a list of crafting patterns in this network, do NOT modify this list
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ public class CraftingTaskNormal extends CraftingTask {
|
|||||||
|
|
||||||
took.add(received);
|
took.add(received);
|
||||||
tookSlots[i] = received;
|
tookSlots[i] = received;
|
||||||
|
|
||||||
network.updateCraftingTasks();
|
|
||||||
} else {
|
} else {
|
||||||
tryCreateChild(network, i);
|
tryCreateChild(network, i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,6 @@ public class CraftingTaskProcessing extends CraftingTask {
|
|||||||
satisfied[i] = true;
|
satisfied[i] = true;
|
||||||
|
|
||||||
took.add(received);
|
took.add(received);
|
||||||
|
|
||||||
network.updateCraftingTasks();
|
|
||||||
} else {
|
} else {
|
||||||
tryCreateChild(network, i);
|
tryCreateChild(network, i);
|
||||||
}
|
}
|
||||||
@@ -70,19 +68,11 @@ public class CraftingTaskProcessing extends CraftingTask {
|
|||||||
tileInUse = null;
|
tileInUse = null;
|
||||||
|
|
||||||
waitingOnTileInUse = false;
|
waitingOnTileInUse = false;
|
||||||
|
|
||||||
network.updateCraftingTasks();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!took.isEmpty() && container.getFacingTile() != null) {
|
if (!took.isEmpty() && container.getFacingTile() != null) {
|
||||||
boolean wasWaitingOnTileInUse = waitingOnTileInUse;
|
|
||||||
|
|
||||||
waitingOnTileInUse = isTileInUse(network);
|
waitingOnTileInUse = isTileInUse(network);
|
||||||
|
|
||||||
if (wasWaitingOnTileInUse != waitingOnTileInUse) {
|
|
||||||
network.updateCraftingTasks();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!waitingOnTileInUse) {
|
if (!waitingOnTileInUse) {
|
||||||
tileInUse = pattern.getContainer().getFacingTile().getPos();
|
tileInUse = pattern.getContainer().getFacingTile().getPos();
|
||||||
|
|
||||||
@@ -92,8 +82,6 @@ public class CraftingTaskProcessing extends CraftingTask {
|
|||||||
ItemHandlerHelper.insertItem(container.getFacingInventory(), toInsert, false);
|
ItemHandlerHelper.insertItem(container.getFacingInventory(), toInsert, false);
|
||||||
|
|
||||||
took.remove(0);
|
took.remove(0);
|
||||||
|
|
||||||
network.updateCraftingTasks();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,4 +245,4 @@ public class CraftingTaskProcessing extends CraftingTask {
|
|||||||
|
|
||||||
return (int) ((float) satisfiedAmount / (float) (satisfied.length + satisfiedInsertion.length) * 100F);
|
return (int) ((float) satisfiedAmount / (float) (satisfied.length + satisfiedInsertion.length) * 100F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,8 +162,6 @@ public class ItemGridHandler implements IItemGridHandler {
|
|||||||
if (task != null) {
|
if (task != null) {
|
||||||
task.getChild().onCancelled(network);
|
task.getChild().onCancelled(network);
|
||||||
task.setChild(null);
|
task.setChild(null);
|
||||||
|
|
||||||
network.updateCraftingTasks();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (id == -1) {
|
} else if (id == -1) {
|
||||||
|
|||||||
@@ -275,10 +275,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
|
|
||||||
craftingTasksToAdd.clear();
|
craftingTasksToAdd.clear();
|
||||||
|
|
||||||
if (!craftingTasks.isEmpty()) {
|
|
||||||
markDirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator<ICraftingTask> craftingTaskIterator = craftingTasks.iterator();
|
Iterator<ICraftingTask> craftingTaskIterator = craftingTasks.iterator();
|
||||||
|
|
||||||
while (craftingTaskIterator.hasNext()) {
|
while (craftingTaskIterator.hasNext()) {
|
||||||
@@ -291,7 +287,9 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (craftingTasksChanged) {
|
if (!craftingTasks.isEmpty() || craftingTasksChanged) {
|
||||||
|
markDirty();
|
||||||
|
|
||||||
updateCraftingTasks();
|
updateCraftingTasks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,10 +338,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
return container != null && ticks % container.getSpeed() == 0 && task.update(worldObj, this);
|
return container != null && ticks % container.getSpeed() == 0 && task.update(worldObj, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateCraftingTasks() {
|
public void updateCraftingTasks() {
|
||||||
markDirty();
|
|
||||||
|
|
||||||
for (INetworkNode node : nodeGraph.all()) {
|
for (INetworkNode node : nodeGraph.all()) {
|
||||||
if (node instanceof TileCraftingMonitor) {
|
if (node instanceof TileCraftingMonitor) {
|
||||||
((TileCraftingMonitor) node).dataManager.sendParameterToWatchers(TileCraftingMonitor.TASKS);
|
((TileCraftingMonitor) node).dataManager.sendParameterToWatchers(TileCraftingMonitor.TASKS);
|
||||||
|
|||||||
Reference in New Issue
Block a user