BlockPlacementSettings class

Пакет: com.hypixel.hytale.server.core.asset.type.blocktype.config

Файл: com/hypixel/hytale/server/core/asset/type/blocktype/config/BlockPlacementSettings.java

implements: NetworkSerializable<com.hypixel.hytale.protocol.BlockPlacementSettings>

Поля (6)

МодификаторыТипИмя
final BuilderCodec<BlockPlacementSettings> CODEC
public static final EnumCodec<BlockPlacementSettings.BlockPreviewVisibility> CODEC
public static final EnumCodec<BlockPlacementSettings.RotationMode> CODEC
ALWAYS_VISIBLE, ALWAYS_HIDDEN, DEFAULT
FACING_PLAYER, BLOCK_NORMAL, STAIR_FACING_PLAYER, DEFAULT
com.hypixel.hytale.protocol.BlockPlacementSettings var1

Методы (11)

МодификаторыВозвратСигнатура
BlockPreviewVisibility BlockPreviewVisibility()
abstract throw new IllegalArgumentExceptionthrow new IllegalArgumentException("Unknown key! " + this.wallPlacementOverrideBlockId)
abstract throw new IllegalArgumentExceptionthrow new IllegalArgumentException("Unknown key! " + this.floorPlacementOverrideBlockId)
abstract throw new IllegalArgumentExceptionthrow new IllegalArgumentException("Unknown key! " + this.ceilingPlacementOverrideBlockId)
RotationMode RotationMode()
public String getCeilingPlacementOverrideBlockIdString getCeilingPlacementOverrideBlockId()
public String getFloorPlacementOverrideBlockIdString getFloorPlacementOverrideBlockId()
public String getWallPlacementOverrideBlockIdString getWallPlacementOverrideBlockId()
if if(var1.wallPlacementOverrideBlockId == Integer.MIN_VALUE)
if if(var1.floorPlacementOverrideBlockId == Integer.MIN_VALUE)
if if(var1.ceilingPlacementOverrideBlockId == Integer.MIN_VALUE)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.blocktype.config;

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.protocol.BlockPlacementRotationMode;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import javax.annotation.Nonnull;

class="kw">public class BlockPlacementSettings class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.BlockPlacementSettings> {
   class="kw">public class="kw">static class="kw">final BuilderCodec<BlockPlacementSettings> CODEC = BuilderCodec.builder(BlockPlacementSettings.class, BlockPlacementSettings::new)
      .append(new KeyedCodec<>("AllowRotationKey", Codec.BOOLEAN), (var0, var1) -> var0.allowRotationKey = var1, var0 -> var0.allowRotationKey)
      .add()
      .<Boolean>append(new KeyedCodec<>("PlaceInEmptyBlocks", Codec.BOOLEAN), (var0, var1) -> var0.placeInEmptyBlocks = var1, var0 -> var0.placeInEmptyBlocks)
      .documentation("If this block is allowed to be placed inside other blocks with an Empty Material (destroying them).")
      .add()
      .<BlockPlacementSettings.RotationMode>append(
         new KeyedCodec<>("RotationMode", BlockPlacementSettings.RotationMode.CODEC), (var0, var1) -> var0.rotationMode = var1, var0 -> var0.rotationMode
      )
      .documentation("The mode determining the rotation of this block when placed.")
      .add()
      .<BlockPlacementSettings.BlockPreviewVisibility>append(
         new KeyedCodec<>("BlockPreviewVisibility", BlockPlacementSettings.BlockPreviewVisibility.CODEC),
         (var0, var1) -> var0.previewVisibility = var1,
         var0 -> var0.previewVisibility
      )
      .documentation("An override for the block preview visibility")
      .add()
      .append(
         new KeyedCodec<>("WallPlacementOverrideBlockId", Codec.STRING),
         (var0, var1) -> var0.wallPlacementOverrideBlockId = var1,
         var0 -> var0.wallPlacementOverrideBlockId
      )
      .add()
      .append(
         new KeyedCodec<>("FloorPlacementOverrideBlockId", Codec.STRING),
         (var0, var1) -> var0.floorPlacementOverrideBlockId = var1,
         var0 -> var0.floorPlacementOverrideBlockId
      )
      .add()
      .append(
         new KeyedCodec<>("CeilingPlacementOverrideBlockId", Codec.STRING),
         (var0, var1) -> var0.ceilingPlacementOverrideBlockId = var1,
         var0 -> var0.ceilingPlacementOverrideBlockId
      )
      .add()
      .append(new KeyedCodec<>("AllowBreakReplace", Codec.BOOLEAN), (var0, var1) -> var0.allowBreakReplace = var1, var0 -> var0.allowBreakReplace)
      .add()
      .build();
   class="kw">protected String wallPlacementOverrideBlockId;
   class="kw">protected String floorPlacementOverrideBlockId;
   class="kw">protected String ceilingPlacementOverrideBlockId;
   class="kw">private boolean allowRotationKey = true;
   class="kw">private boolean placeInEmptyBlocks;
   class="kw">private BlockPlacementSettings.BlockPreviewVisibility previewVisibility = BlockPlacementSettings.BlockPreviewVisibility.DEFAULT;
   class="kw">private BlockPlacementSettings.RotationMode rotationMode = BlockPlacementSettings.RotationMode.DEFAULT;
   class="kw">protected boolean allowBreakReplace;

   class="kw">protected BlockPlacementSettings() {
   }

   @Nonnull
   class="kw">public com.hypixel.hytale.protocol.BlockPlacementSettings toPacket() {
      com.hypixel.hytale.protocol.BlockPlacementSettings var1 = new com.hypixel.hytale.protocol.BlockPlacementSettings();
      var1.allowRotationKey = this.allowRotationKey;
      var1.placeInEmptyBlocks = this.placeInEmptyBlocks;
      var1.allowBreakReplace = this.allowBreakReplace;

      var1.previewVisibility = class="kw">switch (this.previewVisibility) {
         case null -> com.hypixel.hytale.protocol.BlockPreviewVisibility.Default;
         case DEFAULT -> com.hypixel.hytale.protocol.BlockPreviewVisibility.Default;
         case ALWAYS_HIDDEN -> com.hypixel.hytale.protocol.BlockPreviewVisibility.AlwaysHidden;
         case ALWAYS_VISIBLE -> com.hypixel.hytale.protocol.BlockPreviewVisibility.AlwaysVisible;
      };

      var1.rotationMode = class="kw">switch (this.rotationMode) {
         case null -> BlockPlacementRotationMode.Default;
         case DEFAULT -> BlockPlacementRotationMode.Default;
         case FACING_PLAYER -> BlockPlacementRotationMode.FacingPlayer;
         case STAIR_FACING_PLAYER -> BlockPlacementRotationMode.StairFacingPlayer;
         case BLOCK_NORMAL -> BlockPlacementRotationMode.BlockNormal;
      };
      var1.wallPlacementOverrideBlockId = this.wallPlacementOverrideBlockId == null ? -1 : BlockType.getAssetMap().getIndex(this.wallPlacementOverrideBlockId);
      if (var1.wallPlacementOverrideBlockId == Integer.MIN_VALUE) {
         throw new IllegalArgumentException("Unknown key! " + this.wallPlacementOverrideBlockId);
      } else {
         var1.floorPlacementOverrideBlockId = this.floorPlacementOverrideBlockId == null
            ? -1
            : BlockType.getAssetMap().getIndex(this.floorPlacementOverrideBlockId);
         if (var1.floorPlacementOverrideBlockId == Integer.MIN_VALUE) {
            throw new IllegalArgumentException("Unknown key! " + this.floorPlacementOverrideBlockId);
         } else {
            var1.ceilingPlacementOverrideBlockId = this.ceilingPlacementOverrideBlockId == null
               ? -1
               : BlockType.getAssetMap().getIndex(this.ceilingPlacementOverrideBlockId);
            if (var1.ceilingPlacementOverrideBlockId == Integer.MIN_VALUE) {
               throw new IllegalArgumentException("Unknown key! " + this.ceilingPlacementOverrideBlockId);
            } else {
               class="kw">return var1;
            }
         }
      }
   }

   class="kw">public String getWallPlacementOverrideBlockId() {
      class="kw">return this.wallPlacementOverrideBlockId;
   }

   class="kw">public String getFloorPlacementOverrideBlockId() {
      class="kw">return this.floorPlacementOverrideBlockId;
   }

   class="kw">public String getCeilingPlacementOverrideBlockId() {
      class="kw">return this.ceilingPlacementOverrideBlockId;
   }

   class="kw">public enum BlockPreviewVisibility {
      ALWAYS_VISIBLE,
      ALWAYS_HIDDEN,
      DEFAULT;

      class="kw">public class="kw">static class="kw">final EnumCodec<BlockPlacementSettings.BlockPreviewVisibility> CODEC = new EnumCodec<>(BlockPlacementSettings.BlockPreviewVisibility.class);

      BlockPreviewVisibility() {
      }
   }

   class="kw">public enum RotationMode {
      FACING_PLAYER,
      BLOCK_NORMAL,
      STAIR_FACING_PLAYER,
      DEFAULT;

      class="kw">public class="kw">static class="kw">final EnumCodec<BlockPlacementSettings.RotationMode> CODEC = new EnumCodec<>(BlockPlacementSettings.RotationMode.class);

      RotationMode() {
      }
   }
}