From 8e349380a56d613839c5ffc412a215e6c52105f7 Mon Sep 17 00:00:00 2001 From: Zelophed Date: Fri, 21 Aug 2020 20:46:09 +0200 Subject: [PATCH] fix tooltips getting occluded by certain gui elements - addresses #412 - addresses #366 --- .../animations/AnimatedCrushingWheels.java | 2 +- .../sequencer/SequencedGearshiftScreen.java | 12 ++---- .../symmetry/SymmetryWandScreen.java | 18 +++----- .../inventories/AdjustableCrateScreen.java | 11 ++--- .../item/filter/AbstractFilterScreen.java | 11 ++++- .../block/SchematicTableScreen.java | 26 +++++------ .../block/SchematicannonScreen.java | 43 +++++++------------ .../create/foundation/gui/GuiGameElement.java | 19 +++----- 8 files changed, 57 insertions(+), 85 deletions(-) diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java index 1ae4cf281..8650d216e 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java @@ -13,7 +13,7 @@ public class AnimatedCrushingWheels extends AnimatedKinetics { @Override public void draw(int xOffset, int yOffset) { RenderSystem.enableDepthTest(); - RenderSystem.translatef(xOffset, yOffset, 300); + RenderSystem.translatef(xOffset, yOffset, 100); RenderSystem.rotatef(-22.5f, 0, 1, 0); int scale = 22; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java index eeabcbd29..0932fe187 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java @@ -1,8 +1,5 @@ package com.simibubi.create.content.contraptions.relays.advanced.sequencer; -import java.util.Vector; - -import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.AbstractSimiScreen; import com.simibubi.create.foundation.gui.AllGuiTextures; @@ -11,14 +8,15 @@ import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.utility.Lang; - import net.minecraft.item.ItemStack; import net.minecraft.nbt.ListNBT; import net.minecraft.util.math.BlockPos; +import java.util.Vector; + public class SequencedGearshiftScreen extends AbstractSimiScreen { - private final ItemStack renderedItem = new ItemStack(AllBlocks.SEQUENCED_GEARSHIFT.get()); + private final ItemStack renderedItem = AllBlocks.SEQUENCED_GEARSHIFT.asStack(); private final AllGuiTextures background = AllGuiTextures.SEQUENCER; private final String title = Lang.translate("gui.sequenced_gearshift.title"); @@ -144,12 +142,10 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { font.drawStringWithShadow(title, guiLeft - 3 + (background.width - font.getStringWidth(title)) / 2, guiTop + 10, hFontColor); - RenderSystem.pushMatrix(); - RenderSystem.translated(guiLeft + background.width + 20, guiTop + 50, 0); GuiGameElement.of(renderedItem) + .at(guiLeft + background.width + 20, guiTop + 50) .scale(5) .render(); - RenderSystem.popMatrix(); } private void label(int x, int y, String text) { diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandScreen.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandScreen.java index 0a09edd4b..07115fb43 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandScreen.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandScreen.java @@ -2,11 +2,7 @@ package com.simibubi.create.content.curiosities.symmetry; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; -import com.simibubi.create.content.curiosities.symmetry.mirror.CrossPlaneMirror; -import com.simibubi.create.content.curiosities.symmetry.mirror.EmptyMirror; -import com.simibubi.create.content.curiosities.symmetry.mirror.PlaneMirror; -import com.simibubi.create.content.curiosities.symmetry.mirror.SymmetryMirror; -import com.simibubi.create.content.curiosities.symmetry.mirror.TriplePlaneMirror; +import com.simibubi.create.content.curiosities.symmetry.mirror.*; import com.simibubi.create.foundation.gui.AbstractSimiScreen; import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.GuiGameElement; @@ -16,7 +12,6 @@ import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.networking.NbtPacket; import com.simibubi.create.foundation.utility.Lang; - import net.minecraft.client.renderer.Vector3f; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; @@ -119,14 +114,11 @@ public class SymmetryWandScreen extends AbstractSimiScreen { renderBlock(); - RenderSystem.pushMatrix(); - RenderSystem.translated(0, 0, 200); - RenderSystem.rotatef(-20, -3.5f, 1, 1); GuiGameElement.of(wand) - .at(guiLeft + 220, guiTop + 220) - .scale(4) - .render(); - RenderSystem.popMatrix(); + .at(guiLeft + 220, guiTop + 220) + .scale(4) + .rotate(-70, 20, 20) + .render(); } protected void renderBlock() { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java index 6868123e3..2a58b5e08 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java @@ -7,7 +7,6 @@ import static com.simibubi.create.foundation.gui.AllGuiTextures.PLAYER_INVENTORY import java.util.ArrayList; import java.util.List; -import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.logistics.packet.ConfigureFlexcratePacket; import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; @@ -32,7 +31,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen extraAreas; - private final ItemStack renderedItem = new ItemStack(AllBlocks.ADJUSTABLE_CRATE.get()); + private final ItemStack renderedItem = AllBlocks.ADJUSTABLE_CRATE.asStack(); private final String title = Lang.translate("gui.adjustable_crate.title"); private final String storageSpace = Lang.translate("gui.adjustable_crate.storageSpace"); @@ -97,12 +96,10 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen ex font.drawString(playerInventory.getDisplayName().getFormattedText(), invX + 7, invY + 6, 0x666666); font.drawString(I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 9, 0x5B5037); - RenderHelper.enableGuiDepthLighting(); + /*RenderHelper.enableGuiDepthLighting(); RenderSystem.pushMatrix(); RenderSystem.translated(guiLeft + background.width + 0, guiTop + background.height - 60, 0); RenderSystem.scaled(5, 5, 5); itemRenderer.renderItemIntoGUI(container.filterItem, 0, 0); - RenderSystem.popMatrix(); + RenderSystem.popMatrix();*/ + + GuiGameElement.of(container.filterItem) + .at(guiLeft + background.width, guiTop +background.height -60) + .scale(5) + .render(); + } @Override diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java index ea4b09f9d..b063dfc60 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java @@ -1,11 +1,5 @@ package com.simibubi.create.content.schematics.block; -import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE; -import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE_PROGRESS; - -import java.nio.file.Paths; -import java.util.List; - import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.CreateClient; @@ -19,13 +13,19 @@ import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.utility.Lang; - import net.minecraft.client.gui.IHasContainer; import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.item.ItemStack; import net.minecraft.util.Util; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; +import java.nio.file.Paths; +import java.util.List; + +import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE; +import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE_PROGRESS; + public class SchematicTableScreen extends AbstractSimiContainerScreen implements IHasContainer { @@ -40,6 +40,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen { protected Vector replaceLevelIndicators; @@ -60,6 +58,8 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen