PersistentDataOperation class
Пакет: com.hypixel.hytale.builtin.buildertools.scriptedbrushes.operations.sequential.saveandload
Файл: com/hypixel/hytale/builtin/buildertools/scriptedbrushes/operations/sequential/saveandload/PersistentDataOperation.java
extends: SequenceBrushOperation
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<PersistentDataOperation> |
CODEC |
|
int |
var5 |
|
int |
var6 |
Методы (1)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
|
super super("Persistent Data", "Store and operate on data that sticks around between executions", false) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.buildertools.scriptedbrushes.operations.sequential.saveandload;
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.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.EnumCodec;
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.ArgTypes;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;
class="kw">public class PersistentDataOperation class="kw">extends SequenceBrushOperation {
class="kw">public class="kw">static class="kw">final BuilderCodec<PersistentDataOperation> CODEC = BuilderCodec.builder(PersistentDataOperation.class, PersistentDataOperation::new)
.append(new KeyedCodec<>("StoredName", Codec.STRING), (var0, var1) -> var0.variableNameArg = var1, var0 -> var0.variableNameArg)
.documentation("The name of the variable to modify")
.add()
.<ArgTypes.IntegerOperation>append(
new KeyedCodec<>("Operation", new EnumCodec<>(ArgTypes.IntegerOperation.class)), (var0, var1) -> var0.operationArg = var1, var0 -> var0.operationArg
)
.documentation("The operation to perform on the variable using the modifier")
.add()
.<Integer>append(new KeyedCodec<>("Modifier", Codec.INTEGER), (var0, var1) -> var0.modifierArg = var1, var0 -> var0.modifierArg)
.documentation("The value to modify the variable by")
.add()
.documentation("Store and operate on data that sticks around between executions")
.build();
@Nonnull
class="kw">public String variableNameArg = "Undefined";
@Nonnull
class="kw">public ArgTypes.IntegerOperation operationArg = ArgTypes.IntegerOperation.SET;
@Nonnull
class="kw">public Integer modifierArg = 0;
class="kw">public PersistentDataOperation() {
super("Persistent Data", "Store and operate on data that sticks around between executions", false);
}
@Override
class="kw">public void modifyBrushConfig(
@Nonnull Ref<EntityStore> var1, @Nonnull BrushConfig var2, @Nonnull BrushConfigCommandExecutor var3, @Nonnull ComponentAccessor<EntityStore> var4
) {
int var5 = var3.getPersistentVariableOrDefault(this.variableNameArg, 0);
System.out.println(this.variableNameArg + ": " + var5);
int var6 = this.operationArg.operate(var5, this.modifierArg);
var3.setPersistentVariable(this.variableNameArg, var6);
}
}