the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 70 lines 1.6 kB view raw
1#include "stdafx.h" 2#include "InBedChatScreen.h" 3#include "Button.h" 4#include "MultiplayerLocalPlayer.h" 5#include "..\Minecraft.World\net.minecraft.locale.h" 6#include "..\Minecraft.World\StringHelpers.h" 7 8void InBedChatScreen::init() 9{ 10 Keyboard::enableRepeatEvents(true); 11 12 Language *language = Language::getInstance(); 13 14 buttons.push_back(new Button(WAKE_UP_BUTTON, width / 2 - 100, height - 40, language->getElement(L"multiplayer.stopSleeping"))); 15 16} 17 18void InBedChatScreen::removed() 19{ 20 Keyboard::enableRepeatEvents(false); 21} 22 23void InBedChatScreen::keyPressed(wchar_t ch, int eventKey) 24{ 25 if (eventKey == Keyboard::KEY_ESCAPE) 26 { 27 sendWakeUp(); 28 } 29 else if (eventKey == Keyboard::KEY_RETURN) 30 { 31 wstring msg = trimString(message); 32 if (msg.length() > 0) 33 { 34 minecraft->player->chat(trimString(message)); 35 } 36 message = L""; 37 } 38 else 39 { 40 ChatScreen::keyPressed(ch, eventKey); 41 } 42} 43 44void InBedChatScreen::render(int xm, int ym, float a) 45{ 46 ChatScreen::render(xm, ym, a); 47} 48 49void InBedChatScreen::buttonClicked(Button *button) 50{ 51 if (button->id == WAKE_UP_BUTTON) 52 { 53 sendWakeUp(); 54 } 55 else 56 { 57 ChatScreen::buttonClicked(button); 58 } 59} 60 61void InBedChatScreen::sendWakeUp() 62{ 63 /* 4J - TODO 64 if (minecraft.player instanceof MultiplayerLocalPlayer) 65 { 66 ClientConnection connection = ((MultiplayerLocalPlayer) minecraft.player).connection; 67 connection.send(new PlayerCommandPacket(minecraft.player, PlayerCommandPacket.STOP_SLEEPING)); 68 } 69 */ 70}