void set(FMLControlledNamespacedRegistry<I> registry) { if (this.superType != registry.superType) throw new IllegalArgumentException("incompatible registry"); this.discriminator = registry.discriminator; this.optionalDefaultName = registry.optionalDefaultName; this.maxId = registry.maxId; this.minId = registry.minId; this.aliases.clear(); this.aliases.putAll(registry.aliases); this.activeSubstitutions.clear(); field_148759_a = new ObjectIntIdentityMap(); field_82596_a.clear(); for (I thing : registry.typeSafeIterable()) { addObjectRaw(registry.getId(thing), registry.func_148750_c(thing), thing); } this.activeSubstitutions.putAll(registry.activeSubstitutions); }
void set(FMLControlledNamespacedRegistry<I> registry) { if (this.superType != registry.superType) throw new IllegalArgumentException("incompatible registry"); this.discriminator = registry.discriminator; this.optionalDefaultName = registry.optionalDefaultName; this.maxId = registry.maxId; this.minId = registry.minId; this.aliases.clear(); this.aliases.putAll(registry.aliases); underlyingIntegerMap = new ObjectIntIdentityMap(); registryObjects.clear(); for (I thing : registry.typeSafeIterable()) { addObjectRaw(registry.getId(thing), registry.getNameForObject(thing), thing); } }
@SuppressWarnings({ "rawtypes", "unchecked" }) private static void overwrite_do(RegistryNamespaced registry, String name, Object object, Object oldThing) { int id = registry.getIDForObject(oldThing); BiMap map = (BiMap) ReflectionHelper.getField(registry, "registryObjects"); ObjectIntIdentityMap underlyingIntegerMap = (ObjectIntIdentityMap) ReflectionHelper .getField(registry, "underlyingIntegerMap"); underlyingIntegerMap.func_148746_a(object, id); map.remove(name); map.forcePut(name, object); }
private void loadChunk(int id, Shader shader, ExtendedBlockStorage storage) { ObjectIntIdentityMap<IBlockState> map = GameData.getBlockStateIDMap(); int[] data = new int[chunkSize*2]; for (int y = 0; y < 16; y++) { for (int z = 0; z < 16; z++) { for (int x = 0; x < 16; x++) { IBlockState state = storage.get(x, y, z); boolean fullBlock = state.isFullBlock(); boolean cube = state.isFullCube(); if (fullBlock != cube) { Log.info(state.getBlock().getUnlocalizedName() + ": " + fullBlock); } if (fullBlock) { stateSet.add(state); } int stateId = map.get(state); //TODO data[(y<<9) + (z<<5) + (x<<1)] = Block.getIdFromBlock(storage.get(x, y, z).getBlock()); } } } for (int y = 0; y < 16; y++) { for (int z = 0; z < 16; z++) { for (int x = 0; x < 16; x++) { data[(y<<9) + (z<<5) + (x<<1) + 1] = storage.getBlocklightArray().get(x, y, z); } } } IntBuffer buffer = BufferUtils.createIntBuffer(chunkSize*2); buffer.put(data); buffer.flip(); GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getChunkSsbo()); GL15.glBufferSubData(GL43.GL_SHADER_STORAGE_BUFFER, (id-1)*chunkSize*2*4, buffer); GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0); }
public static void replaceItem(int id, Item item) { try { String name = Item.itemRegistry.getNameForObject(Item.getItemById(id)); ((Map)f_registryObjects.get(Item.itemRegistry)).put(name, item); ((ObjectIntIdentityMap)f_underlyingIntegerMap.get(Item.itemRegistry)).func_148746_a(item, id); } catch (Exception e) { throw new RuntimeException(e); } }
private BasicPalette() { this.ids = new ObjectIntIdentityMap<IBlockState>(16); }
private BasicPalette() { this.ids = new ObjectIntIdentityMap(16); }
@SuppressWarnings("unchecked") public static ObjectIntIdentityMap<IBlockState> getBlockStateIDMap() { return (ObjectIntIdentityMap<IBlockState>)getMain().iBlockRegistry.getSlaveMap(BLOCKSTATE_TO_ID, ObjectIntIdentityMap.class); }