use of com.chattriggers.ctjs.minecraft.wrappers.objects.PlayerMP in project ct.js by ChatTriggers.
the class WorldListener method updatePlayerList.
@SubscribeEvent
public void updatePlayerList(TickEvent.ClientTickEvent event) {
for (PlayerMP player : World.getAllPlayers()) {
if (!this.playerList.contains(player.getName())) {
this.playerList.add(player.getName());
TriggerType.PLAYER_JOIN.triggerAll(player);
break;
}
}
String currentPlayer;
for (String player : this.playerList) {
currentPlayer = player;
try {
World.getPlayerByName(player);
} catch (Exception exception) {
this.playerList.remove(currentPlayer);
TriggerType.PLAYER_LEAVE.triggerAll(currentPlayer);
break;
}
}
}
use of com.chattriggers.ctjs.minecraft.wrappers.objects.PlayerMP in project ct.js by ChatTriggers.
the class Renderer method drawPlayer.
/**
* Render the player model on to the screen
*
* @param player the player to render
* @param x the x position on the screen
* @param y the y position on the screen
* @param rotate whether or not the drawn player should rotate
*/
public static void drawPlayer(Object player, int x, int y, boolean rotate) {
float mouseX = -30;
float mouseY = 0;
EntityLivingBase ent = Player.getPlayer();
if (player instanceof PlayerMP)
ent = ((PlayerMP) player).getPlayer();
GlStateManager.enableColorMaterial();
RenderHelper.enableStandardItemLighting();
float f = ent.renderYawOffset;
float f1 = ent.rotationYaw;
float f2 = ent.rotationPitch;
float f3 = ent.prevRotationYawHead;
float f4 = ent.rotationYawHead;
GlStateManager.translate((float) x, (float) y, 50.0F);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-45.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-((float) Math.atan((double) (mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
if (!rotate) {
ent.renderYawOffset = (float) Math.atan((double) (mouseX / 40.0F)) * 20.0F;
ent.rotationYaw = (float) Math.atan((double) (mouseX / 40.0F)) * 40.0F;
ent.rotationPitch = -((float) Math.atan((double) (mouseY / 40.0F))) * 20.0F;
ent.rotationYawHead = ent.rotationYaw;
ent.prevRotationYawHead = ent.rotationYaw;
}
GlStateManager.translate(0.0F, 0.0F, 0.0F);
RenderManager rendermanager = Client.getMinecraft().getRenderManager();
rendermanager.setPlayerViewY(180.0F);
rendermanager.setRenderShadow(false);
rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
rendermanager.setRenderShadow(true);
ent.renderYawOffset = f;
ent.rotationYaw = f1;
ent.rotationPitch = f2;
ent.prevRotationYawHead = f3;
ent.rotationYawHead = f4;
RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GlStateManager.disableTexture2D();
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
}
Aggregations