*forgot to commit all

This commit is contained in:
Jesse Boyd 2017-08-04 14:22:56 +10:00
parent fd83406e29
commit 3d2f939377
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 20 additions and 1 deletions

View File

@ -97,6 +97,7 @@ public class BukkitQueue_1_12 extends BukkitQueue_0<net.minecraft.server.v1_12_R
protected static Field fieldPalette; protected static Field fieldPalette;
protected static Field fieldSize; protected static Field fieldSize;
protected static Method getEntitySlices; protected static Method getEntitySlices;
protected static Method methodTileEntityLoad;
protected static Field fieldTickingBlockCount; protected static Field fieldTickingBlockCount;
protected static Field fieldNonEmptyBlockCount; protected static Field fieldNonEmptyBlockCount;
protected static Field fieldSection; protected static Field fieldSection;
@ -150,6 +151,11 @@ public class BukkitQueue_1_12 extends BukkitQueue_0<net.minecraft.server.v1_12_R
fieldSize = DataPaletteBlock.class.getDeclaredField("e"); fieldSize = DataPaletteBlock.class.getDeclaredField("e");
fieldSize.setAccessible(true); fieldSize.setAccessible(true);
try {
methodTileEntityLoad = TileEntity.class.getDeclaredMethod("a", NBTTagCompound.class);
methodTileEntityLoad.setAccessible(true);
} catch (Throwable ignore) {}
Field fieldAir = DataPaletteBlock.class.getDeclaredField("a"); Field fieldAir = DataPaletteBlock.class.getDeclaredField("a");
fieldAir.setAccessible(true); fieldAir.setAccessible(true);
air = (IBlockData) fieldAir.get(null); air = (IBlockData) fieldAir.get(null);

View File

@ -64,6 +64,7 @@ public final class FaweAdapter_1_12 implements BukkitImplAdapter
private final Logger logger = Logger.getLogger(getClass().getCanonicalName()); private final Logger logger = Logger.getLogger(getClass().getCanonicalName());
private final Field nbtListTagListField; private final Field nbtListTagListField;
private final Method nbtCreateTagMethod; private final Method nbtCreateTagMethod;
protected static Method methodTileEntityLoad;
public FaweAdapter_1_12() throws NoSuchFieldException, NoSuchMethodException { public FaweAdapter_1_12() throws NoSuchFieldException, NoSuchMethodException {
this.nbtListTagListField = NBTTagList.class.getDeclaredField("list"); this.nbtListTagListField = NBTTagList.class.getDeclaredField("list");
@ -71,11 +72,23 @@ public final class FaweAdapter_1_12 implements BukkitImplAdapter
this.nbtCreateTagMethod = NBTBase.class.getDeclaredMethod("createTag", new Class[] { Byte.TYPE }); this.nbtCreateTagMethod = NBTBase.class.getDeclaredMethod("createTag", new Class[] { Byte.TYPE });
this.nbtCreateTagMethod.setAccessible(true); this.nbtCreateTagMethod.setAccessible(true);
try {
methodTileEntityLoad = TileEntity.class.getDeclaredMethod("a", NBTTagCompound.class);
methodTileEntityLoad.setAccessible(true);
} catch (Throwable ignore) {}
} }
private static void readTagIntoTileEntity(NBTTagCompound tag, TileEntity tileEntity) private static void readTagIntoTileEntity(NBTTagCompound tag, TileEntity tileEntity)
{ {
tileEntity.a(tag); if (methodTileEntityLoad != null) {
try {
methodTileEntityLoad.invoke(tileEntity, tag); // ReadTagIntoTile
} catch (Throwable e) {
e.printStackTrace();
}
} else {
tileEntity.load(tag);
}
} }
private static void readTileEntityIntoTag(TileEntity tileEntity, NBTTagCompound tag) private static void readTileEntityIntoTag(TileEntity tileEntity, NBTTagCompound tag)