@Override
 public void loadNbt(CompoundTag tag) {
   super.loadNbt(tag);
   if (tag.isInt("BrewTime")) {
     brewTime = tag.getInt("BrewTime");
   }
 }
Esempio n. 2
0
 /**
  * Load structure piece data of the appropriate type from the given compound tag.
  *
  * @param structurePiece The target structure piece.
  * @param compound The structure piece's tag.
  */
 public void load(T structurePiece, CompoundTag compound) {
   if (compound.isInt("GD")) {
     structurePiece.setGD(compound.getInt("GD"));
   }
   if (compound.isInt("O")) {
     structurePiece.setNumericOrientation(compound.getInt("O"));
   }
   if (compound.isIntArray("BB")) {
     int[] bb = compound.getIntArray("BB");
     if (bb.length == 6) {
       final StructureBoundingBox boundingBox =
           new StructureBoundingBox(
               new Vector(bb[0], bb[1], bb[2]), new Vector(bb[3], bb[4], bb[5]));
       structurePiece.setBoundingBox(boundingBox);
     }
   }
 }
Esempio n. 3
0
 public static BannerPattern fromNBT(List<CompoundTag> tag) {
   BannerPattern.Builder builder = BannerPattern.builder();
   for (CompoundTag layer : tag) {
     BannerPattern.LayerTexture type =
         BannerPattern.LayerTexture.getByCode(layer.getString("Pattern"));
     DyeColor color = DyeColor.getByDyeData((byte) layer.getInt("Color"));
     builder.layer(type, color);
   }
   return builder.build();
 }