Patch for latest spigot, may have issues, for #1635

cross-compat is getting messy as Spigot is changing too many names within a single version label
This commit is contained in:
mcmonkey 2018-12-13 01:13:42 -08:00
parent 9ac3f0fa0c
commit eea6e83e83
No known key found for this signature in database
GPG Key ID: 2F0F11928478A6F5
12 changed files with 251 additions and 155 deletions

View File

@ -1,5 +1,7 @@
package net.citizensnpcs.nms.v1_13_R2.entity;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_13_R2.*;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_13_R2.CraftServer;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftChicken;
@ -14,13 +16,8 @@ import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_13_R2.BlockPosition;
import net.minecraft.server.v1_13_R2.DamageSource;
import net.minecraft.server.v1_13_R2.EntityChicken;
import net.minecraft.server.v1_13_R2.IBlockData;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.SoundEffect;
import net.minecraft.server.v1_13_R2.World;
import java.lang.reflect.Method;
public class ChickenController extends MobEntityController {
public ChickenController() {
@ -194,13 +191,25 @@ public class ChickenController extends MobEntityController {
}
@Override
public void k() {
public void movementTick() {
if (npc != null) {
this.bI = 100; // egg timer
}
super.k();
try {
super.movementTick();
}
catch (NoSuchMethodError ex) {
try {
MOVEMENT_TICK.invoke(this);
}
catch (Throwable ex2) {
ex2.printStackTrace();
}
}
}
private static final Method MOVEMENT_TICK = NMS.getMethod(EntityChicken.class, "k", false);
@Override
public void mobTick() {
super.mobTick();
@ -218,4 +227,4 @@ public class ChickenController extends MobEntityController {
}
}
}
}
}

View File

@ -1,5 +1,7 @@
package net.citizensnpcs.nms.v1_13_R2.entity;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_13_R2.*;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_13_R2.CraftServer;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEnderDragon;
@ -14,11 +16,8 @@ import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_13_R2.DamageSource;
import net.minecraft.server.v1_13_R2.EntityEnderDragon;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.SoundEffect;
import net.minecraft.server.v1_13_R2.World;
import java.lang.reflect.Method;
public class EnderDragonController extends MobEntityController {
public EnderDragonController() {
@ -166,7 +165,7 @@ public class EnderDragonController extends MobEntityController {
}
@Override
public void k() {
public void movementTick() {
if (npc != null) {
npc.update();
if (motX != 0 || motY != 0 || motZ != 0) {
@ -177,8 +176,20 @@ public class EnderDragonController extends MobEntityController {
setPosition(locX + motX, locY + motY, locZ + motZ);
}
} else {
super.k();
try {
super.movementTick();
}
catch (NoSuchMethodError ex) {
try {
MOVEMENT_TICK.invoke(this);
}
catch (Throwable ex2) {
ex2.printStackTrace();
}
}
}
}
private static final Method MOVEMENT_TICK = NMS.getMethod(EntityEnderDragon.class, "k", false);
}
}
}

View File

@ -1,5 +1,7 @@
package net.citizensnpcs.nms.v1_13_R2.entity;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_13_R2.*;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_13_R2.CraftServer;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
@ -14,13 +16,8 @@ import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_13_R2.BlockPosition;
import net.minecraft.server.v1_13_R2.DamageSource;
import net.minecraft.server.v1_13_R2.EntityGuardian;
import net.minecraft.server.v1_13_R2.IBlockData;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.SoundEffect;
import net.minecraft.server.v1_13_R2.World;
import java.lang.reflect.Method;
public class GuardianController extends MobEntityController {
public GuardianController() {
@ -178,15 +175,27 @@ public class GuardianController extends MobEntityController {
}
@Override
public void k() {
public void movementTick() {
if (npc == null) {
super.k();
try {
super.movementTick();
}
catch (NoSuchMethodError ex) {
try {
MOVEMENT_TICK.invoke(this);
}
catch (Throwable ex2) {
ex2.printStackTrace();
}
}
} else {
NMSImpl.updateAI(this);
npc.update();
}
}
private static final Method MOVEMENT_TICK = NMS.getMethod(EntityGuardian.class, "k", false);
@Override
public void setSize(float f, float f1) {
if (npc == null) {
@ -210,4 +219,4 @@ public class GuardianController extends MobEntityController {
return npc;
}
}
}
}

View File

@ -1,5 +1,7 @@
package net.citizensnpcs.nms.v1_13_R2.entity;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_13_R2.*;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_13_R2.CraftServer;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftElderGuardian;
@ -14,13 +16,8 @@ import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_13_R2.BlockPosition;
import net.minecraft.server.v1_13_R2.DamageSource;
import net.minecraft.server.v1_13_R2.EntityGuardianElder;
import net.minecraft.server.v1_13_R2.IBlockData;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.SoundEffect;
import net.minecraft.server.v1_13_R2.World;
import java.lang.reflect.Method;
public class GuardianElderController extends MobEntityController {
public GuardianElderController() {
@ -178,15 +175,27 @@ public class GuardianElderController extends MobEntityController {
}
@Override
public void k() {
public void movementTick() {
if (npc == null) {
super.k();
try {
super.movementTick();
}
catch (NoSuchMethodError ex) {
try {
MOVEMENT_TICK.invoke(this);
}
catch (Throwable ex2) {
ex2.printStackTrace();
}
}
} else {
NMSImpl.updateAI(this);
npc.update();
}
}
private static final Method MOVEMENT_TICK = NMS.getMethod(EntityGuardianElder.class, "k", false);
@Override
public void setSize(float f, float f1) {
if (npc == null) {
@ -210,4 +219,4 @@ public class GuardianElderController extends MobEntityController {
return npc;
}
}
}
}

View File

@ -1,5 +1,7 @@
package net.citizensnpcs.nms.v1_13_R2.entity;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_13_R2.*;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_13_R2.CraftServer;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
@ -14,16 +16,8 @@ import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_13_R2.BlockPosition;
import net.minecraft.server.v1_13_R2.ControllerLook;
import net.minecraft.server.v1_13_R2.ControllerMove;
import net.minecraft.server.v1_13_R2.DamageSource;
import net.minecraft.server.v1_13_R2.EntityPhantom;
import net.minecraft.server.v1_13_R2.EnumDifficulty;
import net.minecraft.server.v1_13_R2.IBlockData;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.SoundEffect;
import net.minecraft.server.v1_13_R2.World;
import java.lang.reflect.Method;
public class PhantomController extends MobEntityController {
public PhantomController() {
@ -181,8 +175,18 @@ public class PhantomController extends MobEntityController {
}
@Override
public void k() {
super.k();
public void movementTick() {
try {
super.movementTick();
}
catch (NoSuchMethodError ex) {
try {
MOVEMENT_TICK.invoke(this);
}
catch (Throwable ex2) {
ex2.printStackTrace();
}
}
if (npc != null) {
if (npc.isProtected()) {
this.setOnFire(0);
@ -191,6 +195,8 @@ public class PhantomController extends MobEntityController {
}
}
private static final Method MOVEMENT_TICK = NMS.getMethod(EntityPhantom.class, "k", false);
@Override
public void tick() {
// avoid suicide
@ -227,4 +233,4 @@ public class PhantomController extends MobEntityController {
return npc;
}
}
}
}

View File

@ -168,11 +168,6 @@ public class PufferFishController extends MobEntityController {
return false; // shouldLeash
}
@Override
public void k() {
super.k();
}
@Override
public void mobTick() {
if (npc != null) {
@ -207,4 +202,4 @@ public class PufferFishController extends MobEntityController {
return npc;
}
}
}
}

View File

@ -1,5 +1,7 @@
package net.citizensnpcs.nms.v1_13_R2.entity;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_13_R2.*;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_13_R2.CraftServer;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
@ -14,14 +16,8 @@ import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_13_R2.BlockPosition;
import net.minecraft.server.v1_13_R2.DamageSource;
import net.minecraft.server.v1_13_R2.EntityAIBodyControl;
import net.minecraft.server.v1_13_R2.EntityShulker;
import net.minecraft.server.v1_13_R2.IBlockData;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.SoundEffect;
import net.minecraft.server.v1_13_R2.World;
import java.lang.reflect.Method;
public class ShulkerController extends MobEntityController {
public ShulkerController() {
@ -168,12 +164,24 @@ public class ShulkerController extends MobEntityController {
}
@Override
public void k() {
public void movementTick() {
if (npc == null) {
super.k();
try {
super.movementTick();
}
catch (NoSuchMethodError ex) {
try {
MOVEMENT_TICK.invoke(this);
}
catch (Throwable ex2) {
ex2.printStackTrace();
}
}
}
}
private static final Method MOVEMENT_TICK = NMS.getMethod(EntityShulker.class, "k", false);
@Override
protected EntityAIBodyControl o() {
return new EntityAIBodyControl(this);
@ -220,4 +228,4 @@ public class ShulkerController extends MobEntityController {
return npc;
}
}
}
}

View File

@ -1,5 +1,6 @@
package net.citizensnpcs.nms.v1_13_R2.entity;
import net.citizensnpcs.util.NMS;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_13_R2.CraftServer;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
@ -22,6 +23,8 @@ import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.SoundEffect;
import net.minecraft.server.v1_13_R2.World;
import java.lang.reflect.Method;
public class SnowmanController extends MobEntityController {
public SnowmanController() {
super(EntitySnowmanNPC.class);
@ -167,18 +170,30 @@ public class SnowmanController extends MobEntityController {
}
@Override
public void k() {
public void movementTick() {
boolean allowsGriefing = this.world.getGameRules().getBoolean("mobGriefing");
if (npc != null) {
this.world.getGameRules().set("mobGriefing", "false", this.world.getMinecraftServer());
}
super.k();
try {
super.movementTick();
}
catch (NoSuchMethodError ex) {
try {
MOVEMENT_TICK.invoke(this);
}
catch (Throwable ex2) {
ex2.printStackTrace();
}
}
if (npc != null) {
this.world.getGameRules().set("mobGriefing", Boolean.toString(allowsGriefing),
this.world.getMinecraftServer());
}
}
private static final Method MOVEMENT_TICK = NMS.getMethod(EntitySnowman.class, "k", false);
@Override
public void mobTick() {
super.mobTick();
@ -219,4 +234,4 @@ public class SnowmanController extends MobEntityController {
return npc;
}
}
}
}

View File

@ -13,6 +13,7 @@ import java.util.List;
import java.util.Random;
import java.util.Set;
import net.minecraft.server.v1_13_R2.*;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Location;
@ -182,59 +183,6 @@ import net.citizensnpcs.util.NMSBridge;
import net.citizensnpcs.util.PlayerAnimation;
import net.citizensnpcs.util.PlayerUpdateTask;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_13_R2.AttributeInstance;
import net.minecraft.server.v1_13_R2.AxisAlignedBB;
import net.minecraft.server.v1_13_R2.Block;
import net.minecraft.server.v1_13_R2.BlockPosition;
import net.minecraft.server.v1_13_R2.BossBattleServer;
import net.minecraft.server.v1_13_R2.ControllerJump;
import net.minecraft.server.v1_13_R2.CrashReport;
import net.minecraft.server.v1_13_R2.CrashReportSystemDetails;
import net.minecraft.server.v1_13_R2.DamageSource;
import net.minecraft.server.v1_13_R2.DataWatcherObject;
import net.minecraft.server.v1_13_R2.EnchantmentManager;
import net.minecraft.server.v1_13_R2.Enchantments;
import net.minecraft.server.v1_13_R2.EnderDragonBattle;
import net.minecraft.server.v1_13_R2.Entity;
import net.minecraft.server.v1_13_R2.EntityBird;
import net.minecraft.server.v1_13_R2.EntityEnderDragon;
import net.minecraft.server.v1_13_R2.EntityFish;
import net.minecraft.server.v1_13_R2.EntityFishingHook;
import net.minecraft.server.v1_13_R2.EntityHorse;
import net.minecraft.server.v1_13_R2.EntityHorseAbstract;
import net.minecraft.server.v1_13_R2.EntityHuman;
import net.minecraft.server.v1_13_R2.EntityInsentient;
import net.minecraft.server.v1_13_R2.EntityLiving;
import net.minecraft.server.v1_13_R2.EntityMinecartAbstract;
import net.minecraft.server.v1_13_R2.EntityPlayer;
import net.minecraft.server.v1_13_R2.EntityPolarBear;
import net.minecraft.server.v1_13_R2.EntityRabbit;
import net.minecraft.server.v1_13_R2.EntityShulker;
import net.minecraft.server.v1_13_R2.EntityTameableAnimal;
import net.minecraft.server.v1_13_R2.EntityTracker;
import net.minecraft.server.v1_13_R2.EntityTrackerEntry;
import net.minecraft.server.v1_13_R2.EntityTypes;
import net.minecraft.server.v1_13_R2.EntityWither;
import net.minecraft.server.v1_13_R2.EnumMoveType;
import net.minecraft.server.v1_13_R2.GenericAttributes;
import net.minecraft.server.v1_13_R2.IRegistry;
import net.minecraft.server.v1_13_R2.MathHelper;
import net.minecraft.server.v1_13_R2.MinecraftKey;
import net.minecraft.server.v1_13_R2.MobEffects;
import net.minecraft.server.v1_13_R2.NavigationAbstract;
import net.minecraft.server.v1_13_R2.NetworkManager;
import net.minecraft.server.v1_13_R2.Packet;
import net.minecraft.server.v1_13_R2.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_13_R2.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_13_R2.PathEntity;
import net.minecraft.server.v1_13_R2.PathPoint;
import net.minecraft.server.v1_13_R2.PathfinderGoalSelector;
import net.minecraft.server.v1_13_R2.RegistryMaterials;
import net.minecraft.server.v1_13_R2.ReportedException;
import net.minecraft.server.v1_13_R2.SoundEffect;
import net.minecraft.server.v1_13_R2.SoundEffects;
import net.minecraft.server.v1_13_R2.Vec3D;
import net.minecraft.server.v1_13_R2.WorldServer;
@SuppressWarnings("unchecked")
public class NMSImpl implements NMSBridge {
@ -1332,7 +1280,7 @@ public class NMSImpl implements NMSBridge {
entity.a(f, f1, f2, f3);
f9 = 0.91F;
if (entity.onGround) {
f9 = entity.world.getType(blockposition_b.e(entity.locX, bb.minY - 1.0D, entity.locZ))
f9 = entity.world.getType(getBlockPositionBE(blockposition_b, entity.locX, bb.minY - 1.0D, entity.locZ))
.getBlock().n() * 0.91F;
}
if (entity.z_()) {
@ -1356,7 +1304,7 @@ public class NMSImpl implements NMSBridge {
- entity.motY) * 0.2D;
entity.fallDistance = 0.0F;
} else {
blockposition_b.e(entity.locX, 0.0D, entity.locZ);
getBlockPositionBE(blockposition_b, entity.locX, 0.0D, entity.locZ);
if ((entity.world.isClientSide) && ((!entity.world.isLoaded(blockposition_b))
|| (!entity.world.getChunkAtWorldCoords(blockposition_b).y()))) {
if (entity.locY > 0.0D) {
@ -1401,6 +1349,23 @@ public class NMSImpl implements NMSBridge {
entity.aK += entity.aJ;
}
private static BlockPosition.b getBlockPositionBE(BlockPosition.b blockPos, double x, double y, double z) {
try {
return blockPos.c(x, y, z);
}
catch (NoSuchMethodError ex) {
try {
return (BlockPosition.b) BLOCK_POSITION_B_D.invoke(blockPos, x, y, z);
}
catch (Throwable ex2) {
ex2.printStackTrace();
return null;
}
}
}
private static final Method BLOCK_POSITION_B_D = NMS.getMethod(BlockPosition.b.class, "e", false, double.class, double.class, double.class);
public static BossBar getBossBar(org.bukkit.entity.Entity entity) {
BossBattleServer bserver = null;
try {

View File

@ -2,28 +2,10 @@ package net.citizensnpcs.nms.v1_13_R2.util;
import net.citizensnpcs.nms.v1_13_R2.entity.EntityHumanNPC;
import net.citizensnpcs.util.BoundingBox;
import net.minecraft.server.v1_13_R2.AttributeInstance;
import net.minecraft.server.v1_13_R2.Block;
import net.minecraft.server.v1_13_R2.BlockPosition;
import net.minecraft.server.v1_13_R2.Blocks;
import net.minecraft.server.v1_13_R2.ChunkCache;
import net.minecraft.server.v1_13_R2.Entity;
import net.minecraft.server.v1_13_R2.EntityInsentient;
import net.minecraft.server.v1_13_R2.EntityTypes;
import net.minecraft.server.v1_13_R2.GenericAttributes;
import net.minecraft.server.v1_13_R2.IBlockData;
import net.minecraft.server.v1_13_R2.MathHelper;
import net.minecraft.server.v1_13_R2.NavigationAbstract;
import net.minecraft.server.v1_13_R2.PathEntity;
import net.minecraft.server.v1_13_R2.PathMode;
import net.minecraft.server.v1_13_R2.PathPoint;
import net.minecraft.server.v1_13_R2.PathType;
import net.minecraft.server.v1_13_R2.Pathfinder;
import net.minecraft.server.v1_13_R2.PathfinderAbstract;
import net.minecraft.server.v1_13_R2.PathfinderNormal;
import net.minecraft.server.v1_13_R2.SystemUtils;
import net.minecraft.server.v1_13_R2.Vec3D;
import net.minecraft.server.v1_13_R2.World;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_13_R2.*;
import java.lang.reflect.Method;
public class PlayerNavigation extends NavigationAbstract {
protected EntityHumanNPC a;
@ -165,7 +147,7 @@ public class PlayerNavigation extends NavigationAbstract {
if ((this.c != null) && (!this.c.b())) {
Vec3D localVec3D = this.c.f();
if (localVec3D.equals(this.h)) {
this.i += SystemUtils.b() - this.j;
this.i += getMonotonicMillis() - this.j;
} else {
this.h = localVec3D;
double d1 = paramVec3D.f(this.h);
@ -177,10 +159,27 @@ public class PlayerNavigation extends NavigationAbstract {
this.k = 0.0D;
q();
}
this.j = SystemUtils.b();
this.j = getMonotonicMillis();
}
}
private static long getMonotonicMillis() {
try {
return SystemUtils.getMonotonicMillis();
}
catch (NoSuchMethodError ex) {
try {
return (long) GET_MONOTONIC_MILLIS.invoke(null);
}
catch (Throwable ex2) {
ex2.printStackTrace();
return 0;
}
}
}
private static final Method GET_MONOTONIC_MILLIS = NMS.getMethod(SystemUtils.class, "b", false);
@Override
protected boolean a(Vec3D paramVec3D1, Vec3D paramVec3D2, int paramInt1, int paramInt2, int paramInt3) {
int i = MathHelper.floor(paramVec3D1.x);
@ -464,17 +463,40 @@ public class PlayerNavigation extends NavigationAbstract {
this.q = paramBlockPosition;
float f1 = j();
this.b.methodProfiler.a("pathfind");
try {
this.b.methodProfiler.enter("pathfind");
}
catch (NoSuchMethodError ex) {
try {
PROFILER_ENTER.invoke(this.b.methodProfiler, "pathfind");
}
catch (Throwable ex2) {
ex2.printStackTrace();
}
}
BlockPosition localBlockPosition = new BlockPosition(this.a);
int i1 = (int) (f1 + 8.0F);
ChunkCache localChunkCache = new ChunkCache(this.b, localBlockPosition.a(-i1, -i1, -i1),
localBlockPosition.a(i1, i1, i1), 0);
PathEntity localPathEntity = this.r.a(localChunkCache, this.a, this.q, f1);
this.b.methodProfiler.e();
try {
this.b.methodProfiler.exit();
}
catch (NoSuchMethodError ex) {
try {
PROFILER_EXIT.invoke(this.b.methodProfiler);
}
catch (Throwable ex2) {
ex2.printStackTrace();
}
}
return localPathEntity;
}
private static final Method PROFILER_ENTER = NMS.getMethod(MethodProfiler.class, "a", false, String.class);
private static final Method PROFILER_EXIT = NMS.getMethod(MethodProfiler.class, "e", false);
protected void superE_() {
if (this.c == null) {
return;
@ -527,4 +549,4 @@ public class PlayerNavigation extends NavigationAbstract {
return new EntityInsentient(EntityTypes.PLAYER, world) {
};
}
}
}

View File

@ -185,6 +185,8 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
return var11;
}
private static final Method BLOCK_POSITION_B_C = NMS.getMethod(BlockPosition.b.class, "f", false, int.class, int.class, int.class);
public PathType a(IBlockAccess var1, int var2, int var3, int var4, PathType var5) {
if (var5 == PathType.WALKABLE) {
BlockPosition.b var6 = BlockPosition.b.r();
@ -194,7 +196,20 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
for (int var8 = -1; var8 <= 1; ++var8) {
for (int var9 = -1; var9 <= 1; ++var9) {
if (var8 != 0 || var9 != 0) {
Block var10 = var1.getType(var6.f(var8 + var2, var3, var9 + var4)).getBlock();
BlockPosition blockPos;
try {
blockPos = var6.c(var8 + var2, var3, var9 + var4);
}
catch (NoSuchMethodError ex) {
try {
blockPos = (BlockPosition.b) BLOCK_POSITION_B_C.invoke(var6, var8 + var2, var3, var9 + var4);
}
catch (Throwable ex2) {
ex2.printStackTrace();
return PathType.BLOCKED;
}
}
Block var10 = var1.getType(blockPos).getBlock();
if (var10 == Blocks.CACTUS) {
var5 = PathType.DANGER_CACTUS;
} else if (var10 == Blocks.FIRE) {

View File

@ -28,7 +28,7 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
Entity tracker = getTracker(this);
if (entityplayer != tracker && c(entityplayer)) {
if (!this.trackedPlayers.contains(entityplayer)
&& ((entityplayer.getWorldServer().getPlayerChunkMap().a(entityplayer, tracker.ae, tracker.ag))
&& ((entityplayer.getWorldServer().getPlayerChunkMap().a(entityplayer, getChunkX(tracker), getChunkZ(tracker)))
|| (tracker.attachedToPlayer))) {
if ((tracker instanceof SkinnableEntity)) {
SkinnableEntity skinnable = (SkinnableEntity) tracker;
@ -99,6 +99,38 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
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_Z = NMS.getField(Entity.class, "ag", false);
private static Field E = NMS.getField(EntityTrackerEntry.class, "e");
private static Field F = NMS.getField(EntityTrackerEntry.class, "f");
private static Field G = NMS.getField(EntityTrackerEntry.class, "g");