mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fix a whole bunch of rendering jank due to the 1.19.4 update
This commit is contained in:
parent
62aac0f711
commit
776f3b9718
3 changed files with 18 additions and 26 deletions
|
@ -5,15 +5,12 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.joml.Vector4f;
|
|
||||||
|
|
||||||
import com.minelittlepony.common.client.gui.*;
|
import com.minelittlepony.common.client.gui.*;
|
||||||
import com.minelittlepony.common.client.gui.element.Button;
|
import com.minelittlepony.common.client.gui.element.Button;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellbookRecipe;
|
import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellbookRecipe;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
||||||
import com.minelittlepony.unicopia.client.gui.ItemTraitsTooltipRenderer;
|
import com.minelittlepony.unicopia.client.gui.ItemTraitsTooltipRenderer;
|
||||||
import com.minelittlepony.unicopia.client.render.PassThroughVertexConsumer;
|
import com.minelittlepony.unicopia.client.render.PassThroughVertexConsumer;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
@ -239,11 +236,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, int x, int y, float tickDelta) {
|
public void render(MatrixStack matrices, int x, int y, float tickDelta) {
|
||||||
y -= 2;
|
drawItem(matrices, x, y - 2);
|
||||||
|
|
||||||
Vector4f pos = new Vector4f(x, y, 0, 1);
|
|
||||||
pos.mul(matrices.peek().getPositionMatrix());
|
|
||||||
drawItem(matrices, (int)pos.x, (int)pos.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawItem(MatrixStack matrices, int x, int y) {
|
protected void drawItem(MatrixStack matrices, int x, int y) {
|
||||||
|
@ -281,16 +274,11 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
||||||
|
|
||||||
MinecraftClient.getInstance().getTextureManager().getTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).setFilter(false, false);
|
MinecraftClient.getInstance().getTextureManager().getTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).setFilter(false, false);
|
||||||
RenderSystem.setShaderTexture(0, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
RenderSystem.setShaderTexture(0, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||||
RenderSystem.enableBlend();
|
matrices.push();
|
||||||
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
matrices.translate(x, y, 100);
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 0.2F);
|
matrices.translate(8, 8, 0);
|
||||||
MatrixStack matrixStack = RenderSystem.getModelViewStack();
|
matrices.scale(1, -1, 1);
|
||||||
matrixStack.push();
|
matrices.scale(8, 8, 8);
|
||||||
matrixStack.translate(x, y, 100);
|
|
||||||
matrixStack.translate(8, 8, 0);
|
|
||||||
matrixStack.scale(1, -1, 1);
|
|
||||||
matrixStack.scale(8, 8, 8);
|
|
||||||
RenderSystem.applyModelViewMatrix();
|
|
||||||
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
|
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
|
||||||
boolean bl = !model.isSideLit();
|
boolean bl = !model.isSideLit();
|
||||||
if (bl) {
|
if (bl) {
|
||||||
|
@ -308,8 +296,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
||||||
if (bl) {
|
if (bl) {
|
||||||
DiffuseLighting.enableGuiDepthLighting();
|
DiffuseLighting.enableGuiDepthLighting();
|
||||||
}
|
}
|
||||||
matrixStack.pop();
|
matrices.pop();
|
||||||
RenderSystem.applyModelViewMatrix();
|
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,15 +69,17 @@ public class SpellbookCraftingPageContent extends ScrollContainer implements Spe
|
||||||
getContentPadding().bottom = 30;
|
getContentPadding().bottom = 30;
|
||||||
|
|
||||||
if (state.getOffset() == 1) {
|
if (state.getOffset() == 1) {
|
||||||
int top = 0;
|
// TODO: Kirin's scrollbars in 1.19.4 are kind of jank
|
||||||
|
final int fixForPositionalBug = 10;
|
||||||
|
int top = 0 + fixForPositionalBug;
|
||||||
for (SpellbookRecipe recipe : this.client.world.getRecipeManager().listAllOfType(URecipes.SPELLBOOK)) {
|
for (SpellbookRecipe recipe : this.client.world.getRecipeManager().listAllOfType(URecipes.SPELLBOOK)) {
|
||||||
if (client.player.getRecipeBook().contains(recipe)) {
|
if (client.player.getRecipeBook().contains(recipe)) {
|
||||||
IngredientTree tree = new IngredientTree(0, top, width - verticalScrollbar.getBounds().width + 2);
|
IngredientTree tree = new IngredientTree(-fixForPositionalBug, top, width - verticalScrollbar.getBounds().width + 2);
|
||||||
recipe.buildCraftingTree(tree);
|
recipe.buildCraftingTree(tree);
|
||||||
top += tree.build(this);
|
top += tree.build(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (top == 0) {
|
if (top == 0 + fixForPositionalBug) {
|
||||||
addButton(new Label(width / 2, 0).setCentered()).getStyle().setText("gui.unicopia.spellbook.page.recipes.empty");
|
addButton(new Label(width / 2, 0).setCentered()).getStyle().setText("gui.unicopia.spellbook.page.recipes.empty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,13 +114,16 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel
|
||||||
|
|
||||||
boolean known = Pony.of(MinecraftClient.getInstance().player).getDiscoveries().isKnown(trait);
|
boolean known = Pony.of(MinecraftClient.getInstance().player).getDiscoveries().isKnown(trait);
|
||||||
|
|
||||||
addButton(new TraitButton(width / 2 - 8, 8, trait));
|
// TODO: Kirin's scrollbars in 1.19.4 are kind of jank
|
||||||
addButton(new Label(width / 2, 26).setCentered())
|
final int fixForPositionalBug = 8;
|
||||||
|
|
||||||
|
addButton(new TraitButton(width / 2 - 8 - fixForPositionalBug, 8 + fixForPositionalBug, trait));
|
||||||
|
addButton(new Label(width / 2 - fixForPositionalBug, 26 + fixForPositionalBug).setCentered())
|
||||||
.getStyle()
|
.getStyle()
|
||||||
.setText(known ? Text.translatable("gui.unicopia.trait.label",
|
.setText(known ? Text.translatable("gui.unicopia.trait.label",
|
||||||
Text.translatable("trait." + trait.getId().getNamespace() + "." + trait.getId().getPath() + ".name")
|
Text.translatable("trait." + trait.getId().getNamespace() + "." + trait.getId().getPath() + ".name")
|
||||||
) : Text.literal("???"));
|
) : Text.literal("???"));
|
||||||
IngredientTree tree = new IngredientTree(0, 50, width + 18).noLabels();
|
IngredientTree tree = new IngredientTree(-fixForPositionalBug, 50 + fixForPositionalBug, width + 18).noLabels();
|
||||||
|
|
||||||
List<Item> knownItems = Pony.of(MinecraftClient.getInstance().player).getDiscoveries().getKnownItems(trait).toList();
|
List<Item> knownItems = Pony.of(MinecraftClient.getInstance().player).getDiscoveries().getKnownItems(trait).toList();
|
||||||
SpellTraits.getItems(trait)
|
SpellTraits.getItems(trait)
|
||||||
|
|
Loading…
Reference in a new issue