ReplaceOperation class
Пакет: com.hypixel.hytale.builtin.buildertools.scriptedbrushes.operations.sequential
Файл: com/hypixel/hytale/builtin/buildertools/scriptedbrushes/operations/sequential/ReplaceOperation.java
extends: SequenceBrushOperation
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<ReplaceOperation> |
CODEC |
|
int |
var9 |
Методы (1)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
|
super super("Replace Blocks", "Replace one kind of block with another pattern of blocks within the current brush editing area", true) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.buildertools.scriptedbrushes.operations.sequential;
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.BrushConfigEditStore;
class="kw">import com.hypixel.hytale.builtin.buildertools.scriptedbrushes.operations.system.SequenceBrushOperation;
class="kw">import com.hypixel.hytale.builtin.buildertools.utils.Material;
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.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
class="kw">import com.hypixel.hytale.server.core.prefab.selection.mask.BlockPattern;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;
class="kw">public class ReplaceOperation class="kw">extends SequenceBrushOperation {
class="kw">public class="kw">static class="kw">final BuilderCodec<ReplaceOperation> CODEC = BuilderCodec.builder(ReplaceOperation.class, ReplaceOperation::new)
.append(new KeyedCodec<>("FromBlockType", Codec.STRING), (var0, var1) -> var0.blockTypeKeyToReplace = var1, var0 -> var0.blockTypeKeyToReplace)
.documentation("The block type to get replaced")
.add()
.<BlockPattern>append(
new KeyedCodec<>("ToBlockPattern", BlockPattern.CODEC), (var0, var1) -> var0.replacementBlocks = var1, var0 -> var0.replacementBlocks
)
.documentation("The pattern of blocks set to")
.add()
.documentation("Replace one kind of block with another pattern of blocks within the current brush editing area")
.build();
@Nonnull
class="kw">public String blockTypeKeyToReplace = "Rock_Stone";
@Nonnull
class="kw">public BlockPattern replacementBlocks = BlockPattern.parse("Rock_Stone");
class="kw">public ReplaceOperation() {
super("Replace Blocks", "Replace one kind of block with another pattern of blocks within the current brush editing area", true);
}
@Override
class="kw">public boolean modifyBlocks(
Ref<EntityStore> var1,
@Nonnull BrushConfig var2,
BrushConfigCommandExecutor var3,
@Nonnull BrushConfigEditStore var4,
int var5,
int var6,
int var7,
ComponentAccessor<EntityStore> var8
) {
int var9 = var4.getBlock(var5, var6, var7);
if (var9 == BlockType.getAssetMap().getIndex(this.blockTypeKeyToReplace)) {
var4.setMaterialWithFiller(var5, var6, var7, Material.fromPattern(this.replacementBlocks, var2.getRandom()));
}
class="kw">return true;
}
@Override
class="kw">public void modifyBrushConfig(
@Nonnull Ref<EntityStore> var1, @Nonnull BrushConfig var2, @Nonnull BrushConfigCommandExecutor var3, @Nonnull ComponentAccessor<EntityStore> var4
) {
}
}