예제 #1
0
 /**
  * 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;
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
 /**
  * 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;
 }
예제 #4
0
  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;
  }
예제 #5
0
 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;
           }
         });
   }
 }
예제 #6
0
파일: BowlMat.java 프로젝트: sgdc3/Diorite
 /** @return array that contains all sub-types of this block. */
 public static BowlMat[] bowlTypes() {
   return byID.values(new BowlMat[byID.size()]);
 }
예제 #7
0
파일: BowlMat.java 프로젝트: sgdc3/Diorite
 /**
  * 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);
 }
예제 #8
0
파일: BowlMat.java 프로젝트: sgdc3/Diorite
 /**
  * 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);
 }
예제 #9
0
 /**
  * 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);
 }
예제 #10
0
 /**
  * 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);
 }
예제 #11
0
 /** @return array that contains all sub-types of this block. */
 public static BakedPotatoMat[] bakedPotatoTypes() {
   return byID.values(new BakedPotatoMat[byID.size()]);
 }
예제 #12
0
 /**
  * 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);
 }