Fix backwards compat issue with 1.13.2

This commit is contained in:
fullwall 2019-04-25 14:41:45 +08:00
parent e6a3329ddc
commit ae96a02e49
4 changed files with 31 additions and 36 deletions

View File

@ -4,7 +4,7 @@ softdepend: [Vault]
version: ${project.version} (build ${BUILD_NUMBER}) version: ${project.version} (build ${BUILD_NUMBER})
main: net.citizensnpcs.Citizens main: net.citizensnpcs.Citizens
website: http://www.citizensnpcs.co website: http://www.citizensnpcs.co
api-version: "1.14" api-version: "1.13"
commands: commands:
traitc: traitc:
aliases: [trc] aliases: [trc]

View File

@ -27,9 +27,8 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
return; return;
Entity tracker = getTracker(this); Entity tracker = getTracker(this);
if (entityplayer != tracker && c(entityplayer)) { if (entityplayer != tracker && c(entityplayer)) {
if (!this.trackedPlayers.contains(entityplayer) if (!this.trackedPlayers.contains(entityplayer) && ((entityplayer.getWorldServer().getPlayerChunkMap()
&& ((entityplayer.getWorldServer().getPlayerChunkMap().a(entityplayer, getChunkX(tracker), getChunkZ(tracker))) .a(entityplayer, getChunkX(tracker), getChunkZ(tracker))) || (tracker.attachedToPlayer))) {
|| (tracker.attachedToPlayer))) {
if ((tracker instanceof SkinnableEntity)) { if ((tracker instanceof SkinnableEntity)) {
SkinnableEntity skinnable = (SkinnableEntity) tracker; SkinnableEntity skinnable = (SkinnableEntity) tracker;
@ -44,6 +43,32 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
super.updatePlayer(entityplayer); super.updatePlayer(entityplayer);
} }
private static int getChunkX(Entity tracker) {
try {
return tracker.chunkX;
} catch (NoSuchFieldError ex) {
try {
return CHUNK_X.getInt(tracker);
} catch (Exception ex2) {
ex2.printStackTrace();
return 0;
}
}
}
private static int getChunkZ(Entity tracker) {
try {
return tracker.chunkZ;
} catch (NoSuchFieldError ex) {
try {
return CHUNK_Z.getInt(tracker);
} catch (Exception ex2) {
ex2.printStackTrace();
return 0;
}
}
}
private static int getE(EntityTrackerEntry entry) { private static int getE(EntityTrackerEntry entry) {
try { try {
return (Integer) E.get(entry); return (Integer) E.get(entry);
@ -99,36 +124,6 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
return false; return false;
} }
private static int getChunkX(Entity tracker) {
try {
return tracker.chunkX;
}
catch (NoSuchFieldError ex) {
try {
return CHUNK_X.getInt(tracker);
}
catch (Exception ex2) {
ex2.printStackTrace();
return 0;
}
}
}
private static int getChunkZ(Entity tracker) {
try {
return tracker.chunkZ;
}
catch (NoSuchFieldError ex) {
try {
return CHUNK_Z.getInt(tracker);
}
catch (Exception ex2) {
ex2.printStackTrace();
return 0;
}
}
}
private static Field CHUNK_X = NMS.getField(Entity.class, "ae", false); private static Field CHUNK_X = NMS.getField(Entity.class, "ae", false);
private static Field CHUNK_Z = NMS.getField(Entity.class, "ag", false); private static Field CHUNK_Z = NMS.getField(Entity.class, "ag", false);
private static Field E = NMS.getField(EntityTrackerEntry.class, "e"); private static Field E = NMS.getField(EntityTrackerEntry.class, "e");

View File

@ -1004,7 +1004,7 @@ public class NMSImpl implements NMSBridge {
@Override @Override
public void setSitting(Ocelot ocelot, boolean sitting) { public void setSitting(Ocelot ocelot, boolean sitting) {
/* TODO */ // sitting removed
} }
@Override @Override

View File

@ -61,7 +61,7 @@ public class PlayerNavigation extends NavigationAbstract {
this.p = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE); this.p = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE);
this.o = new PlayerPathfinderNormal(); this.o = new PlayerPathfinderNormal();
this.o.a(true); this.o.a(true);
this.r = new PlayerPathfinder(this.o, 100); // TODO: what is this parameter normally? this.r = new PlayerPathfinder(this.o, 768);
this.setRange(24); this.setRange(24);
// this.b.C().a(this); // this.b.C().a(this);
} }