mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-10-31 16:00:52 +01:00
ChunkPosition was replaced by BlockPosition
This commit is contained in:
parent
d5a63e8e38
commit
1f6b873f84
@ -40,8 +40,7 @@ public class BukkitCloner implements Cloner {
|
|||||||
List<Class<?>> classes = Lists.newArrayList();
|
List<Class<?>> classes = Lists.newArrayList();
|
||||||
|
|
||||||
classes.add(MinecraftReflection.getItemStackClass());
|
classes.add(MinecraftReflection.getItemStackClass());
|
||||||
// TODO: Chunk position does not exist
|
classes.add(MinecraftReflection.getBlockPositionClass());
|
||||||
// classes.add(MinecraftReflection.getChunkPositionClass());
|
|
||||||
classes.add(MinecraftReflection.getDataWatcherClass());
|
classes.add(MinecraftReflection.getDataWatcherClass());
|
||||||
|
|
||||||
if (MinecraftReflection.isUsingNetty()) {
|
if (MinecraftReflection.isUsingNetty()) {
|
||||||
|
@ -418,12 +418,23 @@ public class MinecraftReflection {
|
|||||||
/**
|
/**
|
||||||
* Determine if a given object is a ChunkPosition.
|
* Determine if a given object is a ChunkPosition.
|
||||||
* @param obj - the object to test.
|
* @param obj - the object to test.
|
||||||
|
* @deprecated ChunkPosition no longer exists
|
||||||
* @return TRUE if it can, FALSE otherwise.
|
* @return TRUE if it can, FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static boolean isChunkPosition(Object obj) {
|
public static boolean isChunkPosition(Object obj) {
|
||||||
return obj != null && getChunkPositionClass().isAssignableFrom(obj.getClass());
|
return obj != null && getChunkPositionClass().isAssignableFrom(obj.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a given object is a BlockPosition.
|
||||||
|
* @param obj - the object to test.
|
||||||
|
* @return TRUE if it can, FALSE otherwise.
|
||||||
|
*/
|
||||||
|
public static boolean isBlockPosition(Object obj) {
|
||||||
|
return obj != null && getBlockPositionClass().isAssignableFrom(obj.getClass());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the given object is an NMS ChunkCoordIntPar.
|
* Determine if the given object is an NMS ChunkCoordIntPar.
|
||||||
* @param obj - the object.
|
* @param obj - the object.
|
||||||
@ -1167,26 +1178,53 @@ public class MinecraftReflection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the ChunkPosition class.
|
* Retrieves the ChunkPosition class.
|
||||||
|
*
|
||||||
|
* @deprecated ChunkPosition no longer exists. Replaced by BlockPosition.
|
||||||
* @return The ChunkPosition class.
|
* @return The ChunkPosition class.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static Class<?> getChunkPositionClass() {
|
public static Class<?> getChunkPositionClass() {
|
||||||
try {
|
try {
|
||||||
return getMinecraftClass("ChunkPosition");
|
return getMinecraftClass("ChunkPosition");
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
return getBlockPositionClass();
|
||||||
|
// Class<?> normalChunkGenerator = getCraftBukkitClass("generator.NormalChunkGenerator");
|
||||||
|
//
|
||||||
|
// // ChunkPosition a(net.minecraft.server.World world, String string, int i, int i1, int i2) {
|
||||||
|
// FuzzyMethodContract selected = FuzzyMethodContract.newBuilder()
|
||||||
|
// .banModifier(Modifier.STATIC)
|
||||||
|
// .parameterMatches(getMinecraftObjectMatcher(), 0)
|
||||||
|
// .parameterExactType(String.class, 1)
|
||||||
|
// .parameterExactType(int.class, 2)
|
||||||
|
// .parameterExactType(int.class, 3)
|
||||||
|
// .parameterExactType(int.class, 4)
|
||||||
|
// .build();
|
||||||
|
//
|
||||||
|
// return setMinecraftClass("ChunkPosition",
|
||||||
|
// FuzzyReflection.fromClass(normalChunkGenerator).getMethod(selected).getReturnType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the BlockPosition class.
|
||||||
|
* @return The BlockPosition class.
|
||||||
|
*/
|
||||||
|
public static Class<?> getBlockPositionClass() {
|
||||||
|
try {
|
||||||
|
return getMinecraftClass("BlockPosition");
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Class<?> normalChunkGenerator = getCraftBukkitClass("generator.NormalChunkGenerator");
|
Class<?> normalChunkGenerator = getCraftBukkitClass("generator.NormalChunkGenerator");
|
||||||
|
|
||||||
// ChunkPosition a(net.minecraft.server.World world, String string, int i, int i1, int i2) {
|
// BlockPosition findNearestMapFeature(World, String, BlockPosition)
|
||||||
FuzzyMethodContract selected = FuzzyMethodContract.newBuilder()
|
FuzzyMethodContract selected = FuzzyMethodContract.newBuilder()
|
||||||
.banModifier(Modifier.STATIC)
|
.banModifier(Modifier.STATIC)
|
||||||
.parameterMatches(getMinecraftObjectMatcher(), 0)
|
.parameterMatches(getMinecraftObjectMatcher(), 0)
|
||||||
.parameterExactType(String.class, 1)
|
.parameterExactType(String.class, 1)
|
||||||
.parameterExactType(int.class, 2)
|
.parameterMatches(getMinecraftObjectMatcher(), 1)
|
||||||
.parameterExactType(int.class, 3)
|
|
||||||
.parameterExactType(int.class, 4)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
return setMinecraftClass("ChunkPosition",
|
return setMinecraftClass("BlockPosition",
|
||||||
FuzzyReflection.fromClass(normalChunkGenerator).getMethod(selected).getReturnType());
|
FuzzyReflection.fromClass(normalChunkGenerator).getMethod(selected).getReturnType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user