Match enum
Пакет: com.hypixel.hytale.server.core.asset.type.blocktype.config
Файл: com/hypixel/hytale/server/core/asset/type/blocktype/config/RequiredBlockFaceSupport.java
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
|
public static final EnumCodec<RequiredBlockFaceSupport.Match> |
CODEC |
|
IGNORED,
REQUIRED, |
DISALLOWED |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.blocktype.config;
class="kw">import com.hypixel.hytale.assetstore.AssetRegistry;
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.codec.codecs.array.ArrayCodec;
class="kw">import com.hypixel.hytale.common.util.ArrayUtil;
class="kw">import com.hypixel.hytale.math.vector.Vector3iUtil;
class="kw">import com.hypixel.hytale.protocol.SupportMatch;
class="kw">import com.hypixel.hytale.server.core.asset.type.blockset.config.BlockSet;
class="kw">import com.hypixel.hytale.server.core.asset.type.fluid.Fluid;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import java.util.Arrays;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3i;
class="kw">public class RequiredBlockFaceSupport class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.RequiredBlockFaceSupport> {
class="kw">public class="kw">static class="kw">final BuilderCodec<RequiredBlockFaceSupport> CODEC = BuilderCodec.builder(RequiredBlockFaceSupport.class, RequiredBlockFaceSupport::new)
.append(new KeyedCodec<>("FaceType", Codec.STRING), (var0, var1) -> var0.faceType = var1, var0 -> var0.faceType)
.documentation("Can be any string. Compared with FaceType in \"Supporting\" of other blocks. A LOT of blocks use 'Full'.")
.add()
.addField(new KeyedCodec<>("SelfFaceType", Codec.STRING), (var0, var1) -> var0.selfFaceType = var1, var0 -> var0.selfFaceType)
.addField(new KeyedCodec<>("BlockSetId", Codec.STRING), (var0, var1) -> var0.blockSetId = var1, var0 -> var0.blockSetId)
.addField(new KeyedCodec<>("BlockTypeId", Codec.STRING), (var0, var1) -> var0.blockTypeId = var1, var0 -> var0.blockTypeId)
.addField(new KeyedCodec<>("FluidId", Codec.STRING), (var0, var1) -> var0.fluidId = var1, var0 -> var0.fluidId)
.addField(new KeyedCodec<>("MatchSelf", RequiredBlockFaceSupport.Match.CODEC), (var0, var1) -> var0.matchSelf = var1, var0 -> var0.matchSelf)
.addField(new KeyedCodec<>("Support", RequiredBlockFaceSupport.Match.CODEC), (var0, var1) -> var0.support = var1, var0 -> var0.support)
.addField(
new KeyedCodec<>("AllowSupportPropagation", Codec.BOOLEAN), (var0, var1) -> var0.allowSupportPropagation = var1, var0 -> var0.allowSupportPropagation
)
.addField(new KeyedCodec<>("Rotate", Codec.BOOLEAN), (var0, var1) -> var0.rotate = var1, var0 -> var0.rotate)
.addField(new KeyedCodec<>("Filler", new ArrayCodec<>(Vector3iUtil.CODEC, Vector3i[]::new)), (var0, var1) -> var0.filler = var1, var0 -> var0.filler)
.append(new KeyedCodec<>("TagId", Codec.STRING), (var0, var1) -> var0.tagId = var1, var0 -> var0.tagId)
.add()
.afterDecode(var0 -> {
if (var0.blockSetId != null) {
int var1 = BlockSet.getAssetMap().getIndex(var0.blockSetId);
if (var1 == Integer.MIN_VALUE) {
throw new IllegalArgumentException("Unknown key! " + var0.blockSetId);
}
var0.blockSetIndex = var1;
}
if (var0.tagId != null) {
var0.tagIndex = AssetRegistry.getOrCreateTagIndex(var0.tagId);
}
})
.build();
class="kw">protected String faceType;
class="kw">protected String selfFaceType;
class="kw">protected String blockSetId;
class="kw">protected int blockSetIndex = Integer.MIN_VALUE;
class="kw">protected String blockTypeId;
class="kw">protected String fluidId;
class="kw">protected RequiredBlockFaceSupport.Match matchSelf = RequiredBlockFaceSupport.Match.IGNORED;
class="kw">protected String tagId;
class="kw">protected int tagIndex = Integer.MIN_VALUE;
class="kw">protected RequiredBlockFaceSupport.Match support = RequiredBlockFaceSupport.Match.REQUIRED;
class="kw">protected boolean allowSupportPropagation = true;
class="kw">protected boolean rotate = true;
class="kw">protected Vector3i[] filler;
class="kw">public RequiredBlockFaceSupport() {
}
class="kw">public RequiredBlockFaceSupport(String var1) {
this.faceType = var1;
}
class="kw">public RequiredBlockFaceSupport(
String var1,
String var2,
String var3,
String var4,
String var5,
RequiredBlockFaceSupport.Match var6,
RequiredBlockFaceSupport.Match var7,
boolean var8,
boolean var9,
Vector3i[] var10,
String var11,
int var12
) {
this.faceType = var1;
this.selfFaceType = var2;
this.blockSetId = var3;
this.blockTypeId = var4;
this.fluidId = var5;
this.matchSelf = var6;
this.support = var7;
this.allowSupportPropagation = var8;
this.rotate = var9;
this.filler = var10;
this.tagId = var11;
this.tagIndex = var12;
}
class="kw">public String getFaceType() {
class="kw">return this.faceType;
}
class="kw">public String getSelfFaceType() {
class="kw">return this.selfFaceType;
}
class="kw">public String getBlockSetId() {
class="kw">return this.blockSetId;
}
class="kw">public int getBlockSetIndex() {
class="kw">return this.blockSetIndex;
}
class="kw">public String getBlockTypeId() {
class="kw">return this.blockTypeId;
}
class="kw">public String getFluidId() {
class="kw">return this.fluidId;
}
class="kw">public RequiredBlockFaceSupport.Match getMatchSelf() {
class="kw">return this.matchSelf;
}
class="kw">public RequiredBlockFaceSupport.Match getSupport() {
class="kw">return this.support;
}
class="kw">public boolean allowsSupportPropagation() {
class="kw">return this.allowSupportPropagation;
}
class="kw">public boolean isRotated() {
class="kw">return this.rotate;
}
class="kw">public Vector3i[] getFiller() {
class="kw">return this.filler;
}
class="kw">public boolean isAppliedToFiller(Vector3i var1) {
class="kw">return this.filler == null || ArrayUtil.contains(this.filler, var1);
}
class="kw">public String getTagId() {
class="kw">return this.tagId;
}
class="kw">public int getTagIndex() {
class="kw">return this.tagIndex;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "RequiredBlockFaceSupport{faceType='"
+ this.faceType
+ "', selfFaceType='"
+ this.selfFaceType
+ "', blockSetId='"
+ this.blockSetId
+ "', blockTypeId="
+ this.blockTypeId
+ ", fluidId="
+ this.fluidId
+ ", matchSelf="
+ this.matchSelf
+ ", support="
+ this.support
+ ", allowSupportPropagation="
+ this.allowSupportPropagation
+ ", rotate="
+ this.rotate
+ ", filler="
+ Arrays.toString(this.filler)
+ ", tagId="
+ this.tagId
+ "}";
}
@Nonnull
class="kw">public class="kw">static RequiredBlockFaceSupport rotate(@Nonnull RequiredBlockFaceSupport var0, @Nonnull Rotation var1, @Nonnull Rotation var2, @Nonnull Rotation var3) {
Vector3i[] var4 = ArrayUtil.copyAndMutate(var0.filler, var3x -> Rotation.rotate(var3x, var1, var2, var3), Vector3i[]::new);
class="kw">return new RequiredBlockFaceSupport(
var0.faceType,
var0.selfFaceType,
var0.blockSetId,
var0.blockTypeId,
var0.fluidId,
var0.matchSelf,
var0.support,
var0.allowSupportPropagation,
var0.rotate,
var4,
var0.tagId,
var0.tagIndex
);
}
@Nonnull
class="kw">public com.hypixel.hytale.protocol.RequiredBlockFaceSupport toPacket() {
com.hypixel.hytale.protocol.RequiredBlockFaceSupport var1 = new com.hypixel.hytale.protocol.RequiredBlockFaceSupport();
var1.faceType = this.faceType;
var1.selfFaceType = this.selfFaceType;
var1.tagIndex = this.tagIndex;
var1.blockTypeId = this.blockTypeId == null ? -1 : BlockType.getAssetMap().getIndex(this.blockTypeId);
if (var1.blockTypeId == Integer.MIN_VALUE) {
throw new IllegalArgumentException("Unknown key! " + this.blockTypeId);
}
var1.fluidId = this.fluidId == null ? -1 : Fluid.getAssetMap().getIndex(this.fluidId);
if (var1.fluidId == Integer.MIN_VALUE) {
throw new IllegalArgumentException("Unknown key! " + this.fluidId);
}
var1.allowSupportPropagation = this.allowSupportPropagation;
var1.rotate = this.rotate;
var1.blockSetId = this.blockSetId;
var1.support = class="kw">switch (this.support) {
case IGNORED -> SupportMatch.Ignored;
case REQUIRED -> SupportMatch.Required;
case DISALLOWED -> SupportMatch.Disallowed;
};
var1.matchSelf = class="kw">switch (this.matchSelf) {
case IGNORED -> SupportMatch.Ignored;
case REQUIRED -> SupportMatch.Required;
case DISALLOWED -> SupportMatch.Disallowed;
};
if (this.filler != null) {
com.hypixel.hytale.protocol.Vector3i[] var2 = new com.hypixel.hytale.protocol.Vector3i[this.filler.length];
for (int var3 = 0; var3 < this.filler.length; var3++) {
Vector3i var4 = this.filler[var3];
var2[var3] = new com.hypixel.hytale.protocol.Vector3i(var4.x, var4.y, var4.z);
}
var1.filler = var2;
}
class="kw">return var1;
}
class="kw">public enum Match {
IGNORED,
REQUIRED,
DISALLOWED;
class="kw">public class="kw">static class="kw">final EnumCodec<RequiredBlockFaceSupport.Match> CODEC = new EnumCodec<>(RequiredBlockFaceSupport.Match.class);
Match() {
}
}
}