diff options
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/widget')
3 files changed, 28 insertions, 14 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/ItemListOverlay.java b/src/main/java/me/shedaniel/rei/gui/widget/ItemListOverlay.java index 0ca3aab2b..a6302be7a 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/ItemListOverlay.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/ItemListOverlay.java @@ -45,7 +45,7 @@ public class ItemListOverlay extends Gui implements IWidget { public void draw(int int_1, int int_2, float float_1) { widgets.forEach(widget -> widget.draw(int_1, int_2, float_1)); EntityPlayerSP player = Minecraft.getInstance().player; - if (rectangle.contains(ClientHelper.getMouseLocation()) && ClientHelper.isCheating() && !player.inventory.getItemStack().isEmpty()) + if (rectangle.contains(ClientHelper.getMouseLocation()) && ClientHelper.isCheating() && !player.inventory.getItemStack().isEmpty() && Minecraft.getInstance().isSingleplayer()) GuiHelper.getOverlay(containerGui.getContainerGui()).addTooltip(new QueuedTooltip(ClientHelper.getMouseLocation(), Arrays.asList(I18n.format("text.rei.delete_items")))); } @@ -72,7 +72,7 @@ public class ItemListOverlay extends Gui implements IWidget { @Override protected void drawToolTip(ItemStack itemStack) { EntityPlayerSP player = Minecraft.getInstance().player; - if (!ClientHelper.isCheating() || player.inventory.getItemStack().isEmpty()) + if (!ClientHelper.isCheating() || player.inventory.getItemStack().isEmpty() || !Minecraft.getInstance().isSingleplayer()) super.drawToolTip(itemStack); } @@ -211,11 +211,11 @@ public class ItemListOverlay extends Gui implements IWidget { public boolean mouseClicked(double double_1, double double_2, int int_1) { EntityPlayerSP player = Minecraft.getInstance().player; if (rectangle.contains(double_1, double_2)) - if (ClientHelper.isCheating() && !player.inventory.getItemStack().isEmpty()) { + if (ClientHelper.isCheating() && !player.inventory.getItemStack().isEmpty() && Minecraft.getInstance().isSingleplayer()) { ClientHelper.sendDeletePacket(); return true; } - if (!player.inventory.getItemStack().isEmpty()) + if (!player.inventory.getItemStack().isEmpty() && Minecraft.getInstance().isSingleplayer()) return false; if (onMouseClick(int_1, double_1, double_2)) return true; diff --git a/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java index 6b480e8c2..604603bfe 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java @@ -5,6 +5,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.MathHelper; import java.awt.*; import java.util.ArrayList; @@ -30,7 +31,16 @@ public class RecipeBaseWidget extends Gui implements IWidget { GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.disableStandardItemLighting(); Minecraft.getInstance().getTextureManager().bindTexture(CHEST_GUI_TEXTURE); - drawTexturedModalRect(bounds.x, bounds.y, 106, 190, bounds.width, bounds.height); + drawTexturedModalRect(bounds.x, bounds.y, 106, 190, bounds.width / 2, bounds.height / 2); + drawTexturedModalRect(bounds.x + bounds.width / 2, bounds.y, 256 - bounds.width / 2, 190, bounds.width / 2, bounds.height / 2); + drawTexturedModalRect(bounds.x, bounds.y + bounds.height / 2, 106, 190 + 66 - bounds.height / 2, bounds.width / 2, bounds.height / 2); + drawTexturedModalRect(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2, 256 - bounds.width / 2, 190 + 66 - bounds.height / 2, bounds.width / 2, bounds.height / 2); + if (bounds.height > 40) + for(int i = 20; i < bounds.height - 20; i += MathHelper.clamp(20, 0, bounds.height - 20 - i)) { + int height = MathHelper.clamp(20, 0, bounds.height - 20 - i); + drawTexturedModalRect(bounds.x, bounds.y + i, 106, 230, bounds.width / 2, height); + drawTexturedModalRect(bounds.x + bounds.width / 2, bounds.y + i, 256 - bounds.width / 2, 210, bounds.width / 2, height); + } } } diff --git a/src/main/java/me/shedaniel/rei/gui/widget/RecipeViewingWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/RecipeViewingWidget.java index 7cbd416b8..5e6d6225a 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/RecipeViewingWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/RecipeViewingWidget.java @@ -29,8 +29,8 @@ import java.util.Map; public class RecipeViewingWidget extends GuiScreen { + public static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/recipecontainer.png"); private static final ResourceLocation CREATIVE_INVENTORY_TABS = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png"); - private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/recipecontainer.png"); public final int guiWidth = 176; public final int guiHeight = 186; @@ -190,10 +190,10 @@ public class RecipeViewingWidget extends GuiScreen { final SpeedCraftFunctional functional = functional0[0]; if (page * getRecipesPerPage() < categoriesMap.get(selectedCategory).size()) { IRecipeDisplay topDisplay = categoriesMap.get(selectedCategory).get(page * getRecipesPerPage()); - widgets.addAll(selectedCategory.setupDisplay(getParent(), topDisplay, new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 40, 150, selectedCategory.usesFullPage() ? 118 : 66))); + widgets.addAll(selectedCategory.setupDisplay(getParent(), topDisplay, new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 40, 150, selectedCategory.usesFullPage() ? 140 : 66))); if (supplier != null) { ButtonWidget btn; - widgets.add(btn = new ButtonWidget(supplier.get(new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 40, 150, selectedCategory.usesFullPage() ? 118 : 66)), "+") { + widgets.add(btn = new ButtonWidget(supplier.get(new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 40, 150, selectedCategory.usesFullPage() ? 140 : 66)), "+") { @Override public void onPressed(int button, double mouseX, double mouseY) { Minecraft.getInstance().displayGuiScreen(parent.getContainerGui()); @@ -214,10 +214,10 @@ public class RecipeViewingWidget extends GuiScreen { } if (!selectedCategory.usesFullPage() && page * getRecipesPerPage() + 1 < categoriesMap.get(selectedCategory).size()) { IRecipeDisplay middleDisplay = categoriesMap.get(selectedCategory).get(page * getRecipesPerPage() + 1); - widgets.addAll(selectedCategory.setupDisplay(getParent(), middleDisplay, new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 108, 150, 66))); + widgets.addAll(selectedCategory.setupDisplay(getParent(), middleDisplay, new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 113, 150, 66))); if (supplier != null) { ButtonWidget btn; - widgets.add(btn = new ButtonWidget(supplier.get(new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 108, 150, 66)), "+") { + widgets.add(btn = new ButtonWidget(supplier.get(new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 113, 150, 66)), "+") { @Override public void onPressed(int button, double mouseX, double mouseY) { Minecraft.getInstance().displayGuiScreen(parent.getContainerGui()); @@ -272,10 +272,14 @@ public class RecipeViewingWidget extends GuiScreen { @Override public void drawDefaultBackground() { drawWorldBackground(0); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - RenderHelper.disableStandardItemLighting(); - this.mc.getTextureManager().bindTexture(CHEST_GUI_TEXTURE); - this.drawTexturedModalRect((int) bounds.getX(), (int) bounds.getY(), 0, 0, (int) bounds.getWidth(), (int) bounds.getHeight()); + if (selectedCategory != null) + selectedCategory.drawCategoryBackground(bounds); + else { + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderHelper.disableStandardItemLighting(); + this.mc.getTextureManager().bindTexture(CHEST_GUI_TEXTURE); + this.drawTexturedModalRect((int) bounds.getX(), (int) bounds.getY(), 0, 0, (int) bounds.getWidth(), (int) bounds.getHeight()); + } } public int getTotalPages(IRecipeCategory category) { |
