use of com.volmit.iris.util.nbt.mca.palette.MCAWrappedPalettedContainer in project Iris by VolmitSoftware.
the class NMSBinding18_1 method createPalette.
@Override
public MCAPaletteAccess createPalette() {
MCAIdMapper<BlockState> registry = registryCache.aquireNasty(() -> {
Field cf = net.minecraft.core.IdMapper.class.getDeclaredField("tToId");
Field df = net.minecraft.core.IdMapper.class.getDeclaredField("idToT");
Field bf = net.minecraft.core.IdMapper.class.getDeclaredField("nextId");
cf.setAccessible(true);
df.setAccessible(true);
bf.setAccessible(true);
net.minecraft.core.IdMapper<BlockState> blockData = Block.BLOCK_STATE_REGISTRY;
int b = bf.getInt(blockData);
Object2IntMap<BlockState> c = (Object2IntMap<BlockState>) cf.get(blockData);
List<BlockState> d = (List<BlockState>) df.get(blockData);
return new MCAIdMapper<BlockState>(c, d, b);
});
MCAPalette<BlockState> global = globalCache.aquireNasty(() -> new MCAGlobalPalette<>(registry, ((CraftBlockData) AIR).getState()));
MCAPalettedContainer<BlockState> container = new MCAPalettedContainer<>(global, registry, i -> ((CraftBlockData) NBTWorld.getBlockData(i)).getState(), i -> NBTWorld.getCompound(CraftBlockData.fromData(i)), ((CraftBlockData) AIR).getState());
return new MCAWrappedPalettedContainer<>(container, i -> NBTWorld.getCompound(CraftBlockData.fromData(i)), i -> ((CraftBlockData) NBTWorld.getBlockData(i)).getState());
}
Aggregations