|
31 | 31 | import gripe._90.megacells.item.cell.BulkCellInventory;
|
32 | 32 |
|
33 | 33 | public class DecompressionService implements IGridService, IGridServiceProvider {
|
34 |
| - private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); |
35 |
| - private static final Class<?> CHEST_MONITOR_CLASS; |
36 | 34 | private static final VarHandle CHEST_MONITOR_HANDLE;
|
37 | 35 | private static final VarHandle CHEST_CELL_HANDLE;
|
38 | 36 | private static final MethodHandle DRIVE_DELEGATE_HANDLE;
|
39 | 37 | private static final VarHandle DRIVE_WATCHERS_HANDLE;
|
40 | 38 |
|
41 | 39 | static {
|
42 | 40 | try {
|
43 |
| - CHEST_MONITOR_CLASS = Class.forName("appeng.blockentity.storage.ChestBlockEntity$ChestMonitorHandler"); |
44 |
| - CHEST_MONITOR_HANDLE = MethodHandles.privateLookupIn(ChestBlockEntity.class, LOOKUP) |
45 |
| - .findVarHandle(ChestBlockEntity.class, "cellHandler", CHEST_MONITOR_CLASS); |
46 |
| - CHEST_CELL_HANDLE = MethodHandles.privateLookupIn(CHEST_MONITOR_CLASS, LOOKUP) |
47 |
| - .findVarHandle(CHEST_MONITOR_CLASS, "cellInventory", StorageCell.class); |
| 41 | + var lookup = MethodHandles.lookup(); |
48 | 42 |
|
49 |
| - DRIVE_WATCHERS_HANDLE = MethodHandles.privateLookupIn(DriveBlockEntity.class, LOOKUP) |
| 43 | + var chestMonitor = Class.forName("appeng.blockentity.storage.ChestBlockEntity$ChestMonitorHandler"); |
| 44 | + CHEST_MONITOR_HANDLE = MethodHandles.privateLookupIn(ChestBlockEntity.class, lookup) |
| 45 | + .findVarHandle(ChestBlockEntity.class, "cellHandler", chestMonitor); |
| 46 | + CHEST_CELL_HANDLE = MethodHandles.privateLookupIn(chestMonitor, lookup) |
| 47 | + .findVarHandle(chestMonitor, "cellInventory", StorageCell.class); |
| 48 | + |
| 49 | + DRIVE_WATCHERS_HANDLE = MethodHandles.privateLookupIn(DriveBlockEntity.class, lookup) |
50 | 50 | .findVarHandle(DriveBlockEntity.class, "invBySlot", DriveWatcher[].class);
|
51 |
| - DRIVE_DELEGATE_HANDLE = MethodHandles.privateLookupIn(DelegatingMEInventory.class, LOOKUP) |
| 51 | + DRIVE_DELEGATE_HANDLE = MethodHandles.privateLookupIn(DelegatingMEInventory.class, lookup) |
52 | 52 | .findVirtual(DelegatingMEInventory.class, "getDelegate", MethodType.methodType(MEStorage.class));
|
53 | 53 | } catch (NoSuchFieldException | NoSuchMethodException | ClassNotFoundException | IllegalAccessException e) {
|
54 | 54 | throw new RuntimeException("Failed to create DecompressionService method handles", e);
|
|
0 commit comments