mirror of
https://github.com/funkemunky/KauriV3.git
synced 2026-06-30 09:48:27 +00:00
Fixing chunk issues
This commit is contained in:
@@ -2,6 +2,7 @@ package dev.brighten.ac.utils.reflections.impl;
|
||||
|
||||
import dev.brighten.ac.utils.reflections.Reflections;
|
||||
import dev.brighten.ac.utils.reflections.types.WrappedClass;
|
||||
import dev.brighten.ac.utils.reflections.types.WrappedConstructor;
|
||||
import dev.brighten.ac.utils.reflections.types.WrappedMethod;
|
||||
import dev.brighten.ac.packet.ProtocolVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -42,6 +43,9 @@ public class CraftReflection {
|
||||
private static final WrappedMethod methodGetBlockFromMaterial = ProtocolVersion.getGameVersion()
|
||||
.isOrAbove(ProtocolVersion.V1_13) ? craftMagicNumbers.getMethod("getBlock", Material.class)
|
||||
: craftMagicNumbers.getMethod("getBlock", int.class);
|
||||
|
||||
private static final WrappedConstructor getBlockFromChunk = craftBlock
|
||||
.getConstructor(craftChunk.getParent(), int.class, int.class, int.class);
|
||||
private static WrappedMethod fromComponent;
|
||||
|
||||
public static <T> T getVanillaItemStack(ItemStack stack) {
|
||||
@@ -97,6 +101,10 @@ public class CraftReflection {
|
||||
return fromComponent.invoke(null, ichatcomp);
|
||||
}
|
||||
|
||||
public static Block getBlockFromChunk(Chunk chunk, int x, int y, int z) {
|
||||
return getBlockFromChunk.newInstance(chunk, x, y, z);
|
||||
}
|
||||
|
||||
static {
|
||||
if(ProtocolVersion.getGameVersion().isOrAbove(ProtocolVersion.V1_8)) {
|
||||
fromComponent = craftChatMessage.getMethod("fromComponent",
|
||||
|
||||
Reference in New Issue
Block a user