use of net.minecraft.client.Minecraft in project watson by totemo.
the class Chat method serverChat.
// --------------------------------------------------------------------------
/**
* Send a chat message to the server.
*
* @param message the text to display.
*/
public static void serverChat(String message) {
try {
Minecraft mc = Minecraft.getMinecraft();
mc.thePlayer.sendChatMessage(message);
} catch (Exception ex) {
Log.exception(Level.SEVERE, "Sending chat to the server.", ex);
}
}
use of net.minecraft.client.Minecraft in project watson by totemo.
the class WatsonConfigPanel method mousePressed.
// --------------------------------------------------------------------------
/**
* @see com.mumfrey.liteloader.modconfig.ConfigPanel#mousePressed(com.mumfrey.liteloader.modconfig.ConfigPanelHost,
* int, int, int)
*/
@Override
public void mousePressed(ConfigPanelHost host, int mouseX, int mouseY, int mouseButton) {
if (_focusedControl != null && _focusedControl instanceof KeyBindingButton) {
KeyBindingButton button = (KeyBindingButton) _focusedControl;
// A control is capturing all input. Set a bound key.
int keyCode = (mouseButton == 0) ? MouseButton.MOUSE_LEFT.getCode() : (mouseButton == 1) ? MouseButton.MOUSE_RIGHT.getCode() : MouseButton.MOUSE_MIDDLE.getCode();
setModifiedKeyBinding(button.getKeyBinding(), keyCode);
} else {
Minecraft mc = Minecraft.getMinecraft();
// Iterate over all the controls and pass the mouse press to the control
for (GuiButton control : _keyButtons) {
// enabled and visible, and the mouse coords are within the control.
if (control.mousePressed(mc, mouseX, mouseY)) {
control.playPressSound(mc.getSoundHandler());
Runnable handler = _handlers.get(control.id);
if (handler != null) {
handler.run();
}
break;
}
}
// for
}
// no control has focus
}
use of net.minecraft.client.Minecraft in project watson by totemo.
the class WatsonConfigPanel method getRowHeight.
// setModifiedKeyBinding
// --------------------------------------------------------------------------
/**
* Return the distance in pixels between the top of one row of controls and
* the top of the next.
*
* @return the distance in pixels between the top of one row of controls and
* the top of the next.
*/
protected int getRowHeight() {
if (_rowHeight == 0) {
Minecraft mc = Minecraft.getMinecraft();
FontRenderer fr = mc.fontRendererObj;
_rowHeight = (int) (fr.FONT_HEIGHT * 2.75);
}
return _rowHeight;
}
use of net.minecraft.client.Minecraft in project watson by totemo.
the class WatsonGuiScreen method initGui.
// --------------------------------------------------------------------------
/**
* @see GuiScreen#initGui()
*/
@SuppressWarnings("unchecked")
@Override
public void initGui() {
Minecraft mc = Minecraft.getMinecraft();
FontRenderer fr = mc.fontRendererObj;
_rowHeight = (int) (fr.FONT_HEIGHT * 2.75);
int startY = height / 2 - 4 * _rowHeight;
int currentRow = 0;
buttonList.clear();
buttonList.add(new GuiButton(ID_SHOW_WATSON, width / 2 - 175, startY + currentRow * _rowHeight, 150, 20, getButtonLabel(ID_SHOW_WATSON)));
buttonList.add(new GuiButton(ID_CLEAR_EDITS, width / 2 + 25, startY + currentRow++ * _rowHeight, 150, 20, getButtonLabel(ID_CLEAR_EDITS)));
buttonList.add(new GuiButton(ID_SHOW_VECTORS, width / 2 - 175, startY + currentRow * _rowHeight, 150, 20, getButtonLabel(ID_SHOW_VECTORS)));
GuiResponder sliderResponder = new GuiPageButtonList.GuiResponder() {
@Override
public void onTick(int id, float value) {
// Update the display when the slider slides. Save the new length in
// the configuration when the GUI closes.
DisplaySettings ds = Controller.instance.getDisplaySettings();
ds.setMinVectorLength((int) value, false);
}
@Override
public void func_175321_a(int id, boolean value) {
}
@Override
public void func_175319_a(int id, String value) {
}
};
Configuration config = Configuration.instance;
GuiSlider slider = new GuiSlider(sliderResponder, ID_MIN_VECTOR_LENGTH, width / 2 + 25, startY + currentRow++ * _rowHeight, "Min Vector Length", 0, 20, config.getVectorLength(), new GuiSlider.FormatHelper() {
@Override
public String getText(int id, String name, float value) {
return "Min Vector Length: " + Integer.toString((int) value);
}
});
buttonList.add(slider);
buttonList.add(new GuiButton(ID_SHOW_LABELS, width / 2 - 175, startY + currentRow * _rowHeight, 150, 20, getButtonLabel(ID_SHOW_LABELS)));
buttonList.add(new GuiButton(ID_LABEL_ORDER, width / 2 + 25, startY + currentRow++ * _rowHeight, 150, 20, getButtonLabel(ID_LABEL_ORDER)));
buttonList.add(new GuiButton(ID_SHOW_ANNOTATIONS, width / 2 - 175, startY + currentRow * _rowHeight, 150, 20, getButtonLabel(ID_SHOW_ANNOTATIONS)));
buttonList.add(new GuiButton(ID_SHOW_SELECTION, width / 2 + 25, startY + currentRow++ * _rowHeight, 150, 20, getButtonLabel(ID_SHOW_SELECTION)));
buttonList.add(new GuiOptionButton(ID_DONE, width / 2 - 40, startY + (currentRow + 2) * _rowHeight, 80, 20, I18n.format("gui.done", new Object[0])));
enableButtons();
}
use of net.minecraft.client.Minecraft in project ICBM-Classic by BuiltBrokenModding.
the class TextureTracker method updateAnimation.
@Override
public void updateAnimation() {
Minecraft minecraft = Minecraft.getMinecraft();
World world = minecraft.theWorld;
EntityPlayer player = minecraft.thePlayer;
double angel = 0;
if (world != null) {
double xDifference = 0;
double zDifference = 0;
ItemStack itemStack = player.getCurrentEquippedItem();
if (itemStack != null) {
if (itemStack.getItem() instanceof ItemTracker) {
Entity trackingEntity = ((ItemTracker) itemStack.getItem()).getTrackingEntity(FMLClientHandler.instance().getClient().theWorld, itemStack);
if (trackingEntity != null) {
xDifference = trackingEntity.posX - player.posX;
zDifference = trackingEntity.posZ - player.posZ;
}
}
}
player.rotationYaw %= 360.0D;
angel = -((player.rotationYaw - 90.0D) * Math.PI / 180.0D - Math.atan2(zDifference, xDifference));
}
double d6;
for (d6 = angel - this.currentAngle; d6 < -Math.PI; d6 += (Math.PI * 2D)) {
;
}
while (d6 >= Math.PI) {
d6 -= (Math.PI * 2D);
}
if (d6 < -1.0D) {
d6 = -1.0D;
}
if (d6 > 1.0D) {
d6 = 1.0D;
}
this.angleDelta += d6 * 0.1D;
this.angleDelta *= 0.8D;
this.currentAngle += this.angleDelta;
int i;
for (i = (int) ((this.currentAngle / (Math.PI * 2D) + 1.0D) * this.framesTextureData.size()) % this.framesTextureData.size(); i < 0; i = (i + this.framesTextureData.size()) % this.framesTextureData.size()) {
;
}
if (i != this.frameCounter) {
this.frameCounter = i;
TextureUtil.uploadTextureMipmap((int[][]) this.framesTextureData.get(this.frameCounter), this.width, this.height, this.originX, this.originY, false, false);
}
}
Aggregations