StructuralCraftingBench class
Пакет: com.hypixel.hytale.server.core.asset.type.blocktype.config.bench
Файл: com/hypixel/hytale/server/core/asset/type/blocktype/config/bench/StructuralCraftingBench.java
extends: Bench
Поля (1)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<StructuralCraftingBench> |
CODEC |
Методы (8)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
for for(int var1 = 0; var1 < this.sortedCategories.length; var1++) |
public |
int |
getCategoryIndexint getCategoryIndex(@Nonnull String var1) |
|
|
if if(this.headerCategories != null) |
|
|
if if(this.sortedCategories != null) |
public |
boolean |
isHeaderCategoryboolean isHeaderCategory(@Nonnull String var1) |
private |
void |
processConfigvoid processConfig() |
public |
boolean |
shouldAllowBlockGroupCyclingboolean shouldAllowBlockGroupCycling() |
public |
boolean |
shouldAlwaysShowInventoryHintsboolean shouldAlwaysShowInventoryHints() |
Исходный код
Показать/скрыть
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 it.unimi.dsi.fastutil.objects.Object2IntMap;
class="kw">import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
class="kw">import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
class="kw">import java.util.Collections;
class="kw">import javax.annotation.Nonnull;
class="kw">public class StructuralCraftingBench class="kw">extends Bench {
class="kw">public class="kw">static class="kw">final BuilderCodec<StructuralCraftingBench> CODEC = BuilderCodec.builder(
StructuralCraftingBench.class, StructuralCraftingBench::new, Bench.BASE_CODEC
)
.append(
new KeyedCodec<>("Categories", new ArrayCodec<>(Codec.STRING, String[]::new)),
(var0, var1) -> var0.sortedCategories = var1,
var0 -> var0.sortedCategories
)
.add()
.append(
new KeyedCodec<>("HeaderCategories", new ArrayCodec<>(Codec.STRING, String[]::new)),
(var0, var1) -> var0.headerCategories = var1,
var0 -> var0.headerCategories
)
.add()
.append(
new KeyedCodec<>("AlwaysShowInventoryHints", Codec.BOOLEAN),
(var0, var1) -> var0.alwaysShowInventoryHints = var1,
var0 -> var0.alwaysShowInventoryHints
)
.add()
.append(
new KeyedCodec<>("AllowBlockGroupCycling", Codec.BOOLEAN), (var0, var1) -> var0.allowBlockGroupCycling = var1, var0 -> var0.allowBlockGroupCycling
)
.add()
.afterDecode(StructuralCraftingBench::processConfig)
.build();
class="kw">private String[] headerCategories;
class="kw">private ObjectOpenHashSet<String> headerCategoryMap;
class="kw">private String[] sortedCategories;
class="kw">private Object2IntMap<String> categoryToIndexMap;
class="kw">private boolean allowBlockGroupCycling;
class="kw">private boolean alwaysShowInventoryHints;
class="kw">public StructuralCraftingBench() {
}
class="kw">private void processConfig() {
if (this.headerCategories != null) {
this.headerCategoryMap = new ObjectOpenHashSet();
Collections.addAll(this.headerCategoryMap, this.headerCategories);
}
if (this.sortedCategories != null) {
this.categoryToIndexMap = new Object2IntOpenHashMap();
for (int var1 = 0; var1 < this.sortedCategories.length; var1++) {
this.categoryToIndexMap.put(this.sortedCategories[var1], var1);
}
}
}
class="kw">public boolean isHeaderCategory(@Nonnull String var1) {
class="kw">return this.headerCategoryMap != null && this.headerCategoryMap.contains(var1);
}
class="kw">public int getCategoryIndex(@Nonnull String var1) {
class="kw">return this.categoryToIndexMap.getOrDefault(var1, Integer.MAX_VALUE);
}
class="kw">public boolean shouldAllowBlockGroupCycling() {
class="kw">return this.allowBlockGroupCycling;
}
class="kw">public boolean shouldAlwaysShowInventoryHints() {
class="kw">return this.alwaysShowInventoryHints;
}
@Override
class="kw">public String toString() {
class="kw">return "StructuralCraftingBench{}";
}
}