DebugShapeArrowCommand.java
package com.hypixel.hytale.server.core.modules.debug.commands;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.math.matrix.Matrix4d;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3f;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.asset.type.model.config.Model;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractPlayerCommand;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.modules.debug.DebugUtils;
import com.hypixel.hytale.server.core.modules.entity.component.HeadRotation;
import com.hypixel.hytale.server.core.modules.entity.component.ModelComponent;
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.EntityStore;
import java.util.concurrent.ThreadLocalRandom;
import javax.annotation.Nonnull;
public class DebugShapeArrowCommand extends AbstractPlayerCommand {
@Nonnull
private static Message.translation();
{
(, );
}
{
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent != ;
(TransformComponent)store.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
transformComponent.getPosition();
(ModelComponent)store.getComponent(ref, ModelComponent.getComponentType());
modelComponent != ;
modelComponent.getModel();
(HeadRotation)store.getComponent(ref, HeadRotation.getComponentType());
headRotationComponent != ;
headRotationComponent.getRotation();
headRotation.getYaw();
headRotation.getPitch();
();
model != ? model.getEyeHeight(ref, store) : ;
ThreadLocalRandom.current();
(random.nextFloat(), random.nextFloat(), random.nextFloat());
();
matrix.identity();
matrix.translate(pos.x, pos.y + ()eyeHeight, pos.z);
matrix.rotateAxis(()(-lookYaw), , , , tmp);
matrix.rotateAxis( - ()lookPitch, , , , tmp);
DebugUtils.addArrow(world, matrix, color, , , );
context.sendMessage(MESSAGE_COMMANDS_DEBUG_SHAPE_ARROW_SUCCESS);
}
}