FarmingCoopAsset class

Пакет: com.hypixel.hytale.builtin.adventure.farming.config

Файл: com/hypixel/hytale/builtin/adventure/farming/config/FarmingCoopAsset.java

implements: JsonAssetWithMap<String, DefaultAssetMap<String, FarmingCoopAsset>>

Поля (2)

МодификаторыТипИмя
ASSET_STORE
int var2

Методы (12)

МодификаторыВозвратСигнатура
for for(int var1 = 0; var1 < var0.acceptedNpcGroupIds.length; var1++)
public int[] getAcceptedNpcGroupIndexesint[] getAcceptedNpcGroupIndexes()
static DefaultAssetMap<String, FarmingCoopAsset> getAssetMapDefaultAssetMap<String, FarmingCoopAsset> getAssetMap()
static AssetStore<String, FarmingCoopAsset, DefaultAssetMap<String, FarmingCoopAsset>> getAssetStoreAssetStore<String, FarmingCoopAsset, DefaultAssetMap<String, FarmingCoopAsset>> getAssetStore()
public boolean getCaptureWildNPCsInRangeboolean getCaptureWildNPCsInRange()
public String getIdString getId()
public int getMaxResidentsint getMaxResidents()
public Map<String, String> getProduceDropsMap<String, String> getProduceDrops()
public IntRange getResidentRoamTimeIntRange getResidentRoamTime()
public float getWildCaptureRadiusfloat getWildCaptureRadius()
if if(var0.acceptedNpcGroupIds != null)
if if(ASSET_STORE == null)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.adventure.farming.config;

class="kw">import com.hypixel.hytale.assetstore.AssetExtraInfo;
class="kw">import com.hypixel.hytale.assetstore.AssetRegistry;
class="kw">import com.hypixel.hytale.assetstore.AssetStore;
class="kw">import com.hypixel.hytale.assetstore.codec.AssetBuilderCodec;
class="kw">import com.hypixel.hytale.assetstore.map.DefaultAssetMap;
class="kw">import com.hypixel.hytale.assetstore.map.JsonAssetWithMap;
class="kw">import com.hypixel.hytale.builtin.tagset.config.NPCGroup;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.codecs.map.MapCodec;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.math.range.IntRange;
class="kw">import com.hypixel.hytale.math.vector.Vector3dUtil;
class="kw">import com.hypixel.hytale.server.core.asset.type.item.config.ItemDropList;
class="kw">import java.util.Collections;
class="kw">import java.util.HashMap;
class="kw">import java.util.Map;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;

class="kw">public class FarmingCoopAsset class="kw">implements JsonAssetWithMap<String, DefaultAssetMap<String, FarmingCoopAsset>> {
   @Nonnull
   class="kw">public class="kw">static class="kw">final AssetBuilderCodec<String, FarmingCoopAsset> CODEC = AssetBuilderCodec.builder(
         FarmingCoopAsset.class,
         FarmingCoopAsset::new,
         Codec.STRING,
         (var0, var1) -> var0.id = var1,
         FarmingCoopAsset::getId,
         (var0, var1) -> var0.data = var1,
         var0 -> var0.data
      )
      .appendInherited(
         new KeyedCodec<>("MaxResidents", Codec.INTEGER),
         (var0, var1) -> var0.maxResidents = var1,
         var0 -> var0.maxResidents,
         (var0, var1) -> var0.maxResidents = var1.maxResidents
      )
      .add()
      .<Map>append(
         new KeyedCodec<>("ProduceDrops", new MapCodec<>(ItemDropList.CHILD_ASSET_CODEC, HashMap::new)),
         (var0, var1) -> var0.produceDrops = var1,
         var0 -> var0.produceDrops
      )
      .addValidator(ItemDropList.VALIDATOR_CACHE.getMapValueValidator())
      .add()
      .<Vector3d>append(
         new KeyedCodec<>("ResidentSpawnOffset", Vector3dUtil.CODEC), (var0, var1) -> var0.residentSpawnOffset.set(var1), var0 -> var0.residentSpawnOffset
      )
      .addValidator(Validators.nonNull())
      .add()
      .append(new KeyedCodec<>("ResidentRoamTime", IntRange.CODEC), (var0, var1) -> var0.residentRoamTime = var1, var0 -> var0.residentRoamTime)
      .add()
      .append(
         new KeyedCodec<>("CaptureWildNPCsInRange", Codec.BOOLEAN), (var0, var1) -> var0.captureWildNPCsInRange = var1, var0 -> var0.captureWildNPCsInRange
      )
      .add()
      .append(new KeyedCodec<>("WildCaptureRadius", Codec.FLOAT), (var0, var1) -> var0.wildCaptureRadius = var1, var0 -> var0.wildCaptureRadius)
      .add()
      .<String[]>appendInherited(
         new KeyedCodec<>("AcceptedNpcGroups", NPCGroup.CHILD_ASSET_CODEC_ARRAY),
         (var0, var1) -> var0.acceptedNpcGroupIds = var1,
         var0 -> var0.acceptedNpcGroupIds,
         (var0, var1) -> var0.acceptedNpcGroupIds = var1.acceptedNpcGroupIds
      )
      .addValidator(NPCGroup.VALIDATOR_CACHE.getArrayValidator())
      .add()
      .afterDecode(var0 -> {
         if (var0.acceptedNpcGroupIds != null) {
            var0.acceptedNpcGroupIndexes = new int[var0.acceptedNpcGroupIds.length];

            for (int var1 = 0; var1 < var0.acceptedNpcGroupIds.length; var1++) {
               int var2 = NPCGroup.getAssetMap().getIndex(var0.acceptedNpcGroupIds[var1]);
               var0.acceptedNpcGroupIndexes[var1] = var2;
            }
         }
      })
      .build();
   class="kw">private class="kw">static AssetStore<String, FarmingCoopAsset, DefaultAssetMap<String, FarmingCoopAsset>> ASSET_STORE;
   class="kw">private AssetExtraInfo.Data data;
   class="kw">protected String id;
   class="kw">protected int maxResidents;
   class="kw">protected Map<String, String> produceDrops = Collections.emptyMap();
   class="kw">protected IntRange residentRoamTime;
   @Nonnull
   class="kw">protected Vector3d residentSpawnOffset = new Vector3d();
   class="kw">protected String[] acceptedNpcGroupIds;
   class="kw">protected int[] acceptedNpcGroupIndexes;
   class="kw">protected boolean captureWildNPCsInRange;
   class="kw">protected float wildCaptureRadius;

   class="kw">public class="kw">static AssetStore<String, FarmingCoopAsset, DefaultAssetMap<String, FarmingCoopAsset>> getAssetStore() {
      if (ASSET_STORE == null) {
         ASSET_STORE = AssetRegistry.getAssetStore(FarmingCoopAsset.class);
      }

      class="kw">return ASSET_STORE;
   }

   class="kw">public class="kw">static DefaultAssetMap<String, FarmingCoopAsset> getAssetMap() {
      class="kw">return (DefaultAssetMap<String, FarmingCoopAsset>)getAssetStore().getAssetMap();
   }

   class="kw">public FarmingCoopAsset() {
   }

   class="kw">public FarmingCoopAsset(String var1) {
      this.id = var1;
   }

   class="kw">public String getId() {
      class="kw">return this.id;
   }

   class="kw">public Map<String, String> getProduceDrops() {
      class="kw">return this.produceDrops;
   }

   class="kw">public int getMaxResidents() {
      class="kw">return this.maxResidents;
   }

   class="kw">public IntRange getResidentRoamTime() {
      class="kw">return this.residentRoamTime;
   }

   @Nonnull
   class="kw">public Vector3d getResidentSpawnOffset() {
      class="kw">return this.residentSpawnOffset;
   }

   class="kw">public int[] getAcceptedNpcGroupIndexes() {
      class="kw">return this.acceptedNpcGroupIndexes;
   }

   class="kw">public float getWildCaptureRadius() {
      class="kw">return this.wildCaptureRadius;
   }

   class="kw">public boolean getCaptureWildNPCsInRange() {
      class="kw">return this.captureWildNPCsInRange;
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "FarmingCoopAsset{id='" + this.id + "', maxResidents=" + this.maxResidents + "}";
   }
}