BlockPositionData class

Пакет: com.hypixel.hytale.server.core.universe.world.chunk.section.blockpositions

Файл: com/hypixel/hytale/server/core/universe/world/chunk/section/blockpositions/BlockPositionData.java

implements: IBlockPositionData

Поля (1)

МодификаторыТипИмя
final double HALF_BLOCK

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.universe.world.chunk.section.blockpositions;

class="kw">import com.hypixel.hytale.math.util.ChunkUtil;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.section.BlockSection;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.section.ChunkSectionReference;

class="kw">public class BlockPositionData class="kw">implements IBlockPositionData {
   class="kw">private class="kw">static class="kw">final double HALF_BLOCK = 0.5;
   class="kw">private int blockIndex;
   class="kw">private ChunkSectionReference section;
   class="kw">private int blockType;

   class="kw">public BlockPositionData(int var1, ChunkSectionReference var2, int var3) {
      this.blockIndex = var1;
      this.section = var2;
      this.blockType = var3;
   }

   @Override
   class="kw">public BlockSection getChunkSection() {
      class="kw">return this.section.getSection();
   }

   @Override
   class="kw">public int getBlockType() {
      class="kw">return this.blockType;
   }

   @Override
   class="kw">public int getX() {
      class="kw">return ChunkUtil.xFromIndex(this.blockIndex) + (this.section.getChunk().getX() << 5);
   }

   @Override
   class="kw">public int getY() {
      class="kw">return ChunkUtil.yFromIndex(this.blockIndex) + (this.section.getSectionIndex() << 5);
   }

   @Override
   class="kw">public int getZ() {
      class="kw">return ChunkUtil.zFromIndex(this.blockIndex) + (this.section.getChunk().getZ() << 5);
   }

   @Override
   class="kw">public double getXCentre() {
      class="kw">return this.getX() + 0.5;
   }

   @Override
   class="kw">public double getYCentre() {
      class="kw">return this.getY() + 0.5;
   }

   @Override
   class="kw">public double getZCentre() {
      class="kw">return this.getZ() + 0.5;
   }
}