Only issue a network update on TickPhase START

This commit is contained in:
Raoul Van den Berge
2016-06-23 16:51:18 +02:00
parent fde2dc6ef2
commit fd19a0c17c
3 changed files with 15 additions and 9 deletions

View File

@@ -172,6 +172,7 @@ public class NetworkMaster implements INetworkMaster {
INetworkSlave slave = slaves.next(); INetworkSlave slave = slaves.next();
if (slave.canUpdate()) { if (slave.canUpdate()) {
System.out.println("Updating slave " + slave);
slave.updateSlave(); slave.updateSlave();
} }
@@ -185,6 +186,7 @@ public class NetworkMaster implements INetworkMaster {
} }
} }
} }
System.out.println("===Done===");
for (ICraftingTask taskToCancel : craftingTasksToCancel) { for (ICraftingTask taskToCancel : craftingTasksToCancel) {
taskToCancel.onCancelled(this); taskToCancel.onCancelled(this);

View File

@@ -11,6 +11,7 @@ import java.util.Map;
public class NetworkMasterEventHandler { public class NetworkMasterEventHandler {
@SubscribeEvent @SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent e) { public void onWorldTick(TickEvent.WorldTickEvent e) {
if (e.phase == TickEvent.Phase.START) {
Map<BlockPos, INetworkMaster> networks = NetworkMasterRegistry.get(e.world); Map<BlockPos, INetworkMaster> networks = NetworkMasterRegistry.get(e.world);
if (networks != null) { if (networks != null) {
@@ -23,11 +24,14 @@ public class NetworkMasterEventHandler {
} }
} }
} }
}
@SubscribeEvent @SubscribeEvent
public void onWorldLoad(WorldEvent.Load e) { public void onWorldLoad(WorldEvent.Load e) {
if (!e.getWorld().isRemote) {
NetworkMasterSavedData.getOrLoad(e.getWorld()); NetworkMasterSavedData.getOrLoad(e.getWorld());
} }
}
@SubscribeEvent @SubscribeEvent
public void onWorldUnload(WorldEvent.Unload e) { public void onWorldUnload(WorldEvent.Unload e) {

View File

@@ -243,7 +243,7 @@ public class GuiGrid extends GuiBase {
@Override @Override
public void drawForeground(int mouseX, int mouseY) { public void drawForeground(int mouseX, int mouseY) {
drawString(7, 8, t(grid instanceof WirelessGrid ? "gui.refinedstorage:wireless_grid" : "gui.refinedstorage:grid")); drawString(7, 7, t(grid instanceof WirelessGrid ? "gui.refinedstorage:wireless_grid" : "gui.refinedstorage:grid"));
if (grid.getType() == EnumGridType.CRAFTING) { if (grid.getType() == EnumGridType.CRAFTING) {
drawString(7, 95, t("container.crafting")); drawString(7, 95, t("container.crafting"));