Update for 1.13.2
This commit is contained in:
parent
a545c318a7
commit
3c1975f1df
|
@ -288,6 +288,10 @@ public class CitizensNavigator implements Navigator, Runnable {
|
|||
private void stopNavigating(CancelReason reason) {
|
||||
if (!isNavigating())
|
||||
return;
|
||||
if (executing != null) {
|
||||
executing.stop();
|
||||
}
|
||||
executing = null;
|
||||
Iterator<NavigatorCallback> itr = localParams.callbacks().iterator();
|
||||
while (itr.hasNext()) {
|
||||
itr.next().onCompletion(reason);
|
||||
|
|
|
@ -66,6 +66,7 @@ public class Messages {
|
|||
public static final String ERROR_CLEARING_GOALS = "citizens.nms-errors.clearing-goals";
|
||||
public static final String ERROR_GETTING_FIELD = "citizens.nms-errors.getting-field";
|
||||
public static final String ERROR_GETTING_ID_MAPPING = "citizens.nms-errors.getting-id-mapping";
|
||||
public static final String ERROR_GETTING_METHOD = "citizens.nms-errors.getting-method";
|
||||
public static final String ERROR_INITALISING_SUB_PLUGIN = "citizens.sub-plugins.error-on-load";
|
||||
public static final String ERROR_LOADING_ECONOMY = "citizens.economy.error-loading";
|
||||
public static final String ERROR_SETTING_ENTITY_PERSISTENT = "citizens.nms-errors.error-setting-persistent";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.citizensnpcs.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
@ -116,6 +117,21 @@ public class NMS {
|
|||
return BRIDGE.getHorizontalMovement(bukkitEntity);
|
||||
}
|
||||
|
||||
public static Method getMethod(Class<?> clazz, String method, boolean log, Class<?>... params) {
|
||||
if (clazz == null)
|
||||
return null;
|
||||
Method f = null;
|
||||
try {
|
||||
f = clazz.getDeclaredMethod(method, params);
|
||||
f.setAccessible(true);
|
||||
} catch (Exception e) {
|
||||
if (log) {
|
||||
Messaging.logTr(Messages.ERROR_GETTING_METHOD, method, e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
public static NPC getNPC(Entity entity) {
|
||||
return BRIDGE.getNPC(entity);
|
||||
}
|
||||
|
|
|
@ -280,6 +280,7 @@ citizens.load-task-error=NPC load task couldn''t be scheduled, disabling...
|
|||
citizens.nms-errors.clearing-goals=Could not clear goals: {0}.
|
||||
citizens.nms-errors.error-setting-persistent=Could not set NPC as persistent: {0}. NPC entity may despawn.
|
||||
citizens.nms-errors.getting-field=Could not fetch NMS field {0}: [[{1}.
|
||||
citizens.nms-errors.getting-method=Could not fetch NMS method {0}: [[{1}.
|
||||
citizens.nms-errors.getting-id-mapping=Could not fetch entity id mapping fields: {0}.
|
||||
citizens.nms-errors.spawning-custom-entity=Could not spawn custom entity: {0}.
|
||||
citizens.nms-errors.stopping-network-threads=Could not stop network threads: {0}.
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<craftbukkit.version>1.13.1-R0.1-SNAPSHOT</craftbukkit.version>
|
||||
<craftbukkit.version>1.13.2-R0.1-SNAPSHOT</craftbukkit.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
|
|
|
@ -185,7 +185,7 @@ public class CodController extends MobEntityController {
|
|||
@Override
|
||||
public void mobTick() {
|
||||
if (npc != null) {
|
||||
t(false);
|
||||
NMSImpl.setNotInSchool(this);
|
||||
}
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
|
|
|
@ -176,7 +176,7 @@ public class PufferFishController extends MobEntityController {
|
|||
@Override
|
||||
public void mobTick() {
|
||||
if (npc != null) {
|
||||
t(false);
|
||||
NMSImpl.setNotInSchool(this);
|
||||
}
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
|
|
|
@ -171,7 +171,7 @@ public class SalmonController extends MobEntityController {
|
|||
@Override
|
||||
public void mobTick() {
|
||||
if (npc != null) {
|
||||
t(false);
|
||||
NMSImpl.setNotInSchool(this);
|
||||
}
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
|
|
|
@ -171,7 +171,7 @@ public class TropicalFishController extends MobEntityController {
|
|||
@Override
|
||||
public void mobTick() {
|
||||
if (npc != null) {
|
||||
t(false);
|
||||
NMSImpl.setNotInSchool(this);
|
||||
}
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package net.citizensnpcs.nms.v1_13_R2.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.citizensnpcs.util.BoundingBox;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_13_R2.AxisAlignedBB;
|
||||
|
||||
public class NMSBoundingBox {
|
||||
private NMSBoundingBox() {
|
||||
}
|
||||
|
||||
public static BoundingBox wrap(AxisAlignedBB bb) {
|
||||
double minX = 0, minY = 0, minZ = 0, maxX = 0, maxY = 0, maxZ = 0;
|
||||
try {
|
||||
minX = bb.minX;
|
||||
minY = bb.minY;
|
||||
minZ = bb.minZ;
|
||||
maxX = bb.maxX;
|
||||
maxY = bb.maxY;
|
||||
maxZ = bb.maxZ;
|
||||
} catch (NoSuchFieldError ex) {
|
||||
try {
|
||||
minX = a.getDouble(bb);
|
||||
minY = b.getDouble(bb);
|
||||
minZ = c.getDouble(bb);
|
||||
maxX = d.getDouble(bb);
|
||||
maxY = e.getDouble(bb);
|
||||
maxZ = f.getDouble(bb);
|
||||
} catch (Exception ex2) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return new BoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
|
||||
private static final Field a = NMS.getFinalField(AxisAlignedBB.class, "a", false);
|
||||
private static final Field b = NMS.getFinalField(AxisAlignedBB.class, "b", false);
|
||||
private static final Field c = NMS.getFinalField(AxisAlignedBB.class, "c", false);
|
||||
private static final Field d = NMS.getFinalField(AxisAlignedBB.class, "d", false);
|
||||
private static final Field e = NMS.getFinalField(AxisAlignedBB.class, "e", false);
|
||||
private static final Field f = NMS.getFinalField(AxisAlignedBB.class, "f", false);
|
||||
}
|
|
@ -197,6 +197,7 @@ 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;
|
||||
|
@ -338,8 +339,7 @@ public class NMSImpl implements NMSBridge {
|
|||
|
||||
@Override
|
||||
public BoundingBox getBoundingBox(org.bukkit.entity.Entity handle) {
|
||||
AxisAlignedBB bb = NMSImpl.getHandle(handle).getBoundingBox();
|
||||
return new BoundingBox(bb.a, bb.b, bb.c, bb.d, bb.e, bb.f);
|
||||
return NMSBoundingBox.wrap(NMSImpl.getHandle(handle).getBoundingBox());
|
||||
}
|
||||
|
||||
private float getDragonYaw(Entity handle, double tX, double tZ) {
|
||||
|
@ -1313,8 +1313,8 @@ public class NMSImpl implements NMSBridge {
|
|||
}
|
||||
} else {
|
||||
float f9 = 0.91F;
|
||||
BlockPosition.b blockposition_b = BlockPosition.b.d(entity.locX, entity.getBoundingBox().b - 1.0D,
|
||||
entity.locZ);
|
||||
BoundingBox bb = NMSBoundingBox.wrap(entity.getBoundingBox());
|
||||
BlockPosition.b blockposition_b = BlockPosition.b.d(entity.locX, bb.minY - 1.0D, entity.locZ);
|
||||
Throwable throwable = null;
|
||||
float f4;
|
||||
float f3;
|
||||
|
@ -1331,8 +1331,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, entity.getBoundingBox().b - 1.0D, entity.locZ))
|
||||
f9 = entity.world.getType(blockposition_b.e(entity.locX, bb.minY - 1.0D, entity.locZ))
|
||||
.getBlock().n() * 0.91F;
|
||||
}
|
||||
if (entity.z_()) {
|
||||
|
@ -1531,6 +1530,18 @@ public class NMSImpl implements NMSBridge {
|
|||
NMSImpl.sendPacketsNearby(from, location, Arrays.asList(packets), 64);
|
||||
}
|
||||
|
||||
public static void setNotInSchool(EntityFish entity) {
|
||||
try {
|
||||
if (ENTITY_FISH_NUM_IN_SCHOOL != null) {
|
||||
ENTITY_FISH_NUM_IN_SCHOOL.set(entity, 2);
|
||||
} else if (ENTITY_FISH_METHOD != null) {
|
||||
ENTITY_FISH_METHOD.invoke(entity, false);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void setShulkerColor(Shulker shulker, DyeColor color) {
|
||||
((EntityShulker) getHandle(shulker)).getDataWatcher().set(EntityShulker.COLOR, color.getWoolData());
|
||||
}
|
||||
|
@ -1541,9 +1552,9 @@ public class NMSImpl implements NMSBridge {
|
|||
|
||||
entity.width = f;
|
||||
entity.length = f1;
|
||||
entity.a(new AxisAlignedBB(entity.getBoundingBox().a, entity.getBoundingBox().b, entity.getBoundingBox().c,
|
||||
entity.getBoundingBox().a + entity.width, entity.getBoundingBox().b + entity.length,
|
||||
entity.getBoundingBox().c + entity.width));
|
||||
BoundingBox bb = NMSBoundingBox.wrap(entity.getBoundingBox());
|
||||
entity.a(new AxisAlignedBB(bb.minX, bb.minY, bb.minZ, bb.minX + entity.width, bb.minY + entity.length,
|
||||
bb.minZ + entity.width));
|
||||
if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
|
||||
entity.move(EnumMoveType.SELF, (f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
|
||||
}
|
||||
|
@ -1564,11 +1575,11 @@ public class NMSImpl implements NMSBridge {
|
|||
} else if (entity instanceof EntityHumanNPC) {
|
||||
((EntityHumanNPC) entity).updateAI();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static void updateNavigation(NavigationAbstract navigation) {
|
||||
navigation.d();
|
||||
};
|
||||
}
|
||||
|
||||
private static Field ADVANCEMENT_PLAYER_FIELD = NMS.getFinalField(EntityPlayer.class, "cf");
|
||||
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
||||
|
@ -1578,6 +1589,8 @@ public class NMSImpl implements NMSBridge {
|
|||
private static final float DEFAULT_SPEED = 1F;
|
||||
private static final Field ENDERDRAGON_BATTLE_BAR_FIELD = NMS.getField(EnderDragonBattle.class, "c");
|
||||
private static final Field ENDERDRAGON_BATTLE_FIELD = NMS.getField(EntityEnderDragon.class, "bR");
|
||||
private static Method ENTITY_FISH_METHOD = NMS.getMethod(EntityFish.class, "t", false, boolean.class);
|
||||
private static Field ENTITY_FISH_NUM_IN_SCHOOL;
|
||||
private static CustomEntityRegistry ENTITY_REGISTRY;
|
||||
private static final Location FROM_LOCATION = new Location(null, 0, 0, 0);
|
||||
public static Field GOAL_FIELD = NMS.getField(PathfinderGoalSelector.class, "b");
|
||||
|
@ -1592,8 +1605,14 @@ public class NMSImpl implements NMSBridge {
|
|||
private static Field SKULL_PROFILE_FIELD;
|
||||
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
||||
private static final Field WITHER_BOSS_BAR_FIELD = NMS.getField(EntityWither.class, "bL");
|
||||
|
||||
static {
|
||||
try {
|
||||
ENTITY_FISH_NUM_IN_SCHOOL = NMS.getField(Class.forName("net.minecraft.server.v1_13_R2.EntityFishSchool"),
|
||||
"b", false);
|
||||
} catch (ClassNotFoundException e) {
|
||||
// 1.13.2
|
||||
}
|
||||
|
||||
try {
|
||||
Field field = NMS.getFinalField(EntityTypes.class, "REGISTRY", false);
|
||||
if (field == null) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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.Entity;
|
||||
import net.minecraft.server.v1_13_R2.EntityLiving;
|
||||
import net.minecraft.server.v1_13_R2.MathHelper;
|
||||
|
@ -69,7 +70,8 @@ public class PlayerControllerLook {
|
|||
if ((entity instanceof EntityLiving))
|
||||
this.f = (entity.locY + entity.getHeadHeight());
|
||||
else {
|
||||
this.f = ((entity.getBoundingBox().b + entity.getBoundingBox().e) / 2.0D);
|
||||
BoundingBox bb = NMSBoundingBox.wrap(entity.getBoundingBox());
|
||||
this.f = ((bb.minY + bb.maxY) / 2.0D);
|
||||
}
|
||||
|
||||
this.g = entity.locZ;
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.citizensnpcs.nms.v1_13_R2.util;
|
|||
import java.util.Random;
|
||||
|
||||
import net.citizensnpcs.nms.v1_13_R2.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.BoundingBox;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_13_R2.AttributeInstance;
|
||||
import net.minecraft.server.v1_13_R2.ControllerMove;
|
||||
|
@ -35,7 +36,8 @@ public class PlayerControllerMove extends ControllerMove {
|
|||
this.a.bj = 0F;
|
||||
if (this.f) {
|
||||
this.f = false;
|
||||
int i = MathHelper.floor(this.a.getBoundingBox().b + 0.5D);
|
||||
BoundingBox bb = NMSBoundingBox.wrap(this.a.getBoundingBox());
|
||||
int i = MathHelper.floor(bb.minY + 0.5D);
|
||||
double d0 = this.b - this.a.locX;
|
||||
double d1 = this.d - this.a.locZ;
|
||||
double d2 = this.c - i;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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;
|
||||
|
@ -342,7 +343,8 @@ public class PlayerNavigation extends NavigationAbstract {
|
|||
protected void E_() {
|
||||
superE_();
|
||||
if (this.pp) {
|
||||
if (this.b.e(new BlockPosition(MathHelper.floor(this.a.locX), (int) (this.a.getBoundingBox().b + 0.5D),
|
||||
BoundingBox bb = NMSBoundingBox.wrap(this.a.getBoundingBox());
|
||||
if (this.b.e(new BlockPosition(MathHelper.floor(this.a.locX), (int) (bb.minY + 0.5D),
|
||||
MathHelper.floor(this.a.locZ)))) {
|
||||
return;
|
||||
}
|
||||
|
@ -500,10 +502,11 @@ public class PlayerNavigation extends NavigationAbstract {
|
|||
}
|
||||
|
||||
private int u() {
|
||||
BoundingBox bb = NMSBoundingBox.wrap(this.a.getBoundingBox());
|
||||
if ((!this.a.isInWater()) || (!t())) {
|
||||
return (int) (this.a.getBoundingBox().b + 0.5D);
|
||||
return (int) (bb.minY + 0.5D);
|
||||
}
|
||||
int i = (int) this.a.getBoundingBox().b;
|
||||
int i = (int) bb.minY;
|
||||
Block localBlock = this.b
|
||||
.getType(new BlockPosition(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ))).getBlock();
|
||||
int j = 0;
|
||||
|
@ -514,7 +517,7 @@ public class PlayerNavigation extends NavigationAbstract {
|
|||
.getBlock();
|
||||
j++;
|
||||
if (j > 16) {
|
||||
return (int) this.a.getBoundingBox().b;
|
||||
return (int) bb.minY;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Set;
|
|||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.citizensnpcs.nms.v1_13_R2.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.BoundingBox;
|
||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||
import net.minecraft.server.v1_13_R2.Entity;
|
||||
import net.minecraft.server.v1_13_R2.EntityInsentient;
|
||||
|
@ -46,8 +47,8 @@ public class PlayerPathfinder extends Pathfinder {
|
|||
|
||||
public PathEntity a(IBlockAccess paramIBlockAccess, EntityHumanNPC paramEntityInsentient, Entity paramEntity,
|
||||
float paramFloat) {
|
||||
return a(paramIBlockAccess, paramEntityInsentient, paramEntity.locX, paramEntity.getBoundingBox().b,
|
||||
paramEntity.locZ, paramFloat);
|
||||
BoundingBox bb = NMSBoundingBox.wrap(paramEntity.getBoundingBox());
|
||||
return a(paramIBlockAccess, paramEntityInsentient, paramEntity.locX, bb.minY, paramEntity.locZ, paramFloat);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,8 +74,8 @@ public class PlayerPathfinder extends Pathfinder {
|
|||
@Override
|
||||
public PathEntity a(IBlockAccess paramIBlockAccess, EntityInsentient paramEntityInsentient, Entity paramEntity,
|
||||
float paramFloat) {
|
||||
return a(paramIBlockAccess, paramEntityInsentient, paramEntity.locX, paramEntity.getBoundingBox().b,
|
||||
paramEntity.locZ, paramFloat);
|
||||
BoundingBox bb = NMSBoundingBox.wrap(paramEntity.getBoundingBox());
|
||||
return a(paramIBlockAccess, paramEntityInsentient, paramEntity.locX, bb.minY, paramEntity.locZ, paramFloat);
|
||||
}
|
||||
|
||||
private PathEntity a(PathPoint paramPathPoint1, PathPoint paramPathPoint2) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.citizensnpcs.nms.v1_13_R2.util;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -7,6 +8,8 @@ import java.util.Iterator;
|
|||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.citizensnpcs.nms.v1_13_R2.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.BoundingBox;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_13_R2.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_13_R2.Block;
|
||||
import net.minecraft.server.v1_13_R2.BlockCobbleWall;
|
||||
|
@ -388,8 +391,9 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
|||
public PathPoint b() {
|
||||
int var1;
|
||||
BlockPosition var2;
|
||||
BoundingBox bb = NMSBoundingBox.wrap(this.b.getBoundingBox());
|
||||
if (this.e() && this.b.isInWater()) {
|
||||
var1 = (int) this.b.getBoundingBox().b;
|
||||
var1 = (int) bb.minY;
|
||||
MutableBlockPosition var8 = new MutableBlockPosition(MathHelper.floor(this.b.locX), var1,
|
||||
MathHelper.floor(this.b.locZ));
|
||||
|
||||
|
@ -399,7 +403,7 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
|||
var8.c(MathHelper.floor(this.b.locX), var1, MathHelper.floor(this.b.locZ));
|
||||
}
|
||||
} else if (this.b.onGround) {
|
||||
var1 = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
|
||||
var1 = MathHelper.floor(bb.minY + 0.5D);
|
||||
} else {
|
||||
for (var2 = new BlockPosition(
|
||||
this.b); (this.a.getType(var2).isAir() || this.a.getType(var2).a(this.a, var2, PathMode.LAND))
|
||||
|
@ -414,10 +418,11 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
|||
PathType var9 = this.a(this.b, var2.getX(), var1, var2.getZ());
|
||||
if (this.b.a(var9) < 0.0F) {
|
||||
HashSet var4 = Sets.newHashSet();
|
||||
var4.add(new BlockPosition(this.b.getBoundingBox().a, var1, this.b.getBoundingBox().c));
|
||||
var4.add(new BlockPosition(this.b.getBoundingBox().a, var1, this.b.getBoundingBox().f));
|
||||
var4.add(new BlockPosition(this.b.getBoundingBox().d, var1, this.b.getBoundingBox().c));
|
||||
var4.add(new BlockPosition(this.b.getBoundingBox().d, var1, this.b.getBoundingBox().f));
|
||||
bb = NMSBoundingBox.wrap(this.b.getBoundingBox());
|
||||
var4.add(new BlockPosition(bb.minX, var1, bb.minZ));
|
||||
var4.add(new BlockPosition(bb.minX, var1, bb.maxZ));
|
||||
var4.add(new BlockPosition(bb.maxX, var1, bb.minZ));
|
||||
var4.add(new BlockPosition(bb.maxX, var1, bb.maxZ));
|
||||
Iterator var5 = var4.iterator();
|
||||
|
||||
while (var5.hasNext()) {
|
||||
|
@ -472,7 +477,21 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
|||
|
||||
public static double a(IBlockAccess var0, BlockPosition var1) {
|
||||
BlockPosition var2 = var1.down();
|
||||
VoxelShape var3 = var0.getType(var2).h(var0, var2);
|
||||
return var2.getY() + (var3.b() ? 0.0D : var3.c(EnumAxis.Y));
|
||||
try {
|
||||
VoxelShape var3 = var0.getType(var2).getCollisionShape(var0, var2);
|
||||
return var2.getY() + (var3.isEmpty() ? 0.0D : var3.c(EnumAxis.Y));
|
||||
} catch (NoSuchMethodError ex) {
|
||||
try {
|
||||
VoxelShape var3 = (VoxelShape) GET_COLLISION_SHAPE.invoke(var0.getType(var2), var0, var2);
|
||||
return var2.getY() + (((Boolean) IS_EMPTY.invoke(var3)) ? 0.0D : var3.c(EnumAxis.Y));
|
||||
} catch (Exception ex2) {
|
||||
ex2.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Method GET_COLLISION_SHAPE = NMS.getMethod(IBlockData.class, "h", false, IBlockAccess.class,
|
||||
BlockPosition.class);
|
||||
private static final Method IS_EMPTY = NMS.getMethod(VoxelShape.class, "b", false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue