Search in sources :

Example 61 with Minecraft

use of net.minecraft.client.Minecraft in project malmo by Microsoft.

the class AuthenticationHelper method setSession.

private static boolean setSession(Session newSession) {
    // Are we in the dev environment or deployed?
    boolean devEnv = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
    // We need to know, because the member name will either be obfuscated or not.
    String sessionMemberName = devEnv ? "session" : "field_71449_j";
    // NOTE: obfuscated name may need updating if Forge changes - search for "session" in Malmo\Minecraft\build\tasklogs\retromapSources.log
    Field session;
    try {
        session = Minecraft.class.getDeclaredField(sessionMemberName);
        session.setAccessible(true);
        session.set(Minecraft.getMinecraft(), newSession);
        return true;
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    }
    return false;
}
Also used : Field(java.lang.reflect.Field) Minecraft(net.minecraft.client.Minecraft)

Example 62 with Minecraft

use of net.minecraft.client.Minecraft in project PneumaticCraft by MineMaarten.

the class GuiHelmetMainScreen method init.

public static void init() {
    instance = new GuiHelmetMainScreen();
    Minecraft minecraft = FMLClientHandler.instance().getClient();
    ScaledResolution scaledresolution = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
    int width = scaledresolution.getScaledWidth();
    int height = scaledresolution.getScaledHeight();
    instance.setWorldAndResolution(minecraft, width, height);
    for (int i = 1; i < instance.upgradePages.size(); i++) {
        page = i;
        instance.initGui();
    }
    page = 0;
    instance.init = false;
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) Minecraft(net.minecraft.client.Minecraft)

Example 63 with Minecraft

use of net.minecraft.client.Minecraft in project PneumaticCraft by MineMaarten.

the class SearchUpgradeHandler method getAnimatedStat.

@Override
@SideOnly(Side.CLIENT)
public GuiAnimatedStat getAnimatedStat() {
    if (searchInfo == null) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
        searchInfo = new GuiAnimatedStat(null, "Currently searching for:", new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_SEARCH_DAMAGE), statX != -1 ? statX : sr.getScaledWidth() - 2, statY, 0x3000AA00, null, statLeftSided);
        searchInfo.setMinDimensionsAndReset(0, 0);
    }
    return searchInfo;
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) GuiAnimatedStat(pneumaticCraft.client.gui.widget.GuiAnimatedStat) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 64 with Minecraft

use of net.minecraft.client.Minecraft in project PneumaticCraft by MineMaarten.

the class BlockTrackUpgradeHandler method getAnimatedStat.

@Override
public GuiAnimatedStat getAnimatedStat() {
    if (blockTrackInfo == null) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
        blockTrackInfo = new GuiAnimatedStat(null, "Current tracked blocks:", new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_BLOCK_TRACKER), statX != -1 ? statX : sr.getScaledWidth() - 2, statY, 0x3000AA00, null, statLeftSided);
        blockTrackInfo.setMinDimensionsAndReset(0, 0);
    }
    return blockTrackInfo;
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) GuiAnimatedStat(pneumaticCraft.client.gui.widget.GuiAnimatedStat) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft)

Example 65 with Minecraft

use of net.minecraft.client.Minecraft in project PneumaticCraft by MineMaarten.

the class EntityTrackUpgradeHandler method getAnimatedStat.

@Override
@SideOnly(Side.CLIENT)
public GuiAnimatedStat getAnimatedStat() {
    if (entityTrackInfo == null) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
        entityTrackInfo = new GuiAnimatedStat(null, "Current tracked entities:", new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_ENTITY_TRACKER), statX != -1 ? statX : sr.getScaledWidth() - 2, statY, 0x3000AA00, null, statLeftSided);
        entityTrackInfo.setMinDimensionsAndReset(0, 0);
    }
    return entityTrackInfo;
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) GuiAnimatedStat(pneumaticCraft.client.gui.widget.GuiAnimatedStat) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

Minecraft (net.minecraft.client.Minecraft)100 ItemStack (net.minecraft.item.ItemStack)17 ScaledResolution (net.minecraft.client.gui.ScaledResolution)15 EntityPlayer (net.minecraft.entity.player.EntityPlayer)15 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)10 ResourceLocation (net.minecraft.util.ResourceLocation)8 ArrayList (java.util.ArrayList)7 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)7 FontRenderer (net.minecraft.client.gui.FontRenderer)6 WorldClient (net.minecraft.client.multiplayer.WorldClient)6 World (net.minecraft.world.World)6 Tessellator (net.minecraft.client.renderer.Tessellator)5 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)5 Block (net.minecraft.block.Block)4 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)4 IRenderHandler (net.minecraftforge.client.IRenderHandler)4 SimplePageView (com.almuradev.almura.feature.guide.client.gui.SimplePageView)3 SideOnly (cpw.mods.fml.relauncher.SideOnly)3 Field (java.lang.reflect.Field)3 GuiScreen (net.minecraft.client.gui.GuiScreen)3