ChestConfig class

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

Файл: com/hypixel/hytale/builtin/adventure/objectives/config/task/TreasureMapObjectiveTaskAsset.java

Поля (11)

МодификаторыТипИмя
public static final BuilderCodec<TreasureMapObjectiveTaskAsset.ChestConfig> CODEC
protected String chestBlockTypeKey
protected String droplistId
protected float maxRadius
protected float minRadius
int var1
var1
var1
var1
TreasureMapObjectiveTaskAsset.ChestConfig var2
protected WorldLocationProvider worldLocationProvider

Методы (10)

МодификаторыВозвратСигнатура
public boolean equalspublic boolean equals(@Nullable Object var1)
public String getChestBlockTypeKeypublic String getChestBlockTypeKey()
public String getDroplistIdpublic String getDroplistId()
public float getMaxRadiuspublic float getMaxRadius()
public float getMinRadiuspublic float getMinRadius()
public WorldLocationProvider getWorldLocationProviderpublic WorldLocationProvider getWorldLocationProvider()
public int hashCodepublic int hashCode()
if if(var0.minRadius >= var0.maxRadius)
if if(this == var1)
public String toStringpublic String toString()

Исходный код

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

class="kw">import com.hypixel.hytale.assetstore.codec.ContainedAssetCodec;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.taskcondition.TaskConditionAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.worldlocationproviders.WorldLocationProvider;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
class="kw">import com.hypixel.hytale.server.core.asset.type.item.config.ItemDropList;
class="kw">import java.util.Arrays;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3i;

class="kw">public class TreasureMapObjectiveTaskAsset class="kw">extends ObjectiveTaskAsset {
   @Nonnull
   class="kw">public class="kw">static class="kw">final BuilderCodec<TreasureMapObjectiveTaskAsset> CODEC = BuilderCodec.builder(
         TreasureMapObjectiveTaskAsset.class, TreasureMapObjectiveTaskAsset::new, BASE_CODEC
      )
      .append(
         new KeyedCodec<>("Chests", new ArrayCodec<>(TreasureMapObjectiveTaskAsset.ChestConfig.CODEC, TreasureMapObjectiveTaskAsset.ChestConfig[]::new)),
         (var0, var1) -> var0.chestConfigs = var1,
         var0 -> var0.chestConfigs
      )
      .addValidator(Validators.nonEmptyArray())
      .add()
      .build();
   class="kw">protected TreasureMapObjectiveTaskAsset.ChestConfig[] chestConfigs;

   class="kw">public TreasureMapObjectiveTaskAsset(String var1, TaskConditionAsset[] var2, Vector3i[] var3, TreasureMapObjectiveTaskAsset.ChestConfig[] var4) {
      super(var1, var2, var3);
      this.chestConfigs = var4;
   }

   class="kw">protected TreasureMapObjectiveTaskAsset() {
   }

   @Nonnull
   @Override
   class="kw">public ObjectiveTaskAsset.TaskScope getTaskScope() {
      class="kw">return ObjectiveTaskAsset.TaskScope.PLAYER;
   }

   class="kw">public TreasureMapObjectiveTaskAsset.ChestConfig[] getChestConfigs() {
      class="kw">return this.chestConfigs;
   }

   @Override
   class="kw">protected boolean matchesAsset0(ObjectiveTaskAsset var1) {
      class="kw">return var1 class="kw">instanceof TreasureMapObjectiveTaskAsset var2 ? Arrays.equals(var2.chestConfigs, this.chestConfigs) : false;
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "TreasureMapObjectiveTaskAsset{chestConfigs=" + Arrays.toString(this.chestConfigs) + "} " + super.toString();
   }

   class="kw">public class="kw">static class ChestConfig {
      @Nonnull
      class="kw">public class="kw">static class="kw">final BuilderCodec<TreasureMapObjectiveTaskAsset.ChestConfig> CODEC = BuilderCodec.builder(
            TreasureMapObjectiveTaskAsset.ChestConfig.class, TreasureMapObjectiveTaskAsset.ChestConfig::new
         )
         .append(new KeyedCodec<>("MinRadius", Codec.FLOAT), (var0, var1) -> var0.minRadius = var1, var0 -> var0.minRadius)
         .addValidator(Validators.greaterThan(0.0F))
         .add()
         .<Float>append(new KeyedCodec<>("MaxRadius", Codec.FLOAT), (var0, var1) -> var0.maxRadius = var1, var0 -> var0.maxRadius)
         .addValidator(Validators.greaterThan(1.0F))
         .add()
         .<String>append(
            new KeyedCodec<>("DropList", new ContainedAssetCodec<>(ItemDropList.class, ItemDropList.CODEC)),
            (var0, var1) -> var0.droplistId = var1,
            var0 -> var0.droplistId
         )
         .addValidator(Validators.nonNull())
         .addValidator(ItemDropList.VALIDATOR_CACHE.getValidator())
         .add()
         .append(
            new KeyedCodec<>("WorldLocationCondition", WorldLocationProvider.CODEC),
            (var0, var1) -> var0.worldLocationProvider = var1,
            var0 -> var0.worldLocationProvider
         )
         .add()
         .<String>append(new KeyedCodec<>("ChestBlockTypeKey", Codec.STRING), (var0, var1) -> var0.chestBlockTypeKey = var1, var0 -> var0.chestBlockTypeKey)
         .addValidator(Validators.nonNull())
         .addValidator(BlockType.VALIDATOR_CACHE.getValidator())
         .add()
         .afterDecode(
            var0 -> {
               if (var0.minRadius >= var0.maxRadius) {
                  throw new IllegalArgumentException(
                     "ChestConfig.MinRadius (" + var0.minRadius + ") needs to be greater than ChestConfig.MaxRadius (" + var0.maxRadius + ")"
                  );
               }
            }
         )
         .build();
      class="kw">protected float minRadius = 10.0F;
      class="kw">protected float maxRadius = 20.0F;
      class="kw">protected String droplistId;
      class="kw">protected WorldLocationProvider worldLocationProvider;
      class="kw">protected String chestBlockTypeKey;

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

      class="kw">public float getMinRadius() {
         class="kw">return this.minRadius;
      }

      class="kw">public float getMaxRadius() {
         class="kw">return this.maxRadius;
      }

      class="kw">public String getDroplistId() {
         class="kw">return this.droplistId;
      }

      class="kw">public WorldLocationProvider getWorldLocationProvider() {
         class="kw">return this.worldLocationProvider;
      }

      class="kw">public String getChestBlockTypeKey() {
         class="kw">return this.chestBlockTypeKey;
      }

      @Override
      class="kw">public boolean equals(@Nullable Object var1) {
         if (this == var1) {
            class="kw">return true;
         }

         if (var1 != null && this.getClass() == var1.getClass()) {
            TreasureMapObjectiveTaskAsset.ChestConfig var2 = (TreasureMapObjectiveTaskAsset.ChestConfig)var1;
            if (Float.compare(var2.minRadius, this.minRadius) != 0) {
               class="kw">return false;
            }

            if (Float.compare(var2.maxRadius, this.maxRadius) != 0) {
               class="kw">return false;
            }

            if (this.droplistId != null ? this.droplistId.equals(var2.droplistId) : var2.droplistId == null) {
               if (this.worldLocationProvider != null ? this.worldLocationProvider.equals(var2.worldLocationProvider) : var2.worldLocationProvider == null) {
                  class="kw">return this.chestBlockTypeKey != null ? this.chestBlockTypeKey.equals(var2.chestBlockTypeKey) : var2.chestBlockTypeKey == null;
               } else {
                  class="kw">return false;
               }
            } else {
               class="kw">return false;
            }
         } else {
            class="kw">return false;
         }
      }

      @Override
      class="kw">public int hashCode() {
         int var1 = this.minRadius != 0.0F ? Float.floatToIntBits(this.minRadius) : 0;
         var1 = 31 * var1 + (this.maxRadius != 0.0F ? Float.floatToIntBits(this.maxRadius) : 0);
         var1 = 31 * var1 + (this.droplistId != null ? this.droplistId.hashCode() : 0);
         var1 = 31 * var1 + (this.worldLocationProvider != null ? this.worldLocationProvider.hashCode() : 0);
         class="kw">return 31 * var1 + (this.chestBlockTypeKey != null ? this.chestBlockTypeKey.hashCode() : 0);
      }

      @Nonnull
      @Override
      class="kw">public String toString() {
         class="kw">return "ChestConfig{minRadius="
            + this.minRadius
            + ", maxRadius="
            + this.maxRadius
            + ", droplistId='"
            + this.droplistId
            + "', worldLocationCondition="
            + this.worldLocationProvider
            + ", chestBlockTypeKey="
            + this.chestBlockTypeKey
            + "}";
      }
   }
}