RandomOffsetOperation class

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

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

extends: SequenceBrushOperation

Поля (2)

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

Методы (1)

МодификаторыВозвратСигнатура
abstract super super("Randomize Offset", "Randomly offset the brush location from the clicked origin", false)

Исходный код

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

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">import org.joml.Vector3i;

class="kw">public class RandomOffsetOperation class="kw">extends SequenceBrushOperation {
   class="kw">public class="kw">static class="kw">final BuilderCodec<RandomOffsetOperation> CODEC = BuilderCodec.builder(RandomOffsetOperation.class, RandomOffsetOperation::new)
      .append(new KeyedCodec<>("XOffsetRange", RelativeIntegerRange.CODEC), (var0, var1) -> var0.xOffsetArg = var1, var0 -> var0.xOffsetArg)
      .documentation("The range of allowed values for the X offset")
      .add()
      .<RelativeIntegerRange>append(
         new KeyedCodec<>("YOffsetRange", RelativeIntegerRange.CODEC), (var0, var1) -> var0.yOffsetArg = var1, var0 -> var0.yOffsetArg
      )
      .documentation("The range of allowed values for the Z offset")
      .add()
      .<RelativeIntegerRange>append(
         new KeyedCodec<>("ZOffsetRange", RelativeIntegerRange.CODEC), (var0, var1) -> var0.zOffsetArg = var1, var0 -> var0.zOffsetArg
      )
      .documentation("The range of allowed values for the Y offset")
      .add()
      .documentation("Randomly offset the brush location from the clicked origin")
      .build();
   @Nonnull
   class="kw">public RelativeIntegerRange xOffsetArg = new RelativeIntegerRange(1, 1);
   @Nonnull
   class="kw">public RelativeIntegerRange yOffsetArg = new RelativeIntegerRange(1, 1);
   @Nonnull
   class="kw">public RelativeIntegerRange zOffsetArg = new RelativeIntegerRange(1, 1);

   class="kw">public RandomOffsetOperation() {
      super("Randomize Offset", "Randomly offset the brush location from the clicked origin", false);
   }

   @Override
   class="kw">public void modifyBrushConfig(
      @Nonnull Ref<EntityStore> var1, @Nonnull BrushConfig var2, @Nonnull BrushConfigCommandExecutor var3, @Nonnull ComponentAccessor<EntityStore> var4
   ) {
      Vector3i var5 = new Vector3i(
         this.xOffsetArg.getNumberInRange(var2.getOriginOffset().x),
         this.yOffsetArg.getNumberInRange(var2.getOriginOffset().y),
         this.zOffsetArg.getNumberInRange(var2.getOriginOffset().z)
      );
      var2.setOriginOffset(var5);
   }
}