fix tooltips getting occluded by certain gui elements

- addresses #412
- addresses #366
This commit is contained in:
Zelophed 2020-08-21 20:46:09 +02:00
parent cd60fd4d59
commit 8e349380a5
8 changed files with 57 additions and 85 deletions

View file

@ -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;

View file

@ -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) {

View file

@ -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() {

View file

@ -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<Adjustabl
private List<Rectangle2d> 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<Adjustabl
AllGuiTextures.FLEXCRATE_LOCKED_SLOT.draw(this, x, y);
}
RenderSystem.pushMatrix();
RenderSystem.translated(guiLeft + FLEXCRATE.width + 110, guiTop + 40, 0);
GuiGameElement.of(renderedItem)
.scale(5)
.render();
RenderSystem.popMatrix();
.at(guiLeft + FLEXCRATE.width + 110, guiTop + 40)
.scale(5)
.render();
}
@Override

View file

@ -11,6 +11,7 @@ import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Opti
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.gui.AllIcons;
import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.gui.widgets.IconButton;
import com.simibubi.create.foundation.gui.widgets.Indicator;
import com.simibubi.create.foundation.gui.widgets.Indicator.State;
@ -62,12 +63,18 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> 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

View file

@ -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<SchematicTableContainer>
implements IHasContainer<SchematicTableContainer> {
@ -40,6 +40,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
private final String finished = Lang.translate("gui.schematicTable.finished");
private final String noSchematics = Lang.translate("gui.schematicTable.noSchematics");
private final String availableSchematicsTitle = Lang.translate("gui.schematicTable.availableSchematics");
private final ItemStack renderedItem = AllBlocks.SCHEMATIC_TABLE.asStack();
private float progress;
private float chasingProgress;
@ -110,12 +111,11 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
font.drawString(title, mainLeft + 60, mainTop + 10, AllGuiTextures.FONT_COLOR);
if (schematicsArea == null)
font.drawStringWithShadow(noSchematics, mainLeft + 39, mainTop + 26, 0xFFDD44);
RenderSystem.pushMatrix();
RenderSystem.translated(mainLeft + 217, mainTop + 48, 200);
RenderSystem.scaled(3, 3, 3);
GuiGameElement.of(AllBlocks.SCHEMATIC_TABLE.asStack()).render();
RenderSystem.popMatrix();
GuiGameElement.of(renderedItem)
.at(mainLeft + 217, mainTop + 48)
.scale(3)
.render();
minecraft.getTextureManager()
.bindTexture(SCHEMATIC_TABLE_PROGRESS.location);

View file

@ -1,20 +1,13 @@
package com.simibubi.create.content.schematics.block;
import static net.minecraft.util.text.TextFormatting.GRAY;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Vector;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.schematics.packet.ConfigureSchematicannonPacket;
import com.simibubi.create.content.schematics.packet.ConfigureSchematicannonPacket.Option;
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.gui.AllIcons;
import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.gui.widgets.IconButton;
import com.simibubi.create.foundation.gui.widgets.Indicator;
import com.simibubi.create.foundation.gui.widgets.Indicator.State;
@ -22,15 +15,20 @@ import com.simibubi.create.foundation.item.ItemDescription.Palette;
import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.client.gui.widget.Widget;
import net.minecraft.client.renderer.Rectangle2d;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Vector;
import static net.minecraft.util.text.TextFormatting.GRAY;
public class SchematicannonScreen extends AbstractSimiContainerScreen<SchematicannonContainer> {
protected Vector<Indicator> replaceLevelIndicators;
@ -60,6 +58,8 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
private final String optionEnabled = Lang.translate("gui.schematicannon.optionEnabled");
private final String optionDisabled = Lang.translate("gui.schematicannon.optionDisabled");
private final ItemStack renderedItem = AllBlocks.SCHEMATICANNON.asStack();
public SchematicannonScreen(SchematicannonContainer container, PlayerInventory inventory,
ITextComponent p_i51105_3_) {
super(container, inventory, p_i51105_3_);
@ -211,7 +211,11 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
if (!te.inventory.getStackInSlot(0).isEmpty())
renderBlueprintHighlight();
renderCannon();
GuiGameElement.of(renderedItem)
.at(guiLeft + 240, guiTop + 120)
.scale(5)
.render();
font.drawString(title, guiLeft + 80, guiTop + 10, AllGuiTextures.FONT_COLOR);
@ -236,23 +240,6 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
// 0xd3d3d3d3);
}
protected void renderCannon() {
RenderSystem.pushMatrix();
RenderSystem.enableBlend();
RenderSystem.enableRescaleNormal();
RenderSystem.enableAlphaTest();
RenderHelper.enableGuiDepthLighting();
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.translated(guiLeft + 240, guiTop + 120, 200);
RenderSystem.scaled(5, 5, 5);
itemRenderer.renderItemIntoGUI(new ItemStack(AllBlocks.SCHEMATICANNON.get()), 0, 0);
RenderSystem.popMatrix();
}
protected void renderBlueprintHighlight() {
AllGuiTextures.SCHEMATICANNON_HIGHLIGHT.draw(this, guiLeft + 20 + 8, guiTop + 31);
}

View file

@ -19,12 +19,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Atlases;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.world.ClientWorld;
@ -126,12 +121,10 @@ public class GuiGameElement {
}
protected void transform() {
int verticalFlip = (this instanceof GuiItemRenderBuilder) ? 1 : -1;
RenderSystem.translated(xBeforeScale, yBeforeScale, 0);
RenderSystem.scaled(scale, scale, scale);
RenderSystem.translated(x, y, z);
RenderSystem.scaled(1, verticalFlip, 1);
RenderSystem.scaled(1, -1, 1);
RenderSystem.translated(rotationOffset.x, rotationOffset.y, rotationOffset.z);
RenderSystem.rotatef((float) zRot, 0, 0, 1);
RenderSystem.rotatef((float) xRot, 1, 0, 0);
@ -257,7 +250,7 @@ public class GuiGameElement {
public static class GuiItemRenderBuilder extends GuiRenderBuilder {
private ItemStack stack;
private final ItemStack stack;
public GuiItemRenderBuilder(ItemStack stack) {
this.stack = stack;
@ -271,9 +264,9 @@ public class GuiGameElement {
public void render() {
prepare();
transform();
Minecraft.getInstance()
.getItemRenderer()
.renderItemIntoGUI(stack, 0, 0);
RenderSystem.scaled(1, -1, 1);
RenderSystem.translated(0, 0, -75);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(stack, 0, 0);
cleanUp();
}