LivingEntity class
Пакет: com.hypixel.hytale.server.core.entity
Файл: com/hypixel/hytale/server/core/entity/LivingEntity.java
extends: Entity
Поля (11)
| Модификаторы | Тип | Имя |
|---|---|---|
|
MovementStatesComponent |
var10 |
|
MovementStates |
var11 |
|
boolean |
var12 |
|
Vector3d |
var13 |
|
World |
var2 |
|
Transform |
var3 |
|
Vector3d |
var4 |
|
ChunkStore |
var5 |
|
long |
var6 |
|
Ref |
var8 |
|
TransformComponent |
var9 |
Методы (9)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
double |
getCurrentFallDistancedouble getCurrentFallDistance() |
public |
Inventory |
getInventoryInventory getInventory() |
static |
long |
getPackedMaterialAndFluidAtBreathingHeightlong getPackedMaterialAndFluidAtBreathingHeight(@Nonnull Ref<EntityStore> var0, @Nonnull ComponentAccessor<EntityStore> var1) |
|
|
if if(var0.inventory == null) |
|
|
if if(this.inventory != null) |
|
|
if if(var12) |
|
|
if if(!var11.onGround) |
public |
void |
setCurrentFallDistancevoid setCurrentFallDistance(double var1) |
abstract |
|
super super(var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.entity;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.math.util.ChunkUtil;
class="kw">import com.hypixel.hytale.math.util.MathUtil;
class="kw">import com.hypixel.hytale.math.vector.Transform;
class="kw">import com.hypixel.hytale.protocol.BlockMaterial;
class="kw">import com.hypixel.hytale.protocol.MovementStates;
class="kw">import com.hypixel.hytale.server.core.entity.movement.MovementStatesComponent;
class="kw">import com.hypixel.hytale.server.core.inventory.Inventory;
class="kw">import com.hypixel.hytale.server.core.inventory.ItemStack;
class="kw">import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
class="kw">import com.hypixel.hytale.server.core.inventory.transaction.ItemStackSlotTransaction;
class="kw">import com.hypixel.hytale.server.core.modules.collision.WorldUtil;
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.storage.ChunkStore;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.core.util.TargetUtil;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">public class="kw">abstract class LivingEntity class="kw">extends Entity {
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<LivingEntity> CODEC = BuilderCodec.abstractBuilder(LivingEntity.class, Entity.CODEC)
.append(new KeyedCodec<>("Inventory", Inventory.CODEC), (var0, var1, var2) -> var0.setInventory(var1), (var0, var1) -> var0.inventory)
.add()
.afterDecode(var0 -> {
if (var0.inventory == null) {
var0.setInventory(new Inventory());
}
})
.build();
class="kw">public class="kw">static class="kw">final int DEFAULT_ITEM_THROW_SPEED = 6;
class="kw">private Inventory inventory;
class="kw">protected double currentFallDistance;
class="kw">public LivingEntity() {
this.setInventory(new Inventory());
}
class="kw">public LivingEntity(@Nonnull World var1) {
super(var1);
this.setInventory(new Inventory());
}
class="kw">public class="kw">static long getPackedMaterialAndFluidAtBreathingHeight(@Nonnull Ref<EntityStore> var0, @Nonnull ComponentAccessor<EntityStore> var1) {
World var2 = var1.getExternalData().getWorld();
Transform var3 = TargetUtil.getLook(var0, var1);
Vector3d var4 = var3.getPosition();
ChunkStore var5 = var2.getChunkStore();
long var6 = ChunkUtil.indexChunkFromBlock(var4.x, var4.z);
Ref var8 = var5.getChunkReference(var6);
class="kw">return var8 != null && var8.isValid()
? WorldUtil.getPackedMaterialAndFluidAtPosition(var8, var5.getStore(), var4.x, var4.y, var4.z)
: MathUtil.packLong(BlockMaterial.Empty.ordinal(), 0);
}
class="kw">public Inventory getInventory() {
class="kw">return this.inventory;
}
@Nonnull
class="kw">private Inventory setInventory(Inventory var1) {
if (this.inventory != null) {
this.inventory.unregister();
}
var1.setEntity(this);
this.inventory = var1;
class="kw">return var1;
}
@Override
class="kw">public void moveTo(@Nonnull Ref<EntityStore> var1, double var2, double var4, double var6, @Nonnull ComponentAccessor<EntityStore> var8) {
TransformComponent var9 = var8.getComponent(var1, TransformComponent.getComponentType());
assert var9 != null;
MovementStatesComponent var10 = var8.getComponent(var1, MovementStatesComponent.getComponentType());
assert var10 != null;
MovementStates var11 = var10.getMovementStates();
boolean var12 = !var11.inFluid && !var11.climbing && !var11.flying && !var11.gliding;
if (var12) {
Vector3d var13 = var9.getPosition();
if (!var11.onGround) {
if (var13.y() > var4) {
this.currentFallDistance = this.currentFallDistance + (var13.y() - var4);
}
} else {
this.currentFallDistance = 0.0;
}
} else {
this.currentFallDistance = 0.0;
}
super.moveTo(var1, var2, var4, var6, var8);
}
@Deprecated(forRemoval = true)
@Nullable
class="kw">public ItemStackSlotTransaction updateItemStackDurability(
@Nonnull Ref<EntityStore> var1, @Nonnull ItemStack var2, ItemContainer var3, int var4, double var5, @Nonnull ComponentAccessor<EntityStore> var7
) {
class="kw">return ItemUtils.updateItemStackDurability(var1, var2, var3, var4, var5, var7);
}
class="kw">public double getCurrentFallDistance() {
class="kw">return this.currentFallDistance;
}
class="kw">public void setCurrentFallDistance(double var1) {
this.currentFallDistance = var1;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "LivingEntity{" + super.toString() + "}";
}
}