mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-08 19:51:05 +00:00
Add #setAccessible call to access to private fields
This commit is contained in:
parent
5efdb35c15
commit
b256015c29
@ -29,10 +29,13 @@ public class FakeArmorStandImpl extends FakeEntityImpl<String> implements FakeAr
|
||||
static {
|
||||
try {
|
||||
final Field dataSharedFlagsId = Entity.class.getDeclaredField("Z"); // DATA_SHARED_FLAGS_ID
|
||||
dataSharedFlagsId.setAccessible(true);
|
||||
DATA_SHARED_FLAGS_ID = FakeEntityImpl.forceCast(dataSharedFlagsId.get(null));
|
||||
final Field dataCustomNameField = Entity.class.getDeclaredField("aJ"); // DATA_CUSTOM_NAME
|
||||
dataCustomNameField.setAccessible(true);
|
||||
DATA_CUSTOM_NAME = FakeEntityImpl.forceCast(dataCustomNameField.get(null));
|
||||
final Field dataCustomNameVisibleField = Entity.class.getDeclaredField("aK"); // DATA_CUSTOM_NAME_VISIBLE
|
||||
dataCustomNameVisibleField.setAccessible(true);
|
||||
DATA_CUSTOM_NAME_VISIBLE = FakeEntityImpl.forceCast(dataCustomNameVisibleField.get(null));
|
||||
} catch (ReflectiveOperationException e){
|
||||
throw new RuntimeException(e);
|
||||
|
@ -30,12 +30,16 @@ public abstract class FakeEntityImpl<T> implements FakeEntity {
|
||||
static {
|
||||
try {
|
||||
final Field entityCounterField = Entity.class.getDeclaredField("b"); // ENTITY_COUNTER
|
||||
entityCounterField.setAccessible(true);
|
||||
ENTITY_COUNTER = (AtomicInteger) entityCounterField.get(null);
|
||||
final Field dataNoGravityField = Entity.class.getDeclaredField("aM"); // DATA_NO_GRAVITY
|
||||
dataNoGravityField.setAccessible(true);
|
||||
DATA_NO_GRAVITY = forceCast(dataNoGravityField.get(null));
|
||||
final Field dataSilentField = Entity.class.getDeclaredField("aL"); // DATA_SILENT
|
||||
dataSilentField.setAccessible(true);
|
||||
DATA_SILENT = forceCast(dataSilentField.get(null));
|
||||
packedItemField = ClientboundSetEntityDataPacket.class.getDeclaredField("b"); // packedItems
|
||||
packedItemField.setAccessible(true);
|
||||
}catch (ReflectiveOperationException e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user