BlockToolData class
Пакет: com.hypixel.hytale.server.core.asset.type.blocktype.config
Файл: com/hypixel/hytale/server/core/asset/type/blocktype/config/BlockGathering.java
Поля (5)
| Модификаторы | Тип | Имя |
|---|---|---|
|
public static final BuilderCodec<BlockGathering.BlockToolData> |
CODEC |
|
protected String |
dropListId |
|
protected String |
itemId |
|
protected String |
stateId |
|
protected String |
typeId |
Методы (4)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
public String |
getDropListIdpublic String getDropListId() |
|
public String |
getItemIdpublic String getItemId() |
|
public String |
getStateIdpublic String getStateId() |
|
public String |
getTypeIdpublic String getTypeId() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.blocktype.config;
class="kw">import com.hypixel.hytale.assetstore.codec.ContainedAssetCodec;
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 com.hypixel.hytale.codec.schema.metadata.AllowEmptyObject;
class="kw">import com.hypixel.hytale.server.core.asset.type.item.config.Item;
class="kw">import com.hypixel.hytale.server.core.asset.type.item.config.ItemDropList;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
class="kw">import java.util.Collections;
class="kw">import java.util.Map;
class="kw">import javax.annotation.Nonnull;
class="kw">public class BlockGathering class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.BlockGathering> {
class="kw">public class="kw">static class="kw">final BuilderCodec<BlockGathering> CODEC = BuilderCodec.builder(BlockGathering.class, BlockGathering::new)
.append(new KeyedCodec<>("Breaking", BlockBreakingDropType.CODEC), (var0, var1) -> var0.breaking = var1, var0 -> var0.breaking)
.metadata(AllowEmptyObject.INSTANCE)
.add()
.<HarvestingDropType>append(new KeyedCodec<>("Harvest", HarvestingDropType.CODEC), (var0, var1) -> var0.harvest = var1, var0 -> var0.harvest)
.metadata(AllowEmptyObject.INSTANCE)
.add()
.<SoftBlockDropType>append(new KeyedCodec<>("Soft", SoftBlockDropType.CODEC), (var0, var1) -> var0.soft = var1, var0 -> var0.soft)
.metadata(AllowEmptyObject.INSTANCE)
.add()
.<PhysicsDropType>append(new KeyedCodec<>("Physics", PhysicsDropType.CODEC), (var0, var1) -> var0.physics = var1, var0 -> var0.physics)
.metadata(AllowEmptyObject.INSTANCE)
.add()
.<BlockGathering.BlockToolData[]>append(
new KeyedCodec<>("Tools", new ArrayCodec<>(BlockGathering.BlockToolData.CODEC, BlockGathering.BlockToolData[]::new)),
(var0, var1) -> var0.toolDataRaw = var1,
var0 -> var0.toolDataRaw
)
.metadata(AllowEmptyObject.INSTANCE)
.add()
.<Boolean>appendInherited(
new KeyedCodec<>("UseDefaultDropWhenPlaced", Codec.BOOLEAN),
(var0, var1) -> var0.useDefaultDropWhenPlaced = var1,
var0 -> var0.useDefaultDropWhenPlaced,
(var0, var1) -> var0.useDefaultDropWhenPlaced = var1.useDefaultDropWhenPlaced
)
.documentation("If this is set then player placed blocks will use the class="kw">default drop behaviour instead of using the droplists.")
.add()
.afterDecode(var0 -> {
if (var0.toolDataRaw != null) {
var0.toolData = new Object2ObjectOpenHashMap();
for (BlockGathering.BlockToolData var4 : var0.toolDataRaw) {
var0.toolData.put(var4.getTypeId(), var4);
}
}
})
.build();
class="kw">protected BlockBreakingDropType breaking;
class="kw">protected HarvestingDropType harvest;
class="kw">protected SoftBlockDropType soft;
class="kw">protected PhysicsDropType physics;
class="kw">protected BlockGathering.BlockToolData[] toolDataRaw;
@Nonnull
class="kw">protected Map<String, BlockGathering.BlockToolData> toolData = Collections.emptyMap();
class="kw">protected boolean useDefaultDropWhenPlaced = false;
class="kw">protected BlockGathering() {
}
@Nonnull
class="kw">public com.hypixel.hytale.protocol.BlockGathering toPacket() {
com.hypixel.hytale.protocol.BlockGathering var1 = new com.hypixel.hytale.protocol.BlockGathering();
if (this.breaking != null) {
var1.breaking = this.breaking.toPacket();
}
if (this.harvest != null) {
var1.harvest = this.harvest.toPacket();
}
if (this.soft != null) {
var1.soft = this.soft.toPacket();
}
class="kw">return var1;
}
class="kw">public BlockBreakingDropType getBreaking() {
class="kw">return this.breaking;
}
class="kw">public HarvestingDropType getHarvest() {
class="kw">return this.harvest;
}
class="kw">public SoftBlockDropType getSoft() {
class="kw">return this.soft;
}
class="kw">public boolean isHarvestable() {
class="kw">return this.harvest != null;
}
class="kw">public boolean isSoft() {
class="kw">return this.soft != null;
}
class="kw">public PhysicsDropType getPhysics() {
class="kw">return this.physics;
}
class="kw">public boolean shouldUseDefaultDropWhenPlaced() {
class="kw">return this.useDefaultDropWhenPlaced;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "BlockGathering{breaking=" + this.breaking + ", harvest=" + this.harvest + ", soft=" + this.soft + "}";
}
@Nonnull
class="kw">public Map<String, BlockGathering.BlockToolData> getToolData() {
class="kw">return this.toolData;
}
class="kw">public class="kw">static class BlockToolData {
class="kw">public class="kw">static class="kw">final BuilderCodec<BlockGathering.BlockToolData> CODEC = BuilderCodec.builder(
BlockGathering.BlockToolData.class, BlockGathering.BlockToolData::new
)
.append(new KeyedCodec<>("Type", Codec.STRING), (var0, var1) -> var0.typeId = var1, var0 -> var0.typeId)
.metadata(AllowEmptyObject.INSTANCE)
.add()
.<String>append(new KeyedCodec<>("State", Codec.STRING), (var0, var1) -> var0.stateId = var1, var0 -> var0.stateId)
.metadata(AllowEmptyObject.INSTANCE)
.add()
.<String>append(new KeyedCodec<>("ItemId", Codec.STRING), (var0, var1) -> var0.itemId = var1, var0 -> var0.itemId)
.addValidatorLate(() -> Item.VALIDATOR_CACHE.getValidator().late())
.add()
.<String>append(
new KeyedCodec<>("DropList", new ContainedAssetCodec<>(ItemDropList.class, ItemDropList.CODEC)),
(var0, var1) -> var0.dropListId = var1,
var0 -> var0.dropListId
)
.addValidatorLate(() -> ItemDropList.VALIDATOR_CACHE.getValidator().late())
.add()
.build();
class="kw">protected String typeId;
class="kw">protected String stateId;
class="kw">protected String itemId;
class="kw">protected String dropListId;
class="kw">public BlockToolData() {
}
class="kw">public String getTypeId() {
class="kw">return this.typeId;
}
class="kw">public String getStateId() {
class="kw">return this.stateId;
}
class="kw">public String getItemId() {
class="kw">return this.itemId;
}
class="kw">public String getDropListId() {
class="kw">return this.dropListId;
}
}
}