Server starts

This commit is contained in:
cpw authored and LexManos committed 2018-09-05 13:13:53 -07:00
1 parent 330db1a54d
commit b50b768852
44 files changed
+449 -475

No files matched your search

@@ -0,0 +1,32 @@
package net.minecraftforge.fml;
import sun.misc.Unsafe;
import java.lang.reflect.Field;
public class UnsafeHacks
{
private static final Unsafe UNSAFE;
static {
try
{
final Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
theUnsafe.setAccessible(true);
UNSAFE = (Unsafe)theUnsafe.get(null);
}
catch (IllegalAccessException | NoSuchFieldException e)
{
throw new RuntimeException("BARF!", e);
}
}
@SuppressWarnings("unchecked")
public static <T> T getField(Field field, Object object) {
final long l = UNSAFE.objectFieldOffset(field);
return (T) UNSAFE.getObject(object, l);
}
public static <T> T getField(Object object) {
UNSAFE.staticFieldBase()
}
}