Java Code Examples for net.minecraft.client.gui.GuiScreen

The following are top voted examples for showing how to use net.minecraft.client.gui.GuiScreen. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: customstuff4   File: ToolTip.java   Source Code and License 6 votes vote down vote up
private boolean isCorrectModeActive()
{
    switch (mode.toLowerCase())
    {
        case MODE_SHIFT:
            return GuiScreen.isShiftKeyDown();
        case MODE_CTRL:
            return GuiScreen.isCtrlKeyDown();
        case MODE_ALT:
            return GuiScreen.isAltKeyDown();
        case MODE_NO_SHIFT:
            return !GuiScreen.isShiftKeyDown();
        case MODE_NO_CTRL:
            return !GuiScreen.isCtrlKeyDown();
        case MODE_NO_ALT:
            return !GuiScreen.isAltKeyDown();
        default:
            return true;
    }
}
 
Example 2
Project: pnc-repressurized   File: GuiProgrammer.java   Source Code and License 6 votes vote down vote up
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
    ItemStack programmedItem = te.getIteminProgrammingSlot();
    if (nameField.isFocused() && !programmedItem.isEmpty()) {
        programmedItem.setStackDisplayName(nameField.getText());
        NetworkHandler.sendToServer(new PacketUpdateTextfield(te, 0));
    }
    super.mouseClicked(mouseX, mouseY, mouseButton);

    if (mouseButton == 1 && showingWidgetProgress == 0) {
        IProgWidget widget = programmerUnit.getHoveredWidget(mouseX, mouseY);
        if (widget != null) {
            GuiScreen screen = widget.getOptionWindow(this);
            if (screen != null) mc.displayGuiScreen(screen);
        }
    }
}
 
Example 3
Project: Backmemed   File: RealmsBridge.java   Source Code and License 6 votes vote down vote up
public GuiScreenRealmsProxy getNotificationScreen(GuiScreen p_getNotificationScreen_1_)
{
    try
    {
        this.previousScreen = p_getNotificationScreen_1_;
        Class<?> oclass = Class.forName("com.mojang.realmsclient.gui.screens.RealmsNotificationsScreen");
        Constructor<?> constructor = oclass.getDeclaredConstructor(new Class[] {RealmsScreen.class});
        constructor.setAccessible(true);
        Object object = constructor.newInstance(new Object[] {this});
        return ((RealmsScreen)object).getProxy();
    }
    catch (ClassNotFoundException var5)
    {
        LOGGER.error("Realms module missing");
    }
    catch (Exception exception)
    {
        LOGGER.error((String)"Failed to load Realms module", (Throwable)exception);
    }

    return null;
}
 
Example 4
Project: SerenityCE   File: MixinGuiScreen.java   Source Code and License 6 votes vote down vote up
@Inject(method = "drawScreen", at = @At("HEAD"), cancellable = true)
public void onDrawScreen(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
    Minecraft mc = Minecraft.getMinecraft();

    GuiScreen thisScreen = (GuiScreen) (Object) this;

    RenderGuiScreen renderGuiScreen = new RenderGuiScreen(thisScreen);
    EventManager.post(renderGuiScreen);

    if (renderGuiScreen.isCancelled()) {
        if (mc.currentScreen != null && mc.currentScreen != thisScreen) {
            mc.currentScreen.drawScreen(mouseX, mouseY, partialTicks);
        }
        ci.cancel();
    }

}
 
Example 5
Project: Bewitchment   File: ItemBrew.java   Source Code and License 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, ITooltipFlag advanced) {
	if (NBTHelper.hasTag(stack, BrewUtils.BREW_DESC)) {
		tooltip.add(TextFormatting.ITALIC + I18n.format(NBTHelper.getString(stack, BrewUtils.BREW_DESC)));
	}
	if (GuiScreen.isShiftKeyDown()) {
		tooltip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + I18n.format("tooltip.brew.data"));
		BrewUtils.addBrewTooltip(stack, tooltip);

		tooltip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + I18n.format("tooltip.potion.data"));
		BrewUtils.addPotionTooltip(stack, tooltip);
	} else {
		tooltip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + I18n.format("tooltip.shift_for_info"));
	}
}
 
Example 6
Project: Zombe-Modpack   File: Minecraft.java   Source Code and License 5 votes vote down vote up
public void setDimensionAndSpawnPlayer(int dimension)
{
    this.world.setInitialSpawnLocation();
    this.world.removeAllEntities();
    int i = 0;
    String s = null;

    if (this.player != null)
    {
        i = this.player.getEntityId();
        this.world.removeEntity(this.player);
        s = this.player.getServerBrand();
    }

    this.renderViewEntity = null;
    EntityPlayerSP entityplayersp = this.player;
    this.player = this.playerController.createClientPlayer(this.world, this.player == null ? new StatisticsManager() : this.player.getStatFileWriter());
    this.player.getDataManager().setEntryValues(entityplayersp.getDataManager().getAll());
    this.player.dimension = dimension;
    this.renderViewEntity = this.player;
    this.player.preparePlayerToSpawn();
    this.player.setServerBrand(s);
    this.world.spawnEntityInWorld(this.player);
    this.playerController.flipPlayer(this.player);
    this.player.movementInput = new MovementInputFromOptions(this.gameSettings);
    this.player.setEntityId(i);
    this.playerController.setPlayerCapabilities(this.player);
    this.player.setReducedDebug(entityplayersp.hasReducedDebug());

    if (this.currentScreen instanceof GuiGameOver)
    {
        this.displayGuiScreen((GuiScreen)null);
    }
}
 
Example 7
Project: Zombe-Modpack   File: NetHandlerPlayClient.java   Source Code and License 5 votes vote down vote up
public NetHandlerPlayClient(Minecraft mcIn, GuiScreen p_i46300_2_, NetworkManager networkManagerIn, GameProfile profileIn)
{
    this.gameController = mcIn;
    this.guiScreenServer = p_i46300_2_;
    this.netManager = networkManagerIn;
    this.profile = profileIn;
}
 
Example 8
Project: DecompiledMinecraft   File: GuiAchievements.java   Source Code and License 5 votes vote down vote up
/**
 * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
 * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
 */
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
    if (keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode())
    {
        this.mc.displayGuiScreen((GuiScreen)null);
        this.mc.setIngameFocus();
    }
    else
    {
        super.keyTyped(typedChar, keyCode);
    }
}
 
Example 9
Project: BaseClient   File: GuiAchievements.java   Source Code and License 5 votes vote down vote up
public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn)
{
    this.parentScreen = parentScreenIn;
    this.statFileWriter = statFileWriterIn;
    int i = 141;
    int j = 141;
    this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12);
    this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2);
}
 
Example 10
Project: CustomWorldGen   File: GuiScreenEvent.java   Source Code and License 5 votes vote down vote up
public DrawScreenEvent(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks)
{
    super(gui);
    this.mouseX = mouseX;
    this.mouseY = mouseY;
    this.renderPartialTicks = renderPartialTicks;
}
 
Example 11
Project: BaseClient   File: GuiStreamUnavailable.java   Source Code and License 5 votes vote down vote up
public GuiStreamUnavailable(GuiScreen parentScreenIn, GuiStreamUnavailable.Reason p_i46311_2_, List<ChatComponentTranslation> p_i46311_3_)
{
    this.field_152324_f = new ChatComponentTranslation("stream.unavailable.title", new Object[0]);
    this.field_152323_r = Lists.<String>newArrayList();
    this.parentScreen = parentScreenIn;
    this.field_152326_h = p_i46311_2_;
    this.field_152327_i = p_i46311_3_;
}
 
Example 12
Project: customstuff4   File: GuiModifier.java   Source Code and License 5 votes vote down vote up
private void modifyButton(GuiScreen gui, GuiButton button)
{
    if (text != null)
    {
        button.displayString = text;
    }

    if (width != Length.ZERO)
    {
        button.width = width.getLength(gui.width);
    }

    if (height != Length.ZERO)
    {
        button.height = height.getLength(gui.height);
    }

    if (offsetX != Length.ZERO)
    {
        button.x = getLeft(gui, button.width);
    }

    if (offsetY != Length.ZERO)
    {
        button.y = getTop(gui, button.height);
    }
}
 
Example 13
Project: DecompiledMinecraft   File: GuiConnecting.java   Source Code and License 5 votes vote down vote up
public GuiConnecting(GuiScreen p_i1181_1_, Minecraft mcIn, ServerData p_i1181_3_)
{
    this.mc = mcIn;
    this.previousGuiScreen = p_i1181_1_;
    ServerAddress serveraddress = ServerAddress.func_78860_a(p_i1181_3_.serverIP);
    mcIn.loadWorld((WorldClient)null);
    mcIn.setServerData(p_i1181_3_);
    this.connect(serveraddress.getIP(), serveraddress.getPort());
}
 
Example 14
Project: CustomWorldGen   File: GuiEditSign.java   Source Code and License 5 votes vote down vote up
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        if (button.id == 0)
        {
            this.tileSign.markDirty();
            this.mc.displayGuiScreen((GuiScreen)null);
        }
    }
}
 
Example 15
Project: BaseClient   File: Minecraft.java   Source Code and License 5 votes vote down vote up
public void setDimensionAndSpawnPlayer(int dimension)
{
    this.theWorld.setInitialSpawnLocation();
    this.theWorld.removeAllEntities();
    int i = 0;
    String s = null;

    if (this.thePlayer != null)
    {
        i = this.thePlayer.getEntityId();
        this.theWorld.removeEntity(this.thePlayer);
        s = this.thePlayer.getClientBrand();
    }

    this.renderViewEntity = null;
    EntityPlayerSP entityplayersp = this.thePlayer;
    this.thePlayer = this.playerController.func_178892_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.getStatFileWriter());
    this.thePlayer.getDataWatcher().updateWatchedObjectsFromList(entityplayersp.getDataWatcher().getAllWatched());
    this.thePlayer.dimension = dimension;
    this.renderViewEntity = this.thePlayer;
    this.thePlayer.preparePlayerToSpawn();
    this.thePlayer.setClientBrand(s);
    this.theWorld.spawnEntityInWorld(this.thePlayer);
    this.playerController.flipPlayer(this.thePlayer);
    this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings);
    this.thePlayer.setEntityId(i);
    this.playerController.setPlayerCapabilities(this.thePlayer);
    this.thePlayer.setReducedDebug(entityplayersp.hasReducedDebug());

    if (this.currentScreen instanceof GuiGameOver)
    {
        this.displayGuiScreen((GuiScreen)null);
    }
}
 
Example 16
Project: BaseClient   File: GuiAchievements.java   Source Code and License 5 votes vote down vote up
/**
 * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
 * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
 */
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
    if (keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode())
    {
        this.mc.displayGuiScreen((GuiScreen)null);
        this.mc.setIngameFocus();
    }
    else
    {
        super.keyTyped(typedChar, keyCode);
    }
}
 
Example 17
Project: Wurst-MC-1.12   File: GuiPressAKey.java   Source Code and License 5 votes vote down vote up
/**
 * Fired when a key is typed. This is the equivalent of
 * KeyListener.keyTyped(KeyEvent e).
 */
@Override
protected void keyTyped(char par1, int par2)
{
	prevScreen.setKey(Keyboard.getKeyName(par2));
	mc.displayGuiScreen((GuiScreen)prevScreen);
}
 
Example 18
Project: Wurst-MC-1.12   File: KeybindEditorScreen.java   Source Code and License 5 votes vote down vote up
public KeybindEditorScreen(GuiScreen prevScreen, String key,
	String commands)
{
	this.prevScreen = prevScreen;
	
	this.key = key;
	oldKey = key;
	oldCommands = commands;
}
 
Example 19
Project: BaseClient   File: GuiTwitchUserMode.java   Source Code and License 5 votes vote down vote up
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        if (button.id == 0)
        {
            this.stream.func_152917_b("/ban " + this.field_152337_h.displayName);
        }
        else if (button.id == 3)
        {
            this.stream.func_152917_b("/unban " + this.field_152337_h.displayName);
        }
        else if (button.id == 2)
        {
            this.stream.func_152917_b("/mod " + this.field_152337_h.displayName);
        }
        else if (button.id == 4)
        {
            this.stream.func_152917_b("/unmod " + this.field_152337_h.displayName);
        }
        else if (button.id == 1)
        {
            this.stream.func_152917_b("/timeout " + this.field_152337_h.displayName);
        }

        this.mc.displayGuiScreen((GuiScreen)null);
    }
}
 
Example 20
Project: Backmemed   File: GuiConnecting.java   Source Code and License 5 votes vote down vote up
public GuiConnecting(GuiScreen parent, Minecraft mcIn, String hostName, int port)
{
    this.mc = mcIn;
    this.previousGuiScreen = parent;
    mcIn.loadWorld((WorldClient)null);
    this.connect(hostName, port);
}
 
Example 21
Project: Never-Enough-Currency   File: GuiStockCrate.java   Source Code and License 5 votes vote down vote up
@Override
public void keyTyped(char c, int key) {
	if (c >= '0' && c <= '9') {
		if (!amount.contains(".") || amount.contains(".") && amount.substring(amount.lastIndexOf(".")).length() < 3) {
			System.out.println("WHAT");
			amount = amount.concat("" + c);
		}
	}
	if (c == '.') {
		if (!amount.isEmpty() && !amount.contains(".")) {
			amount = amount.concat("" + c);
		} else if (amount.isEmpty()) {
			amount = amount.concat("0" + c);
		}
	}
	if (key == Keyboard.KEY_BACK && amount != null && !amount.isEmpty()) {
		amount = amount.substring(0, amount.length() - 1);
	}
	if (key == Keyboard.KEY_RETURN) {
		AccountCapability cap = player.getCapability(Currency.ACCOUNT_DATA, null);
		if (amount != null && !amount.isEmpty() && Float.parseFloat(amount) <= 100000) {

			// if (!deposit.enabled) {
			// cap.addClientAmount(Float.parseFloat(amount), true);
			// CurrencyUtils.depositMoney(player, Float.parseFloat(amount));
			// } else if (!withdraw.enabled && Float.parseFloat(amount) <=
			// cap.getAmount()) {
			// cap.subtractClientAmount(Float.parseFloat(amount), true);
			// PacketDispatcher.sendToServer(new MessageSyncDrops(player,
			// Float.parseFloat(amount)));
			// }
		}
		this.mc.displayGuiScreen((GuiScreen) null);
	}
	if (key == Keyboard.KEY_E || key == Keyboard.KEY_ESCAPE) {
		this.mc.displayGuiScreen((GuiScreen) null);
	}
}
 
Example 22
Project: Backmemed   File: GuiAchievements.java   Source Code and License 5 votes vote down vote up
public GuiAchievements(GuiScreen parentScreenIn, StatisticsManager statFileWriterIn)
{
    this.parentScreen = parentScreenIn;
    this.statFileWriter = statFileWriterIn;
    int i = 141;
    int j = 141;
    this.xScrollTarget = (double)(AchievementList.OPEN_INVENTORY.displayColumn * 24 - 70 - 12);
    this.xScrollO = this.xScrollTarget;
    this.xScrollP = this.xScrollTarget;
    this.yScrollTarget = (double)(AchievementList.OPEN_INVENTORY.displayRow * 24 - 70);
    this.yScrollO = this.yScrollTarget;
    this.yScrollP = this.yScrollTarget;
}
 
Example 23
Project: CustomWorldGen   File: GuiModList.java   Source Code and License 5 votes vote down vote up
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
@Override
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        SortType type = SortType.getTypeForButton(button);

        if (type != null)
        {
            for (GuiButton b : buttonList)
            {
                if (SortType.getTypeForButton(b) != null)
                {
                    b.enabled = true;
                }
            }
            button.enabled = false;
            sorted = false;
            sortType = type;
            this.mods = modList.getMods();
        }
        else
        {
            switch (button.id)
            {
                case 6:
                {
                    this.mc.displayGuiScreen(this.mainMenu);
                    return;
                }
                case 20:
                {
                    try
                    {
                        IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
                        GuiScreen newScreen = guiFactory.mainConfigGuiClass().getConstructor(GuiScreen.class).newInstance(this);
                        this.mc.displayGuiScreen(newScreen);
                    }
                    catch (Exception e)
                    {
                        FMLLog.log(Level.ERROR, e, "There was a critical issue trying to build the config GUI for %s", selectedMod.getModId());
                    }
                    return;
                }
            }
        }
    }
    super.actionPerformed(button);
}
 
Example 24
Project: Wurst-MC-1.12   File: ServerHook.java   Source Code and License 5 votes vote down vote up
public static void reconnectToLastServer(GuiScreen prevScreen)
{
	if(lastServer == null)
		return;
	
	currentServerIP = lastServer.getServerData().serverIP;
	if(!currentServerIP.contains(":"))
		currentServerIP += ":25565";
	
	Minecraft mc = Minecraft.getMinecraft();
	mc.displayGuiScreen(
		new GuiConnecting(prevScreen, mc, lastServer.getServerData()));
}
 
Example 25
Project: DankNull   File: GuiDankNull.java   Source Code and License 5 votes vote down vote up
@Override
public void handleMouseInput() throws IOException {
	int mouseX = Mouse.getEventX() * width / mc.displayWidth;
	int mouseY = height - Mouse.getEventY() * height / mc.displayHeight - 1;
	int button = Mouse.getEventButton();

	if (Mouse.getEventButtonState()) {
		//if (GuiScreen.isCtrlKeyDown()) {
		if (GuiScreen.isAltKeyDown()) {
			if (button == 0) {
				Slot slot = getSlotAtPos(mouseX, mouseY);
				if (slot != null && !slot.getStack().isEmpty()) {
					if (!ItemUtils.areItemsEqual(DankNullUtils.getSelectedStack(getDankNullInventory()), slot.getStack())) {
						int count = 0;
						for (Slot slotHovered : inventorySlots.inventorySlots) {
							count++;
							if (slotHovered.equals(slot)) {
								DankNullUtils.setSelectedStackIndex(getDankNullInventory(), (count - 1) - 36);
								return;
							}
						}
					}
				}
			}
			//}
		}
	}
	super.handleMouseInput();
}
 
Example 26
Project: CreeperHostGui   File: GuiInvited.java   Source Code and License 5 votes vote down vote up
public GuiInvited(Invite invite, GuiScreen parent)
{
    this.invite = invite;
    this.parent = parent;
    server = new ServerListEntryPublic(new MockServerListEntryNormal(new ServerDataPublic(invite.server)));
    canConnect = invite.project == Integer.valueOf(Config.getInstance().curseProjectID);
}
 
Example 27
Project: Metalworks   File: Util.java   Source Code and License 5 votes vote down vote up
public static void drawProgressText(GuiScreen gui, int mouseX, int mouseY, int progress, int maxProgress, boolean reverse){
    if(maxProgress > 0){
        int i = (int) ((progress / (maxProgress * 1.0F)) * 100.0);
        if(reverse){
            i = 100 - i;
        }
        gui.drawHoveringText(i + "%", mouseX, mouseY);
    }
}
 
Example 28
Project: CustomWorldGen   File: FMLClientHandler.java   Source Code and License 5 votes vote down vote up
/**
 * @param player
 * @param gui
 */
public void displayGuiScreen(EntityPlayer player, GuiScreen gui)
{
    if (client.thePlayer==player && gui != null) {
        client.displayGuiScreen(gui);
    }
}
 
Example 29
Project: HardcoreRevival   File: ClientProxy.java   Source Code and License 5 votes vote down vote up
@SubscribeEvent
public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) {
	Minecraft mc = event.getGui().mc;
	if (mc.player != null && isKnockedOut && event.getGui() instanceof GuiChat) {
		GuiScreen gui = event.getGui();
		enableButtonTimer = 0;
		buttonDie = new GuiButton(-2, gui.width / 2 - 100, gui.height / 2 - 30, I18n.format("gui.hardcorerevival.die"));
		buttonDie.enabled = false;
		event.getButtonList().add(buttonDie);
	}
}
 
Example 30
Project: Lithium-Forge   File: ModCoderPackUtils.java   Source Code and License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public static GuiScreen getCurrentScreen() {
	return getMinecraft().currentScreen;
}
 
Example 31
Project: BaseClient   File: TooltipManager.java   Source Code and License 4 votes vote down vote up
public TooltipManager(GuiScreen p_i85_1_)
{
    this.guiScreen = p_i85_1_;
}
 
Example 32
Project: youtube-chat-for-minecraft   File: YouTubeConfigurationGuiFactory.java   Source Code and License 4 votes vote down vote up
@Override
public GuiScreen createConfigGui(GuiScreen parentScreen) {
  return new YouTubeConfigurationGui(parentScreen);
}
 
Example 33
Project: ServerObserver   File: Compat.java   Source Code and License 4 votes vote down vote up
@Override
public GuiScreen getParentScreen(final GuiDisconnected dcgui) {
	return dcgui.parentScreen;
}
 
Example 34
Project: bit-client   File: ClickGui.java   Source Code and License 4 votes vote down vote up
public GuiScreen getDisplayer() {
    return new ClickGuiDisplayer();
}
 
Example 35
Project: pnc-repressurized   File: GuiPastebin.java   Source Code and License 4 votes vote down vote up
public GuiPastebin(GuiScreen parentScreen, NBTTagCompound tag) {
    this(parentScreen, new NBTToJsonConverter(tag).convert());
}
 
Example 36
Project: AuthlibLoginHelper   File: AuthlibLoginHelperGuiFactory.java   Source Code and License 4 votes vote down vote up
@Override
public Class<? extends GuiScreen> mainConfigGuiClass()
{
    return Config.class;
}
 
Example 37
Project: LagGoggles   File: GuiInGameConfig.java   Source Code and License 4 votes vote down vote up
public GuiInGameConfig(GuiScreen parent) {
    super(parent, Main.MODID_LOWER, false, false, Main.MODID + " configuration", ConfigData.class);
    titleLine2 = "Hover with the mouse over a variable to see a description";
}
 
Example 38
Project: CustomWorldGen   File: NetHandlerPlayClient.java   Source Code and License 4 votes vote down vote up
public void handlePlayerPosLook(SPacketPlayerPosLook packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.thePlayer;
    double d0 = packetIn.getX();
    double d1 = packetIn.getY();
    double d2 = packetIn.getZ();
    float f = packetIn.getYaw();
    float f1 = packetIn.getPitch();

    if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.X))
    {
        d0 += entityplayer.posX;
    }
    else
    {
        entityplayer.motionX = 0.0D;
    }

    if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Y))
    {
        d1 += entityplayer.posY;
    }
    else
    {
        entityplayer.motionY = 0.0D;
    }

    if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Z))
    {
        d2 += entityplayer.posZ;
    }
    else
    {
        entityplayer.motionZ = 0.0D;
    }

    if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.X_ROT))
    {
        f1 += entityplayer.rotationPitch;
    }

    if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Y_ROT))
    {
        f += entityplayer.rotationYaw;
    }

    entityplayer.setPositionAndRotation(d0, d1, d2, f, f1);
    this.netManager.sendPacket(new CPacketConfirmTeleport(packetIn.getTeleportId()));
    this.netManager.sendPacket(new CPacketPlayer.PositionRotation(entityplayer.posX, entityplayer.getEntityBoundingBox().minY, entityplayer.posZ, entityplayer.rotationYaw, entityplayer.rotationPitch, false));

    if (!this.doneLoadingTerrain)
    {
        this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX;
        this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY;
        this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ;
        this.doneLoadingTerrain = true;
        this.gameController.displayGuiScreen((GuiScreen)null);
    }
}
 
Example 39
Project: pnc-repressurized   File: GuiLogisticsLiquidFilter.java   Source Code and License 4 votes vote down vote up
public GuiLogisticsLiquidFilter(GuiScreen parentScreen) {
    super(new ProgWidgetLiquidFilter(), null);
    this.parentScreen = parentScreen;
}
 
Example 40
Project: ElementalElaboration   File: ConfigGUI.java   Source Code and License 4 votes vote down vote up
public ConfigGUI(GuiScreen parentScreen)
{
    super(parentScreen, new ConfigElement(KorTech.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(),
            References.MODID, false, false, GuiConfig.getAbridgedConfigPath(KorTech.config.toString()));
}