BlockInspectPhysicsCommand.java
package com.hypixel.hytale.server.core.universe.world.commands.block;
import com.hypixel.hytale.common.util.CompletableFutureUtil;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.math.util.ChunkUtil;
import com.hypixel.hytale.math.util.MathUtil;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3f;
import com.hypixel.hytale.protocol.GameMode;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
import com.hypixel.hytale.server.core.blocktype.component.BlockPhysics;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.arguments.system.FlagArg;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractPlayerCommand;
import com.hypixel.hytale.server.core.modules.debug.DebugUtils;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public class BlockInspectPhysicsCommand extends {
Message.translation();
Message.translation();
.withFlagArg(, );
{
(, );
.setPermissionGroup((GameMode));
}
{
(TransformComponent)store.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
transformComponent.getPosition();
(Boolean).ALL.get(context);
MathUtil.floor(position.getX());
MathUtil.floor(position.getZ());
MathUtil.floor(position.getY());
ChunkUtil.chunkCoordinate(x);
ChunkUtil.chunkCoordinate(y);
ChunkUtil.chunkCoordinate(z);
CompletableFutureUtil._catch(world.getChunkStore().getChunkSectionReferenceAsync(chunkX, chunkY, chunkZ).thenAcceptAsync((chunk) -> {
Store<ChunkStore> chunkStore = chunk.getStore();
(BlockPhysics)chunkStore.getComponent(chunk, BlockPhysics.getComponentType());
(blockPhysics == ) {
playerRef.sendMessage(MESSAGE_COMMANDS_BLOCK_INSPECT_PHYS_NO_BLOCKS);
} {
(()ChunkUtil.minBlock(chunkX), ()ChunkUtil.minBlock(chunkY), ()ChunkUtil.minBlock(chunkZ));
( ; idx < ; ++idx) {
blockPhysics.get(idx);
(supportValue != || all) {
ChunkUtil.xFromIndex(idx);
ChunkUtil.yFromIndex(idx);
ChunkUtil.zFromIndex(idx);
(()bx, ()by, ()bz);
pos.add(, , );
pos.add(offset);
Vector3f colour;
(supportValue == ) {
colour = (, , );
} {
world.getBlockType(pos.toVector3i());
(!block.hasSupport()) {
(supportValue == ) {
;
}
colour = (, , );
} (block.getMaxSupportDistance() != ) {
()supportValue / ()block.getMaxSupportDistance();
colour = (len, , - len);
} {
colour = (, , );
}
}
DebugUtils.addCube(((ChunkStore)chunkStore.getExternalData()).getWorld(), pos, colour, , );
}
}
playerRef.sendMessage(MESSAGE_COMMANDS_BLOCK_INSPECT_PHYS_DONE);
}
}, world));
}
}