SoftBlockDropType class
Пакет: com.hypixel.hytale.server.core.asset.type.blocktype.config
Файл: com/hypixel/hytale/server/core/asset/type/blocktype/config/SoftBlockDropType.java
implements: NetworkSerializable<SoftBlock>
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<SoftBlockDropType> |
CODEC |
|
SoftBlock |
var1 |
Методы (4)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
String |
getDropListIdString getDropListId() |
public |
String |
getItemIdString getItemId() |
|
|
if if(this.itemId != null) |
public |
boolean |
isWeaponBreakableboolean isWeaponBreakable() |
Исходный код
Показать/скрыть
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.protocol.SoftBlock;
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 javax.annotation.Nonnull;
class="kw">public class SoftBlockDropType class="kw">implements NetworkSerializable<SoftBlock> {
class="kw">public class="kw">static class="kw">final BuilderCodec<SoftBlockDropType> CODEC = BuilderCodec.builder(SoftBlockDropType.class, SoftBlockDropType::new)
.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()
.append(new KeyedCodec<>("IsWeaponBreakable", Codec.BOOLEAN), (var0, var1) -> var0.isWeaponBreakable = var1, var0 -> var0.isWeaponBreakable)
.add()
.build();
class="kw">protected String itemId;
class="kw">protected String dropListId;
class="kw">protected boolean isWeaponBreakable = true;
class="kw">public SoftBlockDropType(String var1, String var2, boolean var3) {
this.itemId = var1;
this.dropListId = var2;
this.isWeaponBreakable = var3;
}
class="kw">protected SoftBlockDropType() {
}
@Nonnull
class="kw">public SoftBlock toPacket() {
SoftBlock var1 = new SoftBlock();
if (this.itemId != null) {
var1.itemId = this.itemId.toString();
}
var1.dropListId = this.dropListId;
var1.isWeaponBreakable = this.isWeaponBreakable;
class="kw">return var1;
}
class="kw">public String getItemId() {
class="kw">return this.itemId;
}
class="kw">public String getDropListId() {
class="kw">return this.dropListId;
}
class="kw">public boolean isWeaponBreakable() {
class="kw">return this.isWeaponBreakable;
}
@Nonnull
class="kw">public SoftBlockDropType withoutDrops() {
class="kw">return new SoftBlockDropType(null, null, this.isWeaponBreakable);
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "SoftBlockDropType{itemId=" + this.itemId + ", dropListId='" + this.dropListId + "', isWeaponBreakable=" + this.isWeaponBreakable + "}";
}
}