Merge branch 'network-play-fixes' into 'master'

Network play fixes

See merge request core-developers/forge!2582
This commit is contained in:
Sol
2020-03-05 02:51:16 +00:00
2 changed files with 15 additions and 11 deletions

View File

@@ -100,17 +100,21 @@ public class TrackableTypes {
if (newCollection != null) { if (newCollection != null) {
//swap in objects in old collection for objects in new collection //swap in objects in old collection for objects in new collection
for (int i = 0; i < newCollection.size(); i++) { for (int i = 0; i < newCollection.size(); i++) {
T newObj = newCollection.get(i); try {
if (newObj != null) { T newObj = newCollection.get(i);
T existingObj = from.getTracker().getObj(itemType, newObj.getId()); if (newObj != null) {
if (existingObj != null) { //if object exists already, update its changed properties T existingObj = from.getTracker().getObj(itemType, newObj.getId());
existingObj.copyChangedProps(newObj); if (existingObj != null) { //if object exists already, update its changed properties
newCollection.remove(i); existingObj.copyChangedProps(newObj);
newCollection.add(i, existingObj); newCollection.remove(i);
} newCollection.add(i, existingObj);
else { //if object is new, cache in object lookup }
from.getTracker().putObj(itemType, newObj.getId(), newObj); else { //if object is new, cache in object lookup
from.getTracker().putObj(itemType, newObj.getId(), newObj);
}
} }
} catch (IndexOutOfBoundsException e) {
System.err.println("got an IndexOutOfBoundsException, trying to continue ...");
} }
} }
} }

View File

@@ -75,7 +75,7 @@ public enum ProtocolMethod {
clearSelectables (Mode.SERVER), clearSelectables (Mode.SERVER),
refreshField (Mode.SERVER), refreshField (Mode.SERVER),
// TODO case "setPlayerAvatar": // TODO case "setPlayerAvatar":
openZones (Mode.SERVER, PlayerZoneUpdates.class, Collection/*ZoneType*/.class, Map/*PlayerView,Object*/.class), openZones (Mode.SERVER, PlayerZoneUpdates.class, PlayerView.class, Collection/*ZoneType*/.class, Map/*PlayerView,Object*/.class),
restoreOldZones (Mode.SERVER, Void.TYPE, PlayerView.class, PlayerZoneUpdates.class), restoreOldZones (Mode.SERVER, Void.TYPE, PlayerView.class, PlayerZoneUpdates.class),
isUiSetToSkipPhase (Mode.SERVER, Boolean.TYPE, PlayerView.class, PhaseType.class), isUiSetToSkipPhase (Mode.SERVER, Boolean.TYPE, PlayerView.class, PhaseType.class),
setRememberedActions(Mode.SERVER, Void.TYPE), setRememberedActions(Mode.SERVER, Void.TYPE),