BlockWindow class
Пакет: com.hypixel.hytale.server.core.entity.entities.player.windows
Файл: com/hypixel/hytale/server/core/entity/entities/player/windows/BlockWindow.java
extends: Window
implements: ValidatedWindow
Поля (8)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
float |
MAX_DISTANCE |
|
World |
var3 |
|
TransformComponent |
var4 |
|
ChunkStore |
var5 |
|
Ref |
var6 |
|
BlockSection |
var7 |
|
BlockType |
var8 |
|
Item |
var9 |
Методы (9)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
double |
getMaxDistancedouble getMaxDistance() |
public |
int |
getRotationIndexint getRotationIndex() |
public |
int |
getXint getX() |
public |
int |
getYint getY() |
public |
int |
getZint getZ() |
|
|
if if(var7 == null) |
|
|
if if(var8 == null) |
public |
void |
setMaxDistancevoid setMaxDistance(double var1) |
abstract |
|
super super(var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.entity.entities.player.windows;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.protocol.packets.window.WindowType;
class="kw">import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
class="kw">import com.hypixel.hytale.server.core.asset.type.item.config.Item;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.section.BlockSection;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;
class="kw">public class="kw">abstract class BlockWindow class="kw">extends Window class="kw">implements ValidatedWindow {
class="kw">private class="kw">static class="kw">final float MAX_DISTANCE = 7.0F;
class="kw">protected class="kw">final int x;
class="kw">protected class="kw">final int y;
class="kw">protected class="kw">final int z;
@Nonnull
class="kw">protected BlockType blockType;
class="kw">protected class="kw">final int rotationIndex;
class="kw">private double maxDistance = 7.0;
class="kw">private double maxDistanceSqr = this.maxDistance * this.maxDistance;
class="kw">public BlockWindow(@Nonnull WindowType var1, int var2, int var3, int var4, int var5, @Nonnull BlockType var6) {
super(var1);
this.x = var2;
this.y = var3;
this.z = var4;
this.rotationIndex = var5;
this.blockType = var6;
}
class="kw">public int getX() {
class="kw">return this.x;
}
class="kw">public int getY() {
class="kw">return this.y;
}
class="kw">public int getZ() {
class="kw">return this.z;
}
class="kw">public int getRotationIndex() {
class="kw">return this.rotationIndex;
}
@Nonnull
class="kw">public BlockType getBlockType() {
class="kw">return this.blockType;
}
class="kw">public void setMaxDistance(double var1) {
this.maxDistance = var1;
this.maxDistanceSqr = var1 * var1;
}
class="kw">public double getMaxDistance() {
class="kw">return this.maxDistance;
}
@Override
class="kw">public boolean validate(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
World var3 = var2.getExternalData().getWorld();
TransformComponent var4 = var2.getComponent(var1, TransformComponent.getComponentType());
if (var4 != null && !(var4.getPosition().distanceSquared(this.x, this.y, this.z) > this.maxDistanceSqr)) {
ChunkStore var5 = var3.getChunkStore();
Ref var6 = var5.getChunkSectionReferenceAtBlock(this.x, this.y, this.z);
if (var6 != null && var6.isValid()) {
BlockSection var7 = var5.getStore().getComponent(var6, BlockSection.getComponentType());
if (var7 == null) {
class="kw">return false;
}
BlockType var8 = BlockType.getAssetMap().getAsset(var7.get(this.x, this.y, this.z));
if (var8 == null) {
class="kw">return false;
}
Item var9 = var8.getItem();
class="kw">return var9 == null ? false : var9.equals(this.blockType.getItem());
} else {
class="kw">return false;
}
} else {
class="kw">return false;
}
}
}