RoleDebugDisplay class
Пакет: com.hypixel.hytale.server.npc.role
Файл: com/hypixel/hytale/server/npc/role/RoleDebugDisplay.java
Поля (65)
| Модификаторы | Тип | Имя |
|---|---|---|
protected |
boolean |
debugDisplayState |
|
String |
var10 |
|
|
var10 |
|
|
var10 |
|
boolean |
var10 |
|
Ref |
var11 |
|
boolean |
var11 |
|
PlayerRef |
var12 |
|
boolean |
var12 |
|
NPCEntity |
var13 |
|
boolean |
var13 |
|
String |
var14 |
|
|
var14 |
|
boolean |
var14 |
|
int |
var15 |
|
boolean |
var15 |
|
double |
var16 |
|
boolean |
var16 |
|
RoleDebugDisplay |
var17 |
|
ChunkLightData |
var18 |
|
FlockMembership |
var19 |
|
boolean |
var2 |
|
WorldTimeResource |
var20 |
|
ActiveAnimationComponent |
var21 |
|
MarkedEntitySupport |
var22 |
|
TransformComponent |
var23 |
|
DebugSupport |
var24 |
|
int |
var25 |
|
Ref |
var26 |
|
String |
var27 |
|
World |
var29 |
|
boolean |
var3 |
|
String |
var30 |
|
String |
var33 |
|
Store |
var34 |
|
InventoryComponent.Hotbar |
var35 |
|
EntityStatMap |
var36 |
|
EntityStatMap |
var37 |
|
Velocity |
var38 |
|
MarkedEntitySupport |
var39 |
|
boolean |
var4 |
|
Nameplate |
var40 |
|
BlockSection |
var41 |
|
InventoryComponent.Storage |
var42 |
|
EntityStatValue |
var43 |
|
EntityStatValue |
var44 |
|
Ref[] |
var45 |
|
Vector3d |
var46 |
|
int |
var47 |
|
int |
var49 |
|
Ref |
var5 |
|
boolean |
var5 |
|
int |
var50 |
|
Ref |
var51 |
|
int |
var52 |
|
String |
var53 |
|
String |
var54 |
|
StateSupport |
var6 |
|
boolean |
var6 |
|
double |
var7 |
|
boolean |
var7 |
|
String[] |
var8 |
|
boolean |
var8 |
|
MovementStates |
var9 |
|
boolean |
var9 |
Методы (23)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
void |
displayvoid display(@Nullable Role var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4) |
|
|
for for(int var28 = 0; var28 < var25; var28++) |
|
|
for for(int var48 = 0; var48 < var45.length; var48++) |
|
|
if if(this.debugDisplayInternalId) |
|
|
if if(this.debugDisplayName && var1 != null) |
|
|
if if(this.debugDisplayState) |
|
|
if if(this.debugDisplayFlock) |
|
|
if if(var19 != null) |
|
|
if if(this.debugDisplayTime) |
|
|
if if(this.debugDisplayAnim && var1 != null) |
|
|
if if(this.debugDisplayLockedTarget) |
|
|
if if(var11 == null) |
|
|
if if(var12 != null) |
|
|
if if(this.debugDisplayLightLevel) |
|
|
if if(this.debugDisplayFreeSlots) |
|
|
if if(this.debugDisplayHP && var1 != null) |
|
|
if if(var43 == null) |
|
|
if if(this.debugDisplayStamina && var1 != null) |
|
|
if if(var44 == null) |
|
|
if if(this.debugDisplaySpeed && var1 != null) |
|
|
if if(this.debugVisMarkedTargets) |
|
|
if if(var40 != null) |
|
|
if if(!var15 && !var2 && !var4 && !var3 && !var5 && !var6 && !var7 && !var8 && !var9 && !var10 && !var11 && !var13 && !var14 && !var12 && !var16) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.role;
class="kw">import com.hypixel.hytale.component.ArchetypeChunk;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.math.util.MathUtil;
class="kw">import com.hypixel.hytale.protocol.AnimationSlot;
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.entity.nameplate.Nameplate;
class="kw">import com.hypixel.hytale.server.core.inventory.InventoryComponent;
class="kw">import com.hypixel.hytale.server.core.modules.debug.DebugUtils;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.ActiveAnimationComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entitystats.EntityStatMap;
class="kw">import com.hypixel.hytale.server.core.modules.entitystats.EntityStatValue;
class="kw">import com.hypixel.hytale.server.core.modules.entitystats.asset.DefaultEntityStatTypes;
class="kw">import com.hypixel.hytale.server.core.modules.physics.component.Velocity;
class="kw">import com.hypixel.hytale.server.core.modules.time.WorldTimeResource;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
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.chunk.section.ChunkLightData;
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.flock.FlockMembership;
class="kw">import com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import com.hypixel.hytale.server.npc.role.support.DebugSupport;
class="kw">import com.hypixel.hytale.server.npc.role.support.MarkedEntitySupport;
class="kw">import com.hypixel.hytale.server.npc.role.support.StateSupport;
class="kw">import com.hypixel.hytale.server.npc.util.InventoryHelper;
class="kw">import com.hypixel.hytale.server.spawning.util.LightRangePredicate;
class="kw">import java.time.temporal.ChronoField;
class="kw">import java.util.EnumSet;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">public class RoleDebugDisplay {
class="kw">protected boolean debugDisplayState;
class="kw">protected boolean debugDisplayTime;
class="kw">protected boolean debugDisplayFlock;
class="kw">protected boolean debugDisplayAnim;
class="kw">protected boolean debugDisplayLockedTarget;
class="kw">protected boolean debugDisplayLightLevel;
class="kw">protected boolean debugDisplayFreeSlots;
class="kw">protected boolean debugDisplayCustom;
class="kw">protected boolean debugDisplayPathFinder;
class="kw">protected boolean debugDisplayHP;
class="kw">protected boolean debugDisplayStamina;
class="kw">protected boolean debugDisplaySpeed;
class="kw">protected boolean debugDisplayInternalId;
class="kw">protected boolean debugDisplayName;
class="kw">protected boolean debugVisMarkedTargets;
@Nonnull
class="kw">protected StringBuilder debugDisplay = new StringBuilder(20);
class="kw">private RoleDebugDisplay() {
}
class="kw">public void display(@Nullable Role var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4) {
Ref var5 = var3.getReferenceTo(var2);
if (this.debugDisplayInternalId) {
this.debugDisplay.append("ID-").append(var5.getIndex()).append(" ");
}
if (this.debugDisplayName && var1 != null) {
this.debugDisplay.append(" Role(").append(var1.getRoleName()).append(")");
}
if (this.debugDisplayState) {
StateSupport var6 = var3.getComponent(var2, StateSupport.getComponentType());
assert var6 != null;
var6.appendStateName(this.debugDisplay);
}
if (this.debugDisplayFlock) {
FlockMembership var19 = var3.getComponent(var2, FlockMembership.getComponentType());
if (var19 != null) {
if (var19.getMembershipType().isActingAsLeader()) {
this.debugDisplay.append(" LDR");
} else {
this.debugDisplay.append(" FLK");
}
}
}
WorldTimeResource var20 = var4.getResource(WorldTimeResource.getResourceType());
if (this.debugDisplayTime) {
double var7 = (double)(24 * var20.getGameDateTime().get(ChronoField.SECOND_OF_DAY)) / WorldTimeResource.SECONDS_PER_DAY;
this.debugDisplay.append(' ').append((int)(100.0 * var7) / 100.0);
}
if (this.debugDisplayAnim && var1 != null) {
ActiveAnimationComponent var21 = var3.getComponent(var2, ActiveAnimationComponent.getComponentType());
assert var21 != null;
String[] var8 = var21.getActiveAnimations();
MovementStates var9 = var3.getComponent(var2, MovementStatesComponent.getComponentType()).getMovementStates();
this.debugDisplay.append(" M:");
this.debugDisplay.append((char)(var9.idle ? 'I' : '-'));
this.debugDisplay.append((char)(var9.horizontalIdle ? 'H' : '-'));
this.debugDisplay.append((char)(var9.running ? 'R' : '-'));
this.debugDisplay.append((char)(var9.climbing ? 'C' : '-'));
this.debugDisplay.append((char)(var9.jumping ? 'J' : '-'));
this.debugDisplay.append((char)(var9.falling ? 'F' : '-'));
this.debugDisplay.append((char)(var9.crouching ? 'c' : '-'));
this.debugDisplay.append((char)(var9.flying ? 'f' : '-'));
this.debugDisplay.append((char)(var9.swimming ? 's' : '-'));
this.debugDisplay.append((char)(var9.swimJumping ? 'S' : '-'));
this.debugDisplay.append((char)(var9.onGround ? 'o' : '-'));
this.debugDisplay.append((char)(var9.inFluid ? 'w' : '-'));
String var10 = var8[AnimationSlot.Status.ordinal()];
this.debugDisplay.append(" S:").append(var10 != null ? var10 : "-");
var10 = var8[AnimationSlot.Action.ordinal()];
this.debugDisplay.append(" A:").append(var10 != null ? var10 : "-");
var10 = var8[AnimationSlot.Face.ordinal()];
this.debugDisplay.append(" F:").append(var10 != null ? var10 : "-");
}
if (this.debugDisplayLockedTarget) {
MarkedEntitySupport var22 = var3.getComponent(var2, MarkedEntitySupport.getComponentType());
assert var22 != null;
int var25 = var22.getMarkedEntitySlotCount();
for (int var28 = 0; var28 < var25; var28++) {
String var33 = var22.getSlotName(var28);
Ref var11 = var22.getMarkedEntityRef(var28);
if (var11 == null) {
this.debugDisplay.append(" T(").append(var33).append("):-");
} else {
PlayerRef var12 = var4.getComponent(var11, PlayerRef.getComponentType());
NPCEntity var13 = var4.getComponent(var11, NPCEntity.getComponentType());
if (var12 != null) {
this.debugDisplay.append(" TP(").append(var33).append("):").append(var12.getUsername());
} else if (var13 != null) {
String var14 = var13.getRoleName();
if (var14 == null || var14.isEmpty()) {
var14 = "???";
}
this.debugDisplay.append(" T(").append(var33).append("):").append(var14);
} else {
this.debugDisplay.append(" T(").append(var33).append("):?");
}
}
}
}
if (this.debugDisplayLightLevel) {
TransformComponent var23 = var3.getComponent(var2, TransformComponent.getComponentType());
assert var23 != null;
Ref var26 = var23.getSectionRef();
if (var26 != null && var26.isValid()) {
World var29 = var4.getExternalData().getWorld();
Store var34 = var29.getChunkStore().getStore();
BlockSection var41 = var34.getComponent(var26, BlockSection.getComponentType());
assert var41 != null;
Vector3d var46 = var23.getPosition();
int var49 = MathUtil.floor(var46.x());
int var52 = MathUtil.floor(var46.y());
int var15 = MathUtil.floor(var46.z());
double var16 = var20.getSunlightFactor();
ChunkLightData var18 = var41.getGlobalLight();
this.debugDisplay
.append(" LL:")
.append(LightRangePredicate.lightToPrecentage(LightRangePredicate.calculateLightValue(var41, var49, var52, var15, var16)))
.append('/')
.append(LightRangePredicate.lightToPrecentage(var18.getSkyLight(var49, var52, var15)))
.append('/')
.append(LightRangePredicate.lightToPrecentage((byte)(var18.getSkyLight(var49, var52, var15) * var16)))
.append('/')
.append(LightRangePredicate.lightToPrecentage(var18.getRedBlockLight(var49, var52, var15)))
.append('/')
.append(LightRangePredicate.lightToPrecentage(var18.getGreenBlockLight(var49, var52, var15)))
.append('/')
.append(LightRangePredicate.lightToPrecentage(var18.getBlueBlockLight(var49, var52, var15)));
}
}
DebugSupport var24 = var3.getComponent(var2, DebugSupport.getComponentType());
assert var24 != null;
String var27 = var24.pollDisplayPathfinderString();
if (this.debugDisplayPathFinder && var27 != null && !var27.isEmpty()) {
this.debugDisplay.append(!this.debugDisplay.isEmpty() ? " PF:" : "PF:").append(var27);
}
String var30 = var24.pollDisplayCustomString();
if (this.debugDisplayCustom && var30 != null && !var30.isEmpty()) {
if (!this.debugDisplay.isEmpty()) {
this.debugDisplay.append(' ');
}
this.debugDisplay.append(var30);
}
if (this.debugDisplayFreeSlots) {
InventoryComponent.Hotbar var35 = var4.getComponent(var5, InventoryComponent.Hotbar.getComponentType());
InventoryComponent.Storage var42 = var4.getComponent(var5, InventoryComponent.Storage.getComponentType());
int var47 = var35 != null ? InventoryHelper.countFreeSlots(var35.getInventory()) : 0;
int var50 = var42 != null ? InventoryHelper.countFreeSlots(var42.getInventory()) : 0;
this.debugDisplay.append(" FS:").append(var47).append('/').append(var50);
}
if (this.debugDisplayHP && var1 != null) {
EntityStatMap var36 = var3.getComponent(var2, EntityStatMap.getComponentType());
assert var36 != null;
EntityStatValue var43 = var36.get(DefaultEntityStatTypes.getHealth());
if (var43 == null) {
this.debugDisplay.append(" HP: N/A");
} else {
this.debugDisplay.append(" HP:").append(var43.get()).append('/').append(var43.getMax());
}
}
if (this.debugDisplayStamina && var1 != null) {
EntityStatMap var37 = var3.getComponent(var2, EntityStatMap.getComponentType());
assert var37 != null;
EntityStatValue var44 = var37.get(DefaultEntityStatTypes.getStamina());
if (var44 == null) {
this.debugDisplay.append(" Stamina: N/A");
} else {
this.debugDisplay.append(" Stamina:").append(var44.get()).append('/').append(var44.getMax());
}
}
if (this.debugDisplaySpeed && var1 != null) {
Velocity var38 = var3.getComponent(var2, Velocity.getComponentType());
assert var38 != null;
this.debugDisplay.append(" SPD:").append(MathUtil.round(var38.getSpeed(), 1));
}
if (this.debugVisMarkedTargets) {
MarkedEntitySupport var39 = var3.getComponent(var2, MarkedEntitySupport.getComponentType());
assert var39 != null;
Ref[] var45 = var39.getEntityTargets();
for (int var48 = 0; var48 < var45.length; var48++) {
Ref var51 = var45[var48];
if (var51 != null && var51.isValid()) {
String var53 = DebugUtils.INDEXED_COLOR_NAMES[var48 % DebugUtils.INDEXED_COLOR_NAMES.length];
String var54 = var39.getSlotName(var48);
if (!this.debugDisplay.isEmpty()) {
this.debugDisplay.append(' ');
}
this.debugDisplay.append(var53).append('(').append(var54).append(')');
}
}
}
if (!this.debugDisplay.isEmpty()) {
Nameplate var40 = var3.getComponent(var2, Nameplate.getComponentType());
if (var40 != null) {
var40.setText(this.debugDisplay.toString());
} else {
var4.addComponent(var5, Nameplate.getComponentType(), new Nameplate(this.debugDisplay.toString()));
}
this.debugDisplay.setLength(0);
}
}
@Nullable
class="kw">public class="kw">static RoleDebugDisplay create(@Nonnull EnumSet<RoleDebugFlags> var0, @Nullable RoleDebugDisplay var1) {
boolean var2 = var0.contains(RoleDebugFlags.DisplayState);
boolean var3 = var0.contains(RoleDebugFlags.DisplayTime);
boolean var4 = var0.contains(RoleDebugFlags.DisplayFlock);
boolean var5 = var0.contains(RoleDebugFlags.DisplayAnim);
boolean var6 = var0.contains(RoleDebugFlags.DisplayTarget);
boolean var7 = var0.contains(RoleDebugFlags.DisplayLightLevel);
boolean var8 = var0.contains(RoleDebugFlags.DisplayCustom);
boolean var9 = var0.contains(RoleDebugFlags.DisplayFreeSlots);
boolean var10 = var0.contains(RoleDebugFlags.Pathfinder);
boolean var11 = var0.contains(RoleDebugFlags.DisplayHP);
boolean var12 = var0.contains(RoleDebugFlags.DisplayStamina);
boolean var13 = var0.contains(RoleDebugFlags.DisplaySpeed);
boolean var14 = var0.contains(RoleDebugFlags.DisplayName);
boolean var15 = var0.contains(RoleDebugFlags.DisplayInternalId);
boolean var16 = var0.contains(RoleDebugFlags.VisMarkedTargets);
if (!var15 && !var2 && !var4 && !var3 && !var5 && !var6 && !var7 && !var8 && !var9 && !var10 && !var11 && !var13 && !var14 && !var12 && !var16) {
class="kw">return null;
}
RoleDebugDisplay var17 = var1 != null ? var1 : new RoleDebugDisplay();
var17.debugDisplayState = var2;
var17.debugDisplayTime = var3;
var17.debugDisplayFlock = var4;
var17.debugDisplayAnim = var5;
var17.debugDisplayLockedTarget = var6;
var17.debugDisplayLightLevel = var7;
var17.debugDisplayCustom = var8;
var17.debugDisplayFreeSlots = var9;
var17.debugDisplayPathFinder = var10;
var17.debugDisplayHP = var11;
var17.debugDisplayStamina = var12;
var17.debugDisplaySpeed = var13;
var17.debugDisplayInternalId = var15;
var17.debugDisplayName = var14;
var17.debugVisMarkedTargets = var16;
class="kw">return var17;
}
}