本文整理汇总了Java中net.minecraftforge.fml.client.config.GuiUtils类的典型用法代码示例。如果您正苦于以下问题:Java GuiUtils类的具体用法?Java GuiUtils怎么用?Java GuiUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GuiUtils类属于net.minecraftforge.fml.client.config包,在下文中一共展示了GuiUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawTwitch
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
private static void drawTwitch()
{
if(tsize == 3){
textU = 0;
textV = 0;
}else if(tsize == 2){
textU = 0;
textV = 38;
}else if(tsize == 1){
textU = -1;
textV = 87;
}else{
textU = 0;
textV = 0;
}
GlStateManager.color(1f, 1f, 1f, 1f);
GlStateManager.enableBlend();
mc.getTextureManager().bindTexture(twitch);
GuiUtils.drawTexturedModalRect(twitchRect.x, twitchRect.y, textU, textV, twitchRect.width, twitchRect.height, 0);
}
示例2: drawLive
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
private static void drawLive()
{
if(tsize == 3){
textLU = 24;
textLV = 0;
}else if(tsize == 2){
textLU = 25;
textLV = 38;
}else if(tsize == 1){
textLU = 26;
textLV = 87;
}else{
textU = 0;
textV = 0;
}
GlStateManager.color(1f, 1f, 1f, 1f);
GlStateManager.enableBlend();
mc.getTextureManager().bindTexture(twitch);
GuiUtils.drawTexturedModalRect(twitchRect.x, twitchRect.y, textLU, textLV, twitchRect.width, twitchRect.height, 0);
}
示例3: drawTooltip
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
private static void drawTooltip(GuiScreen gui, int mouseX, int mouseY)
{
List<String> tooltip = new ArrayList<String>();
if(Twitchy.isLive) {
if (GuiScreen.isShiftKeyDown()) {
tooltip.add("Stream Title:" + " " + "\u00A79" + Twitchy.streamTitle);
tooltip.add("Current Game:" + " " + "\u00A72" + Twitchy.streamGame);
tooltip.add("Current Viewers:" + " " + "\u00A74" + Twitchy.streamViewers);
}else
tooltip.add("Click to watch " + "\u00A76" + CHANNEL + " " + "\u00A7flive on Twitch!");
if (!GuiScreen.isShiftKeyDown())
tooltip.add(TextFormatting.AQUA + I18n.format("press.for.info.name", "SHIFT"));
}else
tooltip.add("\u00A76" + CHANNEL +"'s" + "\u00A7f offline. Click to go to their channel.");
GuiUtils.drawHoveringText(tooltip, mouseX, mouseY + 20, gui.width, gui.height, -1, mc.fontRenderer);
}
示例4: drawItemStackTooltip
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
public void drawItemStackTooltip(final IGuiRenderer renderer, final int mouseX, final int mouseY,
final ItemStack stack)
{
final List<String> list = stack.getTooltip(this.mc.player, this.mc.gameSettings.advancedItemTooltips ?
ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
for (int i = 0; i < list.size(); ++i)
{
if (i == 0)
list.set(i, stack.getRarity().rarityColor + list.get(i));
else
list.set(i, TextFormatting.GRAY + list.get(i));
}
GuiUtils.drawHoveringText(stack, list, mouseX, mouseY, this.mc.displayWidth, this.mc.displayHeight,
this.mc.displayWidth, this.mc.fontRenderer);
}
示例5: drawButton
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
/**
* Draws this button to the screen.
*/
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partial){
if (this.visible) {
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int k = this.getHoverState(this.hovered);
GuiUtils.drawContinuousTexturedBox(FalloutWidgets, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
this.mouseDragged(mc, mouseX, mouseY);
int color = 15435844;
if (packedFGColour != 0) {
color = packedFGColour;
} else if (!this.enabled) {
color = 5320730;
} else if (this.hovered) {
color = 15465844;
}
String buttonText = this.displayString;
int strWidth = mc.fontRenderer.getStringWidth(buttonText);
int ellipsisWidth = mc.fontRenderer.getStringWidth("...");
if (strWidth > width - 6 && strWidth > ellipsisWidth)
buttonText = mc.fontRenderer.trimStringToWidth(buttonText, width - 6 - ellipsisWidth).trim() + "...";
this.drawCenteredString(mc.fontRenderer, buttonText, this.x + this.width / 2, this.y + (this.height - 8) / 2, color);
}
}
示例6: drawButton
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
/**
* Draws this button to the screen.
*/
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partial){
if (this.visible) {
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int k = this.getHoverState(this.hovered);
GuiUtils.drawContinuousTexturedBox(FalloutWidgets, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
this.mouseDragged(mc, mouseX, mouseY);
int color = Color_and_Etc.rawColorFromRGB(ConfigInit.colorR, ConfigInit.colorG, ConfigInit.colorB);
if (packedFGColour != 0) {
color = packedFGColour;
} else if (!this.enabled) {
} else if (this.hovered) {
}
String buttonText = this.displayString;
int strWidth = mc.fontRenderer.getStringWidth(buttonText);
int ellipsisWidth = mc.fontRenderer.getStringWidth("...");
if (strWidth > width - 6 && strWidth > ellipsisWidth)
buttonText = mc.fontRenderer.trimStringToWidth(buttonText, width - 6 - ellipsisWidth).trim() + "...";
this.drawCenteredString(mc.fontRenderer, buttonText, this.x + this.width / 2, this.y + (this.height - 8) / 2, color);
}
}
示例7: renderToolTip
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
protected void renderToolTip(ItemStack stack, int x, int y) {
List<String> list = stack.getTooltip(ClientProxy.mc.player, ClientProxy.getToolTipFlags());
for (int i = 0; i < list.size(); ++i) {
if (i == 0) {
list.set(i, stack.getRarity().rarityColor + list.get(i));
} else {
list.set(i, TextFormatting.GRAY + list.get(i));
}
}
ScaledResolution res = new ScaledResolution(ClientProxy.mc);
FontRenderer font = stack.getItem().getFontRenderer(stack);
net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(stack);
GuiUtils.drawHoveringText(list, x, y, res.getScaledWidth(), res.getScaledHeight(), res.getScaledWidth(), (font == null ? ClientProxy.mc.fontRenderer : font));
net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();
}
示例8: drawButton
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
/** Draws this button to the screen. */
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.boxWidth
&& mouseY < this.yPosition + this.height;
GuiUtils.drawContinuousTexturedBox(BUTTON_TEXTURES, this.xPosition, this.yPosition, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2,
2, this.zLevel);
this.mouseDragged(mc, mouseX, mouseY);
int color = 14737632;
if (packedFGColour != 0) {
color = packedFGColour;
} else if (!this.enabled) {
color = 10526880;
}
if (this.isChecked())
this.drawCenteredString(mc.fontRendererObj, checkStr, this.xPosition + this.boxWidth / 2 + 1, this.yPosition + 1, 14737632);
}
}
示例9: draw
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
@Override
public void draw(int x, int y, int mouseX, int mouseY, float partialTicks) {
GlStateManager.color(1, 1, 1, 1);
hovered = mouseX >= x && mouseY >= y && mouseX < x + 32 && mouseY < y + 16;
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GuiUtils.drawContinuousTexturedBox(buttonLocation, x, y, 0, hovered ? 86 : 66, 32, 16, 200, 20, 3,
partialTicks);
GlStateManager.disableDepth();
Minecraft.getMinecraft().getTextureManager().bindTexture(arrowLocation);
Gui.drawModalRectWithCustomSizedTexture(x + 8, y, isExpanded ? 16 : 0, hovered ? 16 : 0, 16, 16, 32, 32);
GlStateManager.enableDepth();
if (isExpanded)
child.draw(x, y + 18, mouseX, mouseY, partialTicks);
}
示例10: CommandSlotList
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
/**
* Constructs a list
*
* @param instantiator
* - how to create a new entry, when the user presses a + button
* @param children
* - pre-existing entries
*/
public CommandSlotList(Supplier<E> instantiator, E... children) {
super();
this.supplier = instantiator;
for (E child : children) {
addEntry(child);
}
addChild(appendButton = new CommandSlotButton(20, 20, "+", Translate.GUI_COMMANDEDITOR_LIST_APPEND) {
{
setTextColor(GuiUtils.getColorCode('2', true));
}
@Override
public void onPress() {
addEntry(CommandSlotList.this.supplier.get());
}
});
}
示例11: Entry
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
public Entry(int ind) {
this.ind = ind;
addChild(insertButton = new CommandSlotButton(20, 20, "+", insertHoverText) {
{
setTextColor(GuiUtils.getColorCode('2', true));
}
@Override
public void onPress() {
addEntry(Entry.this.ind, supplier.get());
}
});
addChild(removeButton = new CommandSlotButton(20, 20, "x", removeHoverText) {
{
setTextColor(GuiUtils.getColorCode('c', true));
}
@Override
public void onPress() {
removeEntry(Entry.this.ind);
}
});
addChild(entries.get(ind));
}
示例12: drawGuiContainerBackgroundLayer
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
/*
* Draw Panel + Player Inventory Slots
*/
Minecraft.getMinecraft().getTextureManager().bindTexture(guiTexture);
int offset = Config.dark_theme ? 0 : 44;
GuiUtils.drawContinuousTexturedBox(guiLeft, guiTop, offset, 0, ContainerAdvancedMachine.panelWidth, ContainerAdvancedMachine.panelHeight, 44, 44, 20, 0);
offset = Config.dark_theme ? 134 : 44;
drawTexturedModalRect(guiLeft + ContainerAdvancedMachine.panelWidth / 2 - 176 / 2, guiTop + ContainerAdvancedMachine.panelHeight - 3, 0, offset, 176, 90);
/*
* Draw app background
*/
if (machineContainer.activeApp != null) {
machineContainer.activeApp.gui.drawBackground(this, partialTicks, mouseX, mouseY);
}
}
示例13: drawButton
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partial) {
if (this.visible) {
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int k = this.getHoverState(this.hovered);
GuiUtils.drawContinuousTexturedBox(BUTTON_TEXTURES, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
this.mouseDragged(mc, mouseX, mouseY);
GlStateManager.pushMatrix();
if (this.icon.isEmpty()) {
this.icon = new ItemStack(Blocks.STONE);
}
ItemRenderHelper.renderItem(this.x + this.width / 2, this.y + this.height / 2, icon);
GlStateManager.popMatrix();
}
}
示例14: BaseEntry
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
public BaseEntry() {
super(Direction.HORIZONTAL);
setFillHorizontal();
iconStatus = new GuiImage(16, 16, TEXTURE_CONFIG_ICONS);
iconStatus.setCenteredVertical();
label = new GuiLabel("");
label.setCenteredVertical();
label.setShadowDisabled();
buttonUndo = new GuiButtonGlyph(DEFAULT_ENTRY_HEIGHT, DEFAULT_ENTRY_HEIGHT, GuiUtils.UNDO_CHAR, 1.0f);
buttonUndo.setCenteredVertical();
buttonUndo.setAction(this::undoChanges);
buttonReset = new GuiButtonGlyph(DEFAULT_ENTRY_HEIGHT, DEFAULT_ENTRY_HEIGHT, GuiUtils.RESET_CHAR, 1.0f);
buttonReset.setCenteredVertical();
buttonReset.setAction(this::setToDefault);
}
示例15: drawIcon
import net.minecraftforge.fml.client.config.GuiUtils; //导入依赖的package包/类
private static void drawIcon()
{
if(!Twitchy.persistantIcon && !Twitchy.isLive) return;
GlStateManager.color(1f, 1f, 1f, 1f);
GlStateManager.enableBlend();
mc.getTextureManager().bindTexture(twitch);
GuiUtils.drawTexturedModalRect(twitchRect.x, twitchRect.y, textU, textV, twitchRect.width, twitchRect.height, 0);
if(Twitchy.isLive)
GuiUtils.drawTexturedModalRect(twitchRect.x, twitchRect.y, textLU, textLV, twitchRect.width, twitchRect.height, 0);
}