Merge branch 'multiplayer' into 'master'

Multiplayer

See merge request core-developers/forge!207
This commit is contained in:
Sol
2018-02-16 01:07:35 +00:00
10 changed files with 258 additions and 14 deletions

View File

@@ -373,7 +373,14 @@ public class PlayerView extends GameEntityView {
}
public int getMana(final byte color) {
Integer count = getMana().get(color);
Integer count = null;
try {
count = getMana().get(color);
}
catch (Exception e) {
e.printStackTrace();
count = null;
}
return count != null ? count.intValue() : 0;
}
private Map<Byte, Integer> getMana() {

View File

@@ -14,7 +14,7 @@ public abstract class TrackableObject implements IIdentifiable, Serializable {
private static final long serialVersionUID = 7386836745378571056L;
private final int id;
protected final transient Tracker tracker;
protected transient Tracker tracker;
private final Map<TrackableProperty, Object> props;
private final Set<TrackableProperty> changedProps;
private boolean copyingProps;
@@ -30,6 +30,11 @@ public abstract class TrackableObject implements IIdentifiable, Serializable {
return id;
}
// needed for multiplayer support
public void setTracker(Tracker tracker) {
this.tracker = tracker;
}
public final Tracker getTracker() {
return tracker;
}
@@ -45,6 +50,11 @@ public abstract class TrackableObject implements IIdentifiable, Serializable {
return o.hashCode() == id && o.getClass().equals(getClass());
}
// don't know if this is really needed, but don't know a better way
public <T> T getProps() {
return (T)props;
}
@SuppressWarnings("unchecked")
protected final <T> T get(final TrackableProperty key) {
T value = (T)props.get(key);