Search in sources :

Example 1 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project malmo by Microsoft.

the class CommandForWheeledRobotNavigationImplementation method onRenderTick.

/** Called for each screen redraw - approximately three times as often as the other tick events, 
     * under normal conditions.<br>
     * This is where we want to update our yaw/pitch, in order to get smooth panning etc
     * (which is how Minecraft itself does it).
     * The speed of the render ticks is not guaranteed, and can vary from machine to machine, so
     * we try to account for this in the calculations.
     * @param ev the RenderTickEvent object for this tick
     */
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev) {
    if (ev.phase == Phase.START) {
        if (this.isOverriding()) {
            EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
            if (player != null) {
                updateYawAndPitch();
                player.rotationPitch = this.mCameraPitch;
                player.rotationYaw = this.mYaw;
            }
        }
    }
}
Also used : EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project GregTech by GregTechCE.

the class UIFactory method initClientUI.

@SideOnly(Side.CLIENT)
public final void initClientUI(PacketBuffer serializedHolder, int windowId) {
    E holder = readHolderFromSyncData(serializedHolder);
    Minecraft minecraft = Minecraft.getMinecraft();
    EntityPlayerSP entityPlayer = minecraft.player;
    ModularUI<E> uiTemplate = createUITemplate(holder, entityPlayer);
    uiTemplate.initWidgets();
    minecraft.addScheduledTask(() -> {
        minecraft.displayGuiScreen(new ModularUIGui(uiTemplate));
        entityPlayer.openContainer.windowId = windowId;
    });
}
Also used : EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) Minecraft(net.minecraft.client.Minecraft) ModularUIGui(gregtech.api.gui.impl.ModularUIGui) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project Almura by AlmuraDev.

the class ClientboundExchangeOpenResponsePacketHandler method handleMessage.

@Override
public void handleMessage(ClientboundExchangeOpenResponsePacket message, RemoteConnection connection, Platform.Type side) {
    if (side.isClient()) {
        final Minecraft client = Minecraft.getMinecraft();
        if (PacketUtil.checkThreadAndEnqueue(client, message, this, connection, side)) {
            final EntityPlayerSP player = client.player;
            final WorldClient world = client.world;
            if (world != null) {
                new ExchangeGUI(player, world, player.getPosition()).display();
            }
        }
    }
}
Also used : ExchangeGUI(com.almuradev.almura.feature.exchange.client.gui.ExchangeGUI) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) Minecraft(net.minecraft.client.Minecraft) WorldClient(net.minecraft.client.multiplayer.WorldClient)

Example 4 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project ForestryMC by ForestryMC.

the class ItemHabitatLocator method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, @Nullable World world, List<String> list, ITooltipFlag flag) {
    super.addInformation(itemstack, world, list, flag);
    Minecraft minecraft = Minecraft.getMinecraft();
    if (world != null && minecraft.player != null) {
        EntityPlayerSP player = minecraft.player;
        Biome currentBiome = player.world.getBiome(player.getPosition());
        float temperatureValue = ClimateUtil.getTemperature(world, player.getPosition());
        EnumTemperature temperature = EnumTemperature.getFromValue(temperatureValue);
        EnumHumidity humidity = EnumHumidity.getFromValue(ClimateUtil.getHumidity(world, player.getPosition()));
        list.add(Translator.translateToLocal("for.gui.currentBiome") + ": " + currentBiome.getBiomeName());
        list.add(Translator.translateToLocal("for.gui.temperature") + ": " + AlleleManager.climateHelper.toDisplay(temperature));
        list.add(Translator.translateToLocal("for.gui.humidity") + ": " + AlleleManager.climateHelper.toDisplay(humidity));
    }
}
Also used : Biome(net.minecraft.world.biome.Biome) EnumHumidity(forestry.api.core.EnumHumidity) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) Minecraft(net.minecraft.client.Minecraft) EnumTemperature(forestry.api.core.EnumTemperature) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 5 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project Hyperium by HyperiumClient.

the class UniversalUtil method addChatMessage.

private static void addChatMessage(Object component) {
    EntityPlayerSP thePlayer = autotip.getMinecraft().thePlayer;
    thePlayer.addChatMessage((IChatComponent) component);
}
Also used : EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Aggregations

EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)155 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)30 Minecraft (net.minecraft.client.Minecraft)28 ItemStack (net.minecraft.item.ItemStack)26 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)23 Entity (net.minecraft.entity.Entity)21 BlockPos (net.minecraft.util.math.BlockPos)20 EntityPlayer (net.minecraft.entity.player.EntityPlayer)13 TileEntity (net.minecraft.tileentity.TileEntity)11 WorldClient (net.minecraft.client.multiplayer.WorldClient)10 IBlockState (net.minecraft.block.state.IBlockState)9 Tessellator (net.minecraft.client.renderer.Tessellator)9 GCPlayerStatsClient (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient)8 Item (net.minecraft.item.Item)7 ArrayList (java.util.ArrayList)6 EntityLivingBase (net.minecraft.entity.EntityLivingBase)6 World (net.minecraft.world.World)6 UUID (java.util.UUID)5 Block (net.minecraft.block.Block)5 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)5