ProcessingBench class

Пакет: com.hypixel.hytale.server.core.asset.type.blocktype.config.bench

Файл: com/hypixel/hytale/server/core/asset/type/blocktype/config/bench/ProcessingBench.java

extends: Bench

Поля (26)

МодификаторыТипИмя
final BuilderCodec<ProcessingBench> CODEC
public static final BuilderCodec<ProcessingBench.ExtraOutput> CODEC
public static final BuilderCodec<ProcessingBench.ProcessingSlot> CODEC
protected boolean filterValidIngredients
private MaterialQuantity[] ignoredFuelSources
private MaterialQuantity[] outputs
private int perFuelItemsConsumed
protected String resourceTypeId
int var1
var1
var1
var1
var1
var1
var1
var1
var1
var1
var1
var1
var1
int var1
String var2
ProcessingBench.ProcessingSlot[] var2
ProcessingBench var2
ProcessingBench.ExtraOutput var2

Методы (31)

МодификаторыВозвратСигнатура
public ExtraOutputpublic ExtraOutput()
public ProcessingSlotpublic ProcessingSlot()
public boolean equalspublic boolean equals(@Nullable Object var1)
for for(MaterialQuantity var5 : this.ignoredFuelSources)
public int getEndSoundEventIndexint getEndSoundEventIndex()
public ProcessingBench.ExtraOutput getExtraOutputProcessingBench.ExtraOutput getExtraOutput()
public ProcessingBench.ProcessingSlot[] getFuelProcessingBench.ProcessingSlot[] getFuel()
public String getFuelDropItemIdString getFuelDropItemId()
public String getIconString getIcon()
public String getIconIdString getIconId()
public String getIconItemString getIconItem()
public String getIconNameString getIconName()
public ProcessingBench.ProcessingSlot[] getInputProcessingBench.ProcessingSlot[] getInput(int var1)
public int getMaxFuelint getMaxFuel()
public int getOutputSlotsCountint getOutputSlotsCount(int var1)
public MaterialQuantity[] getOutputspublic MaterialQuantity[] getOutputs()
public int getPerFuelItemsConsumedpublic int getPerFuelItemsConsumed()
public String getResourceTypeIdpublic String getResourceTypeId()
public int hashCodepublic int hashCode()
if if(var0.icon != null)
if if(var0.iconId == null)
if if(var0.iconName == null)
if if(var0.endSoundEventId != null)
if if(this.tierLevels == null)
if if(var1 > this.tierLevels.length)
if if(this.tierLevels == null)
if if(this.ignoredFuelSources == null)
if if(this == var1)
public boolean isIgnoredFuelSourcepublic boolean isIgnoredFuelSource(Item var1)
public boolean shouldAllowNoInputProcessingboolean shouldAllowNoInputProcessing()
public boolean shouldFilterValidIngredientspublic boolean shouldFilterValidIngredients()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.blocktype.config.bench;

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.item.config.Item;
class="kw">import com.hypixel.hytale.server.core.asset.type.soundevent.config.SoundEvent;
class="kw">import com.hypixel.hytale.server.core.asset.type.soundevent.validator.SoundEventValidators;
class="kw">import com.hypixel.hytale.server.core.inventory.MaterialQuantity;
class="kw">import java.util.Arrays;
class="kw">import java.util.Locale;
class="kw">import java.util.Objects;
class="kw">import javax.annotation.Nullable;

class="kw">public class ProcessingBench class="kw">extends Bench {
   class="kw">public class="kw">static class="kw">final BuilderCodec<ProcessingBench> CODEC = BuilderCodec.builder(ProcessingBench.class, ProcessingBench::new, Bench.BASE_CODEC)
      .append(
         new KeyedCodec<>("Input", new ArrayCodec<>(ProcessingBench.ProcessingSlot.CODEC, ProcessingBench.ProcessingSlot[]::new)),
         (var0, var1) -> var0.input = var1,
         var0 -> var0.input
      )
      .addValidator(Validators.nonNull())
      .add()
      .append(
         new KeyedCodec<>("Fuel", new ArrayCodec<>(ProcessingBench.ProcessingSlot.CODEC, ProcessingBench.ProcessingSlot[]::new)),
         (var0, var1) -> var0.fuel = var1,
         var0 -> var0.fuel
      )
      .add()
      .append(new KeyedCodec<>("MaxFuel", Codec.INTEGER), (var0, var1) -> var0.maxFuel = var1, var0 -> var0.maxFuel)
      .add()
      .append(new KeyedCodec<>("FuelDropItemId", Codec.STRING), (var0, var1) -> var0.fuelDropItemId = var1, var0 -> var0.fuelDropItemId)
      .add()
      .<Integer>append(new KeyedCodec<>("OutputSlotsCount", Codec.INTEGER), (var0, var1) -> var0.outputSlotsCount = var1, var0 -> var0.outputSlotsCount)
      .addValidator(Validators.greaterThanOrEqual(1))
      .add()
      .append(new KeyedCodec<>("ExtraOutput", ProcessingBench.ExtraOutput.CODEC), (var0, var1) -> var0.extraOutput = var1, var0 -> var0.extraOutput)
      .add()
      .append(
         new KeyedCodec<>("AllowNoInputProcessing", Codec.BOOLEAN), (var0, var1) -> var0.allowNoInputProcessing = var1, var0 -> var0.allowNoInputProcessing
      )
      .add()
      .append(new KeyedCodec<>("IconItem", Codec.STRING), (var0, var1) -> var0.iconItem = var1, var0 -> var0.iconItem)
      .add()
      .append(new KeyedCodec<>("Icon", Codec.STRING), (var0, var1) -> var0.icon = var1, var0 -> var0.icon)
      .add()
      .append(new KeyedCodec<>("IconName", Codec.STRING), (var0, var1) -> var0.iconName = var1, var0 -> var0.iconName)
      .add()
      .append(new KeyedCodec<>("IconId", Codec.STRING), (var0, var1) -> var0.iconId = var1, var0 -> var0.iconId)
      .add()
      .<String>append(new KeyedCodec<>("EndSoundEventId", Codec.STRING), (var0, var1) -> var0.endSoundEventId = var1, var0 -> var0.endSoundEventId)
      .addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
      .addValidator(SoundEventValidators.MONO)
      .addValidator(SoundEventValidators.ONESHOT)
      .add()
      .afterDecode(var0 -> {
         if (var0.icon != null) {
            if (var0.iconId == null) {
               String var1 = var0.icon.substring(0, var0.icon.indexOf(46));
               var0.iconId = var1.toLowerCase(Locale.ROOT);
            }

            if (var0.iconName == null) {
               String var2 = var0.icon.substring(0, var0.icon.indexOf(46));
               var0.iconName = var2.toLowerCase(Locale.ROOT);
            }
         }

         if (var0.endSoundEventId != null) {
            var0.endSoundEventIndex = SoundEvent.getAssetMap().getIndex(var0.endSoundEventId);
         }
      })
      .build();
   class="kw">protected ProcessingBench.ProcessingSlot[] input;
   class="kw">protected ProcessingBench.ProcessingSlot[] fuel;
   class="kw">protected boolean allowNoInputProcessing;
   class="kw">protected ProcessingBench.ExtraOutput extraOutput;
   class="kw">protected int maxFuel = -1;
   class="kw">protected String fuelDropItemId;
   class="kw">protected int outputSlotsCount = 1;
   class="kw">protected String iconItem;
   class="kw">protected String icon;
   class="kw">protected String iconName;
   class="kw">protected String iconId;
   @Nullable
   class="kw">protected String endSoundEventId = null;
   class="kw">protected class="kw">transient int endSoundEventIndex = 0;

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

   class="kw">public String getIconItem() {
      class="kw">return this.iconItem;
   }

   class="kw">public String getIcon() {
      class="kw">return this.icon;
   }

   class="kw">public String getIconName() {
      class="kw">return this.iconName;
   }

   class="kw">public String getIconId() {
      class="kw">return this.iconId;
   }

   class="kw">public ProcessingBench.ProcessingSlot[] getInput(int var1) {
      if (this.tierLevels == null) {
         class="kw">return this.input;
      }

      if (var1 > this.tierLevels.length) {
         class="kw">return this.input;
      }

      ProcessingBench.ProcessingSlot[] var2 = new ProcessingBench.ProcessingSlot[this.input.length + this.tierLevels[var1 - 1].extraInputSlot];
      Arrays.fill(var2, this.input[0]);
      class="kw">return var2;
   }

   class="kw">public ProcessingBench.ProcessingSlot[] getFuel() {
      class="kw">return this.fuel;
   }

   class="kw">public int getMaxFuel() {
      class="kw">return this.maxFuel;
   }

   class="kw">public String getFuelDropItemId() {
      class="kw">return this.fuelDropItemId;
   }

   class="kw">public int getOutputSlotsCount(int var1) {
      if (this.tierLevels == null) {
         class="kw">return this.outputSlotsCount;
      } else {
         class="kw">return var1 > this.tierLevels.length ? this.outputSlotsCount : this.outputSlotsCount + this.tierLevels[var1 - 1].extraOutputSlot;
      }
   }

   class="kw">public ProcessingBench.ExtraOutput getExtraOutput() {
      class="kw">return this.extraOutput;
   }

   @Nullable
   class="kw">public String getEndSoundEventId() {
      class="kw">return this.endSoundEventId;
   }

   class="kw">public int getEndSoundEventIndex() {
      class="kw">return this.endSoundEventIndex;
   }

   class="kw">public boolean shouldAllowNoInputProcessing() {
      class="kw">return this.allowNoInputProcessing;
   }

   @Override
   class="kw">public boolean equals(Object var1) {
      if (var1 == null || this.getClass() != var1.getClass()) {
         class="kw">return false;
      }

      if (!super.equals(var1)) {
         class="kw">return false;
      }

      ProcessingBench var2 = (ProcessingBench)var1;
      class="kw">return this.allowNoInputProcessing == var2.allowNoInputProcessing
         && this.maxFuel == var2.maxFuel
         && this.outputSlotsCount == var2.outputSlotsCount
         && this.endSoundEventIndex == var2.endSoundEventIndex
         && Arrays.equals(this.input, var2.input)
         && Arrays.equals(this.fuel, var2.fuel)
         && Objects.equals(this.extraOutput, var2.extraOutput)
         && Objects.equals(this.fuelDropItemId, var2.fuelDropItemId)
         && Objects.equals(this.iconItem, var2.iconItem)
         && Objects.equals(this.icon, var2.icon)
         && Objects.equals(this.iconName, var2.iconName)
         && Objects.equals(this.iconId, var2.iconId)
         && Objects.equals(this.endSoundEventId, var2.endSoundEventId);
   }

   @Override
   class="kw">public int hashCode() {
      int var1 = super.hashCode();
      var1 = 31 * var1 + Arrays.hashCode(this.input);
      var1 = 31 * var1 + Arrays.hashCode(this.fuel);
      var1 = 31 * var1 + Boolean.hashCode(this.allowNoInputProcessing);
      var1 = 31 * var1 + Objects.hashCode(this.extraOutput);
      var1 = 31 * var1 + this.maxFuel;
      var1 = 31 * var1 + Objects.hashCode(this.fuelDropItemId);
      var1 = 31 * var1 + this.outputSlotsCount;
      var1 = 31 * var1 + Objects.hashCode(this.iconItem);
      var1 = 31 * var1 + Objects.hashCode(this.icon);
      var1 = 31 * var1 + Objects.hashCode(this.iconName);
      var1 = 31 * var1 + Objects.hashCode(this.iconId);
      var1 = 31 * var1 + Objects.hashCode(this.endSoundEventId);
      class="kw">return 31 * var1 + this.endSoundEventIndex;
   }

   class="kw">public class="kw">static class ExtraOutput {
      class="kw">public class="kw">static class="kw">final BuilderCodec<ProcessingBench.ExtraOutput> CODEC = BuilderCodec.builder(
            ProcessingBench.ExtraOutput.class, ProcessingBench.ExtraOutput::new
         )
         .append(
            new KeyedCodec<>("Outputs", new ArrayCodec<>(MaterialQuantity.CODEC, MaterialQuantity[]::new)),
            (var0, var1) -> var0.outputs = var1,
            var0 -> var0.outputs
         )
         .addValidator(Validators.nonNull())
         .add()
         .<Integer>append(
            new KeyedCodec<>("PerFuelItemsConsumed", Codec.INTEGER), (var0, var1) -> var0.perFuelItemsConsumed = var1, var0 -> var0.perFuelItemsConsumed
         )
         .addValidator(Validators.greaterThanOrEqual(1))
         .add()
         .append(
            new KeyedCodec<>("IgnoredFuelSources", new ArrayCodec<>(MaterialQuantity.CODEC, MaterialQuantity[]::new)),
            (var0, var1) -> var0.ignoredFuelSources = var1,
            var0 -> var0.ignoredFuelSources
         )
         .add()
         .build();
      class="kw">private MaterialQuantity[] outputs;
      class="kw">private int perFuelItemsConsumed = 1;
      class="kw">private MaterialQuantity[] ignoredFuelSources;

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

      class="kw">public MaterialQuantity[] getOutputs() {
         class="kw">return this.outputs;
      }

      class="kw">public int getPerFuelItemsConsumed() {
         class="kw">return this.perFuelItemsConsumed;
      }

      class="kw">public boolean isIgnoredFuelSource(Item var1) {
         if (this.ignoredFuelSources == null) {
            class="kw">return false;
         }

         for (MaterialQuantity var5 : this.ignoredFuelSources) {
            if (var5.getItemId() != null && var5.getItemId().equals(var1.getBlockId())) {
               class="kw">return true;
            }
         }

         class="kw">return false;
      }

      @Override
      class="kw">public boolean equals(@Nullable Object var1) {
         if (this == var1) {
            class="kw">return true;
         } else if (var1 != null && this.getClass() == var1.getClass()) {
            ProcessingBench.ExtraOutput var2 = (ProcessingBench.ExtraOutput)var1;
            class="kw">return this.perFuelItemsConsumed != var2.perFuelItemsConsumed ? false : Arrays.equals(this.outputs, var2.outputs);
         } else {
            class="kw">return false;
         }
      }

      @Override
      class="kw">public int hashCode() {
         int var1 = Arrays.hashCode(this.outputs);
         class="kw">return 31 * var1 + this.perFuelItemsConsumed;
      }
   }

   class="kw">public class="kw">static class ProcessingSlot class="kw">extends Bench.BenchSlot {
      class="kw">public class="kw">static class="kw">final BuilderCodec<ProcessingBench.ProcessingSlot> CODEC = BuilderCodec.builder(
            ProcessingBench.ProcessingSlot.class, ProcessingBench.ProcessingSlot::new, Bench.BenchSlot.CODEC
         )
         .append(new KeyedCodec<>("ResourceTypeId", Codec.STRING), (var0, var1) -> var0.resourceTypeId = var1, var0 -> var0.resourceTypeId)
         .add()
         .append(
            new KeyedCodec<>("FilterValidIngredients", Codec.BOOLEAN), (var0, var1) -> var0.filterValidIngredients = var1, var0 -> var0.filterValidIngredients
         )
         .add()
         .build();
      class="kw">protected boolean filterValidIngredients;
      class="kw">protected String resourceTypeId;

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

      class="kw">public String getResourceTypeId() {
         class="kw">return this.resourceTypeId;
      }

      class="kw">public boolean shouldFilterValidIngredients() {
         class="kw">return this.filterValidIngredients;
      }
   }
}