mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-03 06:57:41 +01:00
Fix impossible cast in old versions of minecraft
This commit is contained in:
parent
310ebb1458
commit
bce7baced9
@ -1145,7 +1145,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||||
getHandle(entity).yaw = yaw;
|
getHandle(entity).yaw = yaw;
|
||||||
if (entity instanceof EntityLiving) {
|
if (getHandle(entity) instanceof EntityLiving) {
|
||||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||||
handle.aP = yaw;
|
handle.aP = yaw;
|
||||||
if (!(handle instanceof EntityHuman)) {
|
if (!(handle instanceof EntityHuman)) {
|
||||||
|
@ -1198,7 +1198,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||||
getHandle(entity).yaw = yaw;
|
getHandle(entity).yaw = yaw;
|
||||||
if (entity instanceof EntityLiving) {
|
if (getHandle(entity) instanceof EntityLiving) {
|
||||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||||
handle.aO = yaw;
|
handle.aO = yaw;
|
||||||
if (!(handle instanceof EntityHuman)) {
|
if (!(handle instanceof EntityHuman)) {
|
||||||
|
@ -1206,7 +1206,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||||
getHandle(entity).yaw = yaw;
|
getHandle(entity).yaw = yaw;
|
||||||
if (entity instanceof EntityLiving) {
|
if (getHandle(entity) instanceof EntityLiving) {
|
||||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||||
handle.aO = yaw;
|
handle.aO = yaw;
|
||||||
if (!(handle instanceof EntityHuman)) {
|
if (!(handle instanceof EntityHuman)) {
|
||||||
|
@ -1242,7 +1242,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||||
getHandle(entity).yaw = yaw;
|
getHandle(entity).yaw = yaw;
|
||||||
if (entity instanceof EntityLiving) {
|
if (getHandle(entity) instanceof EntityLiving) {
|
||||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||||
handle.aR = yaw;
|
handle.aR = yaw;
|
||||||
if (!(handle instanceof EntityHuman)) {
|
if (!(handle instanceof EntityHuman)) {
|
||||||
|
@ -1278,7 +1278,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||||
getHandle(entity).yaw = yaw;
|
getHandle(entity).yaw = yaw;
|
||||||
if (entity instanceof EntityLiving) {
|
if (getHandle(entity) instanceof EntityLiving) {
|
||||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||||
handle.aL = yaw;
|
handle.aL = yaw;
|
||||||
if (!(handle instanceof EntityHuman)) {
|
if (!(handle instanceof EntityHuman)) {
|
||||||
|
@ -1295,7 +1295,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||||
getHandle(entity).yaw = yaw;
|
getHandle(entity).yaw = yaw;
|
||||||
if (entity instanceof EntityLiving) {
|
if (getHandle(entity) instanceof EntityLiving) {
|
||||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||||
handle.aJ = yaw;
|
handle.aJ = yaw;
|
||||||
if (!(handle instanceof EntityHuman)) {
|
if (!(handle instanceof EntityHuman)) {
|
||||||
|
@ -1332,9 +1332,11 @@ public class NMSImpl implements NMSBridge {
|
|||||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
handle.yaw = yaw;
|
handle.yaw = yaw;
|
||||||
if (handle instanceof EntityLiving) {
|
if (getHandle(entity) instanceof EntityLiving) {
|
||||||
((EntityLiving) handle).aB = yaw;
|
((EntityLiving) handle).aB = yaw;
|
||||||
((EntityLiving) handle).aA = yaw; // TODO: why this
|
if (!(handle instanceof EntityHuman)) {
|
||||||
|
((EntityLiving) handle).aA = yaw; // TODO: why this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
MobAI ai = MobAI.from(getHandle(entity));
|
MobAI ai = MobAI.from(getHandle(entity));
|
||||||
if (ai == null)
|
if (ai == null)
|
||||||
return;
|
return;
|
||||||
MoveControl control = ai != null ? ai.getMoveControl() : null;
|
MoveControl control = ai.getMoveControl();
|
||||||
if (control instanceof EntityMoveControl) {
|
if (control instanceof EntityMoveControl) {
|
||||||
((EntityMoveControl) control).moving = false;
|
((EntityMoveControl) control).moving = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1063,12 +1063,13 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||||
getHandle(entity).yaw = yaw;
|
Entity handle = getHandle(entity);
|
||||||
if (entity instanceof EntityLiving) {
|
handle.yaw = yaw;
|
||||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
if (handle instanceof EntityLiving) {
|
||||||
handle.aJ = yaw;
|
EntityLiving living = (EntityLiving) handle;
|
||||||
|
living.aJ = yaw;
|
||||||
if (!(handle instanceof EntityHuman)) {
|
if (!(handle instanceof EntityHuman)) {
|
||||||
handle.aI = yaw; // TODO: why this
|
living.aI = yaw; // TODO: why this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1759,30 +1760,30 @@ public class NMSImpl implements NMSBridge {
|
|||||||
EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME, EntityType.MAGMA_CUBE, EntityType.HORSE,
|
EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME, EntityType.MAGMA_CUBE, EntityType.HORSE,
|
||||||
EntityType.GHAST);
|
EntityType.GHAST);
|
||||||
private static final float DEFAULT_SPEED = 1F;
|
private static final float DEFAULT_SPEED = 1F;
|
||||||
public static MethodHandle ENDERDRAGON_CHECK_WALLS = NMS.getFirstMethodHandleWithReturnType(EntityEnderDragon.class,
|
public static final MethodHandle ENDERDRAGON_CHECK_WALLS = NMS
|
||||||
true, boolean.class, AxisAlignedBB.class);
|
.getFirstMethodHandleWithReturnType(EntityEnderDragon.class, true, boolean.class, AxisAlignedBB.class);
|
||||||
private static Method ENTITY_ATTACK_A = NMS.getMethod(Entity.class, "a", true, EntityLiving.class, Entity.class);
|
private static final Method ENTITY_ATTACK_A = NMS.getMethod(Entity.class, "a", true, EntityLiving.class,
|
||||||
|
Entity.class);
|
||||||
private static Map<Class<?>, Integer> ENTITY_CLASS_TO_INT;
|
private static Map<Class<?>, Integer> ENTITY_CLASS_TO_INT;
|
||||||
private static Map<Class<?>, String> ENTITY_CLASS_TO_NAME;
|
private static Map<Class<?>, String> ENTITY_CLASS_TO_NAME;
|
||||||
private static MethodHandle ENTITY_NAVIGATION = NMS.getFirstSetter(EntityInsentient.class, Navigation.class);
|
private static final MethodHandle ENTITY_NAVIGATION = NMS.getFirstSetter(EntityInsentient.class, Navigation.class);
|
||||||
private static final Location FROM_LOCATION = new Location(null, 0, 0, 0);
|
private static final Location FROM_LOCATION = new Location(null, 0, 0, 0);
|
||||||
private static Method GET_NMS_BLOCK = NMS.getMethod(CraftBlock.class, "getNMSBlock", false);
|
private static final Method GET_NMS_BLOCK = NMS.getMethod(CraftBlock.class, "getNMSBlock", false);
|
||||||
private static Field GOAL_FIELD = NMS.getField(PathfinderGoalSelector.class, "b");
|
private static final Field GOAL_FIELD = NMS.getField(PathfinderGoalSelector.class, "b");
|
||||||
private static final Field JUMP_FIELD = NMS.getField(EntityLiving.class, "aY");
|
private static final Field JUMP_FIELD = NMS.getField(EntityLiving.class, "aY");
|
||||||
private static final MethodHandle LOOK_CONTROL_SETTER = NMS.getFirstSetter(EntityInsentient.class,
|
private static final MethodHandle LOOK_CONTROL_SETTER = NMS.getFirstSetter(EntityInsentient.class,
|
||||||
ControllerLook.class);
|
ControllerLook.class);
|
||||||
private static Method MAKE_REQUEST;
|
private static Method MAKE_REQUEST;
|
||||||
private static Field MOVE_CONTROLLER_MOVING = NMS.getField(ControllerMove.class, "f");
|
private static final Field MOVE_CONTROLLER_MOVING = NMS.getField(ControllerMove.class, "f");
|
||||||
private static Field NAVIGATION_WORLD_FIELD = NMS.getField(NavigationAbstract.class, "c");
|
private static final Field NAVIGATION_WORLD_FIELD = NMS.getField(NavigationAbstract.class, "c");
|
||||||
private static Field NETWORK_ADDRESS = NMS.getField(NetworkManager.class, "l");
|
private static final Field NETWORK_ADDRESS = NMS.getField(NetworkManager.class, "l");
|
||||||
private static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
|
private static final Field PATHFINDING_RANGE = NMS.getField(NavigationAbstract.class, "a");
|
||||||
private static Field PATHFINDING_RANGE = NMS.getField(NavigationAbstract.class, "a");
|
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
private static final MethodHandle REPAIR_INVENTORY = NMS.getGetter(ContainerAnvil.class, "h");
|
private static final MethodHandle REPAIR_INVENTORY = NMS.getGetter(ContainerAnvil.class, "h");
|
||||||
private static final MethodHandle RESULT_INVENTORY = NMS.getGetter(ContainerAnvil.class, "g");
|
private static final MethodHandle RESULT_INVENTORY = NMS.getGetter(ContainerAnvil.class, "g");
|
||||||
private static Field SKULL_PROFILE_FIELD;
|
private static Field SKULL_PROFILE_FIELD;
|
||||||
private static Field TEAM_FIELD;
|
private static Field TEAM_FIELD;
|
||||||
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
private static final Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
Field field = NMS.getField(EntityTypes.class, "f");
|
Field field = NMS.getField(EntityTypes.class, "f");
|
||||||
|
Loading…
Reference in New Issue
Block a user