use of net.minecraft.client.entity.EntityPlayerSP in project malmo by Microsoft.
the class MissionQuitCommandsImplementation method onExecute.
@Override
protected boolean onExecute(String verb, String parameter, MissionInit missionInit) {
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
if (player == null) {
return false;
}
if (!verb.equalsIgnoreCase(MissionQuitCommand.QUIT.value())) {
return false;
}
player.sendChatMessage("Quitting mission");
this.iWantToQuit = true;
return true;
}
use of net.minecraft.client.entity.EntityPlayerSP in project MineFactoryReloaded by powercrystals.
the class MineFactoryReloadedClient method tickStart.
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
if (!(tickData[0] instanceof EntityPlayerSP)) {
return;
}
EntityPlayerSP player = (EntityPlayerSP) tickData[0];
int frontX = MathHelper.floor_double(player.posX + player.getLookVec().xCoord);
int frontY = MathHelper.floor_double(player.boundingBox.minY);
int frontZ = MathHelper.floor_double(player.posZ + player.getLookVec().zCoord);
int blockId = player.worldObj.getBlockId(frontX, frontY, frontZ);
if (blockId == MineFactoryReloadedCore.vineScaffoldBlock.blockID) {
if (player.movementInput.moveForward > 0) {
player.motionY = 0.2D;
} else if (player.isSneaking()) {
player.motionY = 0.0D;
} else {
player.motionY = -0.15D;
}
}
ItemStack equipped = player.inventory.getCurrentItem();
if (equipped != null && equipped.getItem() instanceof ItemRocketLauncher) {
Entity e = rayTrace();
if (_lastEntityOver != null && _lastEntityOver.isDead) {
_lastEntityOver = null;
_lockonTicks = 0;
} else if ((e == null || e != _lastEntityOver) && _lockonLostTicks > 0) {
_lockonLostTicks--;
} else if (e == null && _lockonLostTicks == 0) {
if (_lockonTicks > 0) {
_lockonTicks--;
}
_lastEntityOver = null;
} else if (_lastEntityOver == null) {
_lastEntityOver = e;
} else if (_lockonTicks < _lockonMax) {
_lockonTicks++;
if (_lockonTicks >= _lockonMax) {
_lockonLostTicks = _lockonLostMax;
}
} else if (e != null && e == _lastEntityOver) {
_lockonLostTicks = _lockonLostMax;
}
}
}
use of net.minecraft.client.entity.EntityPlayerSP in project RFToolsDimensions by McJty.
the class SkyRenderer method renderSky.
/**
* Renders the sky with the partial tick time. Args: partialTickTime
*/
@SideOnly(Side.CLIENT)
private static void renderSky(float partialTickTime, DimensionInformation information) {
initialize();
EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft());
WorldClient world = MinecraftTools.getWorld(Minecraft.getMinecraft());
TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager();
GlStateManager.disableTexture2D();
Vec3d vec3 = world.getSkyColor(player, partialTickTime);
float skyRed = (float) vec3.xCoord;
float skyGreen = (float) vec3.yCoord;
float skyBlue = (float) vec3.zCoord;
boolean anaglyph = Minecraft.getMinecraft().gameSettings.anaglyph;
if (anaglyph) {
float f4 = (skyRed * 30.0F + skyGreen * 59.0F + skyBlue * 11.0F) / 100.0F;
float f5 = (skyRed * 30.0F + skyGreen * 70.0F) / 100.0F;
float f6 = (skyRed * 30.0F + skyBlue * 70.0F) / 100.0F;
skyRed = f4;
skyGreen = f5;
skyBlue = f6;
}
GlStateManager.color(skyRed, skyGreen, skyBlue);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer renderer = tessellator.getBuffer();
GlStateManager.depthMask(false);
GlStateManager.enableFog();
GlStateManager.color(skyRed, skyGreen, skyBlue);
// @todo support VBO?
// if (OpenGlHelper.useVbo()) {
// skyVBO.bindBuffer();
// GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
// GL11.glVertexPointer(3, GL11.GL_FLOAT, 12, 0L);
// this.skyVBO.drawArrays(7);
// this.skyVBO.unbindBuffer();
// GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
//
// } else {
GlStateManager.callList(glSkyList);
// }
GlStateManager.disableFog();
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
RenderHelper.disableStandardItemLighting();
float[] sunsetColors = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTickTime), partialTickTime);
if (sunsetColors != null) {
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(7425);
GlStateManager.pushMatrix();
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(MathHelper.sin(world.getCelestialAngleRadians(partialTickTime)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
float f6 = sunsetColors[0];
float f7 = sunsetColors[1];
float f8 = sunsetColors[2];
if (anaglyph) {
float f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
float f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F;
float f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F;
f6 = f9;
f7 = f10;
f8 = f11;
}
renderer.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
renderer.pos(0.0D, 100.0D, 0.0D).color(f6, f7, f8, sunsetColors[3]).endVertex();
for (int j = 0; j <= 16; ++j) {
float f11 = j * (float) Math.PI * 2.0F / 16.0f;
float f12 = MathHelper.sin(f11);
float f13 = MathHelper.cos(f11);
renderer.pos((f12 * 120.0F), (f13 * 120.0F), (-f13 * 40.0F * sunsetColors[3])).color(sunsetColors[0], sunsetColors[1], sunsetColors[2], 0.0F).endVertex();
}
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.shadeModel(GL11.GL_FLAT);
}
renderCelestialBodies(partialTickTime, information, world, renderEngine, tessellator);
GlStateManager.color(0.0F, 0.0F, 0.0F);
double d0 = player.getPosition().getY() - world.getHorizon();
if (d0 < 0.0D) {
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 12.0F, 0.0F);
// @todo
// if (this.vboEnabled)
// {
// this.sky2VBO.bindBuffer();
// GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
// GL11.glVertexPointer(3, GL11.GL_FLOAT, 12, 0L);
// this.sky2VBO.drawArrays(7);
// this.sky2VBO.unbindBuffer();
// GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
// }
// else
// {
GlStateManager.callList(glSkyList2);
// GlStateManager.callList(this.glSkyList2);
// }
GlStateManager.popMatrix();
float f8 = 1.0F;
float f9 = -((float) (d0 + 65.0D));
float f10 = -f8;
renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
renderer.pos((-f8), f9, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f9, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f9, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f9, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f9, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f9, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f9, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f9, f8).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, (-f8)).color(0, 0, 0, 255).endVertex();
tessellator.draw();
}
if (world.provider.isSkyColored()) {
GlStateManager.color(skyRed * 0.2F + 0.04F, skyGreen * 0.2F + 0.04F, skyBlue * 0.6F + 0.1F);
} else {
GlStateManager.color(skyRed, skyGreen, skyBlue);
}
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, -((float) (d0 - 16.0D)), 0.0F);
GlStateManager.callList(glSkyList2);
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
}
use of net.minecraft.client.entity.EntityPlayerSP in project minecolonies by Minecolonies.
the class WindowHutGuardTower method setTarget.
/**
* Sets the target for patrolling or guarding of the guard.
*/
private void setTarget() {
final EntityPlayerSP player = this.mc.player;
final int emptySlot = player.inventory.getFirstEmptyStack();
pullInfoFromHut();
if (emptySlot == -1) {
LanguageHandler.sendPlayerMessage(player, "com.minecolonies.coremod.gui.workerHuts.noSpace");
}
if (patrolManually && task.equals(BuildingGuardTower.Task.PATROL)) {
givePlayerScepter(BuildingGuardTower.Task.PATROL);
LanguageHandler.sendPlayerMessage(player, "com.minecolonies.coremod.job.guard.tool.taskPatrol");
} else if (task.equals(BuildingGuardTower.Task.GUARD)) {
givePlayerScepter(BuildingGuardTower.Task.GUARD);
LanguageHandler.sendPlayerMessage(player, "com.minecolonies.coremod.job.guard.tool.taskGuard");
}
window.close();
}
use of net.minecraft.client.entity.EntityPlayerSP in project minecolonies by Minecolonies.
the class EventHandler method onDebugOverlay.
/**
* Event when the debug screen is opened. Event gets called by displayed
* text on the screen, we only need it when f3 is clicked.
*
* @param event {@link net.minecraftforge.client.event.RenderGameOverlayEvent.Text}
*/
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onDebugOverlay(final RenderGameOverlayEvent.Text event) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc.gameSettings.showDebugInfo) {
final WorldClient world = mc.world;
final EntityPlayerSP player = mc.player;
IColony colony = ColonyManager.getIColony(world, player.getPosition());
final double minDistance = ColonyManager.getMinimumDistanceBetweenTownHalls();
if (colony == null) {
colony = ColonyManager.getClosestIColony(world, player.getPosition());
if (colony == null || Math.sqrt(colony.getDistanceSquared(player.getPosition())) > 2 * minDistance) {
event.getLeft().add(LanguageHandler.format("com.minecolonies.coremod.gui.debugScreen.noCloseColony"));
return;
}
event.getLeft().add(LanguageHandler.format("com.minecolonies.coremod.gui.debugScreen.nextColony", (int) Math.sqrt(colony.getDistanceSquared(player.getPosition())), minDistance));
return;
}
event.getLeft().add(colony.getName() + " : " + LanguageHandler.format("com.minecolonies.coremod.gui.debugScreen.blocksFromCenter", (int) Math.sqrt(colony.getDistanceSquared(player.getPosition()))));
}
}
}
Aggregations