本文整理汇总了Java中codechicken.lib.gui.GuiDraw类的典型用法代码示例。如果您正苦于以下问题:Java GuiDraw类的具体用法?Java GuiDraw怎么用?Java GuiDraw使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuiDraw类属于codechicken.lib.gui包,在下文中一共展示了GuiDraw类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawForeground
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@Override
public void drawForeground(int recipe) {
super.drawForeground(recipe);
CachedRecipe tmp = arecipes.get(recipe);
if (tmp != null && tmp instanceof BasicTradeHandler.CachedTradeRecipe) {
CachedTradeRecipe rec = (CachedTradeRecipe) tmp;
if (!rec.isUsage()) {
GuiDraw.fontRenderer.drawString("Min:", (int) (176 / 2.0f - 153 / 2.0f + 10), 10, 4210752);
GuiDraw.fontRenderer.drawString("Max:", (int) (176 / 2.0f - 153 / 2.0f + 38), 10, 4210752);
GuiDraw.fontRenderer.drawString("Sells:", (int) (176 / 2.0f - 153 / 2.0f + 98), 10, 4210752);
GuiDraw.drawRect((int) (176 / 2.0f - 153 / 2.0f) + 126, 20, 18, 18, 0xFFC6C6C6);
} else {
GuiDraw.fontRenderer.drawString("Min:", (int) (176 / 2.0f - 153 / 2.0f + 98), 10, 4210752);
GuiDraw.fontRenderer.drawString("Max:", (int) (176 / 2.0f - 153 / 2.0f + 126), 10, 4210752);
GuiDraw.fontRenderer.drawString("Buys:", (int) (176 / 2.0f - 153 / 2.0f + 10), 10, 4210752);
GuiDraw.drawRect((int) (176 / 2.0f - 153 / 2.0f) + 38, 20, 18, 18, 0xFFC6C6C6);
}
}
}
示例2: drawBackground
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@Override
public void drawBackground(int recipe)
{
int progress = this.ticksPassed % 144;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(RefineryRecipeHandler.refineryGuiTexture);
GuiDraw.drawTexturedModalRect(-2, 0, 3, 4, 168, 64);
if (progress < 104 && progress > 40)
{
GuiDraw.drawTexturedModalRect(2, 42, 176, 6, 16, 20);
}
else if (progress < 124)
{
GuiDraw.drawTexturedModalRect(148, 42, 176 + 16, 6, 16, 20);
}
GuiDraw.drawTexturedModalRect(21, 21, 0, 186, progress, 20);
}
示例3: drawBackground
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@Override
public void drawBackground(int recipe)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(IngotCompressorRecipeHandler.ingotCompressorTexture);
GuiDraw.drawTexturedModalRect(20, 25, 18, 17, 137, 78);
if (IngotCompressorRecipeHandler.ticksPassed % 70 > 26)
{
GuiDraw.drawTexturedModalRect(103, 36, 176, 0, 17, 13);
}
GuiDraw.drawTexturedModalRect(79, 44, 176, 13, Math.min(IngotCompressorRecipeHandler.ticksPassed % 70, 53), 17);
int yOffset = (int) Math.floor(IngotCompressorRecipeHandler.ticksPassed % 48 * 0.29166666666666666666666666666667D);
GuiDraw.drawTexturedModalRect(83, 35 + yOffset, 176, 30 + yOffset, 14, 14 - yOffset);
}
示例4: drawItems
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
private void drawItems() {
Dimension d = GuiDraw.displayRes();
GlStateManager.matrixMode(GL11.GL_PROJECTION);
GlStateManager.loadIdentity();
GlStateManager.ortho(0, d.width*16D/iconSize, d.height*16D/iconSize, 0, 1000, 3000);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.clearColor(0, 0, 0, 0);
GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
int rows = d.height / boxSize;
int cols = d.width / boxSize;
int fit = rows*cols;
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableRescaleNormal();
GlStateManager.color(1, 1, 1, 1);
for(int i = 0; drawIndex < ItemPanel.items.size() && i < fit; drawIndex++, i++) {
int x = i%cols * 18;
int y = i/cols * 18;
GuiContainerManager.drawItem(x+1, y+1, ItemPanel.items.get(drawIndex));
}
GL11.glFlush();
}
示例5: drawExtras
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@Override
public void drawExtras(int recipe) {
CachedIEVeinStatRecipe crecipe = (CachedIEVeinStatRecipe) this.arecipes.get(recipe);
OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
int stringLength1 = GuiDraw.getStringWidth(I18n.format("gtnop.gui.nei.weightedChance") + ": ");
int stringLength2 = GuiDraw.getStringWidth("40%");
int beginXCoord = (stringLength1+stringLength2)/2;
GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.ieVeinComponent") + ": ", 2, 31, 0x404040, false);
GuiDraw.drawStringR("40.00%", beginXCoord+5, 44, 0x404040, false);
GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2+stringLength1, 44, 0x404040, false);
GuiDraw.drawStringR("40.00%", beginXCoord+5, 57, 0x404040, false);
GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2+stringLength1, 57, 0x404040, false);
GuiDraw.drawStringR("15.00%", beginXCoord+5, 70, 0x404040, false);
GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2+stringLength1, 70, 0x404040, false);
GuiDraw.drawStringR("5.00%", beginXCoord+5, 83, 0x404040, false);
GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2+stringLength1, 83, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedIEChance, 2, 96, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.fromMod") + ": " + "Immersive Engineering", 2, 109, 0x404040, false);
GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false);
}
示例6: onGuiMouseEventpre
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@SubscribeEvent (priority = EventPriority.LOWEST, receiveCanceled = true)//We need to be called before JEI.
public void onGuiMouseEventpre(MouseInputEvent.Pre event) {
if (Mouse.getEventButton() == -1 || event.getGui() == null || !Mouse.getEventButtonState()) {
return;
}
Point mouse = GuiDraw.getMousePosition();
int eventButton = Mouse.getEventButton();
if (JEIIntegrationManager.searchBoxOwner == EnumItemBrowser.JEI) {
GuiTextFieldFilter fieldFilter = JEIIntegrationManager.getTextFieldFilter();
if (fieldFilter != null && fieldFilter.isMouseOver(mouse.x, mouse.y)) {
if (eventButton == 0) {
if (fieldFilter.isFocused() && (System.currentTimeMillis() - lastSearchBoxClickTime < 500)) {//double click
NEIClientConfig.world.nbt.setBoolean("searchinventories", !SearchField.searchInventories());
NEIClientConfig.world.saveNBT();
lastSearchBoxClickTime = 0L;
} else {
lastSearchBoxClickTime = System.currentTimeMillis();
}
} else if (eventButton == 1) {
NEIClientConfig.setSearchExpression("", false);
LayoutManager.searchField.setText("", false);
}
}
}
}
示例7: onDrawBackgroundEventPost
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@SubscribeEvent (priority = EventPriority.LOWEST)//We need to be called after JEI as this is is a render overlay.
public void onDrawBackgroundEventPost(BackgroundDrawnEvent event) {
GuiTextFieldFilter fieldFilter = JEIIntegrationManager.getTextFieldFilter();
if (!ClientUtils.inWorld() || !isNEIInWorld() || fieldFilter == null || !SearchField.searchInventories() || JEIIntegrationManager.searchBoxOwner != EnumItemBrowser.JEI || JEIIntegrationManager.itemPanelOwner == EnumItemBrowser.NEI) {
return;
}
int x = fieldFilter.x;
int y = fieldFilter.y;
int h = fieldFilter.height;
int w = fieldFilter.width;
GuiDraw.drawGradientRect(x - 1, y - 1, 1, h + 2, 0xFFFFFF00, 0xFFC0B000);//Left
GuiDraw.drawGradientRect(x - 1, y - 1, w + 2, 1, 0xFFFFFF00, 0xFFC0B000);//Top
GuiDraw.drawGradientRect(x + w, y - 1, 1, h + 2, 0xFFFFFF00, 0xFFC0B000);//Left
GuiDraw.drawGradientRect(x - 1, y + h, w + 2, 1, 0xFFFFFF00, 0xFFC0B000);//Bottom
}
示例8: drawScreenPost
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@SubscribeEvent
public void drawScreenPost(DrawScreenEvent.Post event) {
GuiScreen screen = event.getGui();
Point mousePos = GuiDraw.getMousePosition();
List<String> tooltip = new LinkedList<>();
ItemStack stack = ItemStack.EMPTY;
if (instanceTooltipHandlers != null) {
instanceTooltipHandlers.forEach(handler -> handler.handleTooltip(screen, mousePos.x, mousePos.y, tooltip));
}
if (screen instanceof GuiContainer) {
if (tooltip.isEmpty() && GuiHelper.shouldShowTooltip(screen)) {
GuiContainer container = ((GuiContainer) screen);
stack = GuiHelper.getStackMouseOver(container, false);
if (!stack.isEmpty()) {
tooltip.clear();
tooltip.addAll(GuiHelper.itemDisplayNameMultiline(stack, container, false));
}
}
}
GuiDraw.drawMultiLineTip(stack, mousePos.x + 10, mousePos.y - 12, tooltip);
}
示例9: foregroundRenderEvent
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@SubscribeEvent
public void foregroundRenderEvent(GuiContainerEvent.DrawForeground event) {
GuiContainer container = event.getGuiContainer();
GlStateTracker.pushState();
Point mousePos = GuiDraw.getMousePosition();
GlStateManager.translate(-container.getGuiLeft(), -container.getGuiTop(), 100F);
drawHandlers.forEach(handler -> handler.renderObjects(container, mousePos.x, mousePos.y));
drawHandlers.forEach(handler -> handler.postRenderObjects(container, mousePos.x, mousePos.y));
GlStateManager.translate(container.getGuiLeft(), container.getGuiTop(), -100F);
GuiHelper.enable3DRender();
GlStateManager.pushMatrix();
for (Slot slot : container.inventorySlots.inventorySlots) {
GlStateTracker.pushState();
drawHandlers.forEach(handler -> handler.renderSlotOverlay(container, slot));
GlStateTracker.popState();
}
GlStateManager.popMatrix();
GlStateTracker.popState();
}
示例10: itemTooltipEvent
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@SubscribeEvent
public void itemTooltipEvent(ItemTooltipEvent event) {
if (instanceTooltipHandlers != null && Minecraft.getMinecraft().currentScreen != null) {
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
Point mousePos = GuiDraw.getMousePosition();
instanceTooltipHandlers.forEach(handler -> handler.handleTooltip(screen, mousePos.x, mousePos.y, event.getToolTip()));
if (screen instanceof GuiContainer) {
GuiContainer container = ((GuiContainer) screen);
instanceTooltipHandlers.forEach(handler -> handler.handleItemDisplayName(screen, GuiHelper.getStackMouseOver(container, true), event.getToolTip()));
}
}
}
示例11: drawItems
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
private void drawItems() {
Dimension d = GuiDraw.getDisplayRes();
GlStateManager.matrixMode(GL11.GL_PROJECTION);
GlStateManager.loadIdentity();
GlStateManager.ortho(0, d.width * 16D / iconSize, d.height * 16D / iconSize, 0, 1000, 3000);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.clearColor(0, 0, 0, 0);
GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
int rows = d.height / boxSize;
int cols = d.width / boxSize;
int fit = rows * cols;
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableRescaleNormal();
GlStateManager.color(1, 1, 1, 1);
for (int i = 0; drawIndex < ItemPanel.items.size() && i < fit; drawIndex++, i++) {
int x = i % cols * 18;
int y = i / cols * 18;
GuiHelper.drawItem(x + 1, y + 1, ItemPanel.items.get(drawIndex));
}
GL11.glFlush();
}
示例12: handleKeyPress
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@Override
public boolean handleKeyPress(int keyID, char keyChar) {
if (KeyBindings.get("nei.options.keys.gui.next").isActiveAndMatches(keyID)) {
scroll(1);
return true;
}
if (KeyBindings.get("nei.options.keys.gui.prev").isActiveAndMatches(keyID)) {
scroll(-1);
return true;
}
Point mouse = GuiDraw.getMousePosition();
ItemPanelSlot hoverSlot = getSlotMouseOver(mouse.x, mouse.y);
if (hoverSlot != null && draggedStack.isEmpty()) {
ItemStack item = hoverSlot.item;
if (KeyBindings.get("nei.options.keys.gui.recipe").isActiveAndMatches(keyID)) {
JEIIntegrationManager.openRecipeGui(item);
return true;
} else if (KeyBindings.get("nei.options.keys.gui.usage").isActiveAndMatches(keyID)) {
JEIIntegrationManager.openUsageGui(item);
return true;
}
}
return false;
}
示例13: handleTooltip
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
{
Point point = GuiDraw.getMousePosition();
int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);
if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13)
{
currenttip.add(GasRegistry.getGas("sulfuricAcid").getLocalizedName());
}
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4)
{
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack));
}
return super.handleTooltip(gui, currenttip, recipe);
}
示例14: handleTooltip
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
{
Point point = GuiDraw.getMousePosition();
int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);
if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 69+7)
{
currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).fluidInput.ingredient));
}
else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7)
{
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas.getGas().getLocalizedName());
}
else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7)
{
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas.getGas().getLocalizedName());
}
return super.handleTooltip(gui, currenttip, recipe);
}
示例15: handleTooltip
import codechicken.lib.gui.GuiDraw; //导入依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
{
Point point = GuiDraw.getMousePosition();
Point offset = gui.getRecipePosition(recipe);
int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x;
int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y;
if(xAxis >= 6-5 && xAxis <= 22-5 && yAxis >= 11-10 && yAxis <= 69-10)
{
currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getFluid()));
}
else if(xAxis >= 29-5 && xAxis <= 45-5 && yAxis >= 11-10 && yAxis <= 69-10)
{
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getGas()));
}
else if(xAxis >= 141-5 && xAxis <= 157-5 && yAxis >= 41-10 && yAxis <= 69-10)
{
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getOutput().getGasOutput()));
}
return super.handleTooltip(gui, currenttip, recipe);
}