/** * Returns one of DiamondLeggings sub-type based on sub-id. * * @param id sub-type id * @return sub-type of DiamondLeggings. */ public static DiamondLeggingsMat getByID(final int id) { DiamondLeggingsMat mat = byID.get((short) id); if (mat == null) { mat = new DiamondLeggingsMat(id); if ((id > 0) && (id < DIAMOND_LEGGINGS.getBaseDurability())) { DiamondLeggingsMat.register(mat); } } return mat; }
/** * Returns one of IronChestplate sub-type based on sub-id. * * @param id sub-type id * @return sub-type of IronChestplate. */ public static IronChestplateMat getByID(final int id) { IronChestplateMat mat = byID.get((short) id); if (mat == null) { mat = new IronChestplateMat(id); if ((id > 0) && (id < IRON_CHESTPLATE.getBaseDurability())) { IronChestplateMat.register(mat); } } return mat; }
/** * Returns one of StoneAxe sub-type based on sub-id. * * @param id sub-type id * @return sub-type of StoneAxe. */ public static StoneAxeMat getByID(final int id) { StoneAxeMat mat = byID.get((short) id); if (mat == null) { mat = new StoneAxeMat(id); if ((id > 0) && (id < STONE_AXE.getBaseDurability())) { StoneAxeMat.register(mat); } } return mat; }
private TShortObjectMap<TIntList> createBatchBlockEventMappings(Chunk chunk) { TShortObjectMap<TIntList> batchBlockMap = new TShortObjectHashMap<>(); for (Block block : blockManager.listRegisteredBlocks()) { if (block.isLifecycleEventsRequired()) { batchBlockMap.put(block.getId(), new TIntArrayList()); } } ChunkBlockIterator i = chunk.getBlockIterator(); while (i.next()) { if (i.getBlock().isLifecycleEventsRequired()) { TIntList positionList = batchBlockMap.get(i.getBlock().getId()); positionList.add(i.getBlockPos().x); positionList.add(i.getBlockPos().y); positionList.add(i.getBlockPos().z); } } return batchBlockMap; }
private void deactivateBlocks() { List<TShortObjectMap<TIntList>> deactivatedBlockSets = Lists.newArrayListWithExpectedSize(deactivateBlocksQueue.size()); deactivateBlocksQueue.drainTo(deactivatedBlockSets); for (TShortObjectMap<TIntList> deactivatedBlockSet : deactivatedBlockSets) { deactivatedBlockSet.forEachEntry( new TShortObjectProcedure<TIntList>() { @Override public boolean execute(short id, TIntList positions) { if (positions.size() > 0) { blockManager .getBlock(id) .getEntity() .send(new BeforeDeactivateBlocks(positions, registry)); } return true; } }); } }
/** @return array that contains all sub-types of this block. */ public static BowlMat[] bowlTypes() { return byID.values(new BowlMat[byID.size()]); }
/** * Register new sub-type, may replace existing sub-types. Should be used only if you know what are * you doing, it will not create fully usable material. * * @param element sub-type to register */ public static void register(final BowlMat element) { byID.put(element.getType(), element); byName.put(element.getTypeName(), element); }
/** * Returns one of Bowl sub-type based on sub-id, may return null * * @param id sub-type id * @return sub-type of Bowl or null */ public static BowlMat getByID(final int id) { return byID.get((short) id); }
/** * Register new sub-type, may replace existing sub-types. Should be used only if you know what are * you doing, it will not create fully usable material. * * @param element sub-type to register */ public static void register(final DiamondLeggingsMat element) { byID.put(element.getType(), element); byName.put(element.getTypeName(), element); }
/** * Register new sub-type, may replace existing sub-types. Should be used only if you know what are * you doing, it will not create fully usable material. * * @param element sub-type to register */ public static void register(final IronChestplateMat element) { byID.put(element.getType(), element); byName.put(element.getTypeName(), element); }
/** @return array that contains all sub-types of this block. */ public static BakedPotatoMat[] bakedPotatoTypes() { return byID.values(new BakedPotatoMat[byID.size()]); }
/** * Returns one of BakedPotato sub-type based on sub-id, may return null * * @param id sub-type id * @return sub-type of BakedPotato or null */ public static BakedPotatoMat getByID(final int id) { return byID.get((short) id); }