RandomizeDimensionsOperation class

Пакет: com.hypixel.hytale.builtin.buildertools.scriptedbrushes.operations.sequential.dimensions

Файл: com/hypixel/hytale/builtin/buildertools/scriptedbrushes/operations/sequential/dimensions/RandomizeDimensionsOperation.java

extends: SequenceBrushOperation

Поля (1)

МодификаторыТипИмя
final BuilderCodec<RandomizeDimensionsOperation> CODEC

Методы (1)

МодификаторыВозвратСигнатура
abstract super super("Randomize Dimensions", "Randomize the dimensions of the brush area", false)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.buildertools.scriptedbrushes.operations.sequential.dimensions;

class="kw">import com.hypixel.hytale.builtin.buildertools.scriptedbrushes.BrushConfig;
class="kw">import com.hypixel.hytale.builtin.buildertools.scriptedbrushes.BrushConfigCommandExecutor;
class="kw">import com.hypixel.hytale.builtin.buildertools.scriptedbrushes.operations.system.SequenceBrushOperation;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.types.RelativeIntegerRange;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;

class="kw">public class RandomizeDimensionsOperation class="kw">extends SequenceBrushOperation {
   class="kw">public class="kw">static class="kw">final BuilderCodec<RandomizeDimensionsOperation> CODEC = BuilderCodec.builder(
         RandomizeDimensionsOperation.class, RandomizeDimensionsOperation::new
      )
      .append(new KeyedCodec<>("WidthRange", RelativeIntegerRange.CODEC), (var0, var1) -> var0.widthRangeArg = var1, var0 -> var0.widthRangeArg)
      .documentation("The range of values for the width, optionally relative using tilde")
      .add()
      .<RelativeIntegerRange>append(
         new KeyedCodec<>("HeightRange", RelativeIntegerRange.CODEC), (var0, var1) -> var0.heightRangeArg = var1, var0 -> var0.heightRangeArg
      )
      .documentation("The range of values for the height, optionally relative using tilde")
      .add()
      .documentation("Randomize the dimensions of the brush area")
      .build();
   @Nonnull
   class="kw">public RelativeIntegerRange widthRangeArg = new RelativeIntegerRange(1, 1);
   @Nonnull
   class="kw">public RelativeIntegerRange heightRangeArg = new RelativeIntegerRange(1, 1);

   class="kw">public RandomizeDimensionsOperation() {
      super("Randomize Dimensions", "Randomize the dimensions of the brush area", false);
   }

   @Override
   class="kw">public void modifyBrushConfig(
      @Nonnull Ref<EntityStore> var1, @Nonnull BrushConfig var2, @Nonnull BrushConfigCommandExecutor var3, @Nonnull ComponentAccessor<EntityStore> var4
   ) {
      var2.setShapeWidth(this.widthRangeArg.getNumberInRange(var2.getShapeWidth()));
      var2.setShapeHeight(this.heightRangeArg.getNumberInRange(var2.getShapeHeight()));
   }
}