mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-03-04 01:01:29 +01:00
Remove the old Discoveries tab
This commit is contained in:
parent
5595468c4b
commit
e26c4bbf9e
5 changed files with 50 additions and 71 deletions
|
@ -4,9 +4,7 @@ import com.minelittlepony.common.client.gui.IViewRoot;
|
||||||
import com.minelittlepony.common.client.gui.ScrollContainer;
|
import com.minelittlepony.common.client.gui.ScrollContainer;
|
||||||
import com.minelittlepony.common.client.gui.element.Label;
|
import com.minelittlepony.common.client.gui.element.Label;
|
||||||
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.client.gui.DrawableUtil;
|
import com.minelittlepony.unicopia.client.gui.DrawableUtil;
|
||||||
import com.minelittlepony.unicopia.container.SpellbookScreen.TraitButton;
|
|
||||||
import com.minelittlepony.unicopia.item.URecipes;
|
import com.minelittlepony.unicopia.item.URecipes;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
|
@ -55,22 +53,6 @@ public class SpellbookCraftingPageContent extends ScrollContainer implements Spe
|
||||||
getContentPadding().bottom = 30;
|
getContentPadding().bottom = 30;
|
||||||
|
|
||||||
switch (SpellbookPage.getCurrent()) {
|
switch (SpellbookPage.getCurrent()) {
|
||||||
case DISCOVERIES: {
|
|
||||||
int i = 0;
|
|
||||||
int cols = 4;
|
|
||||||
|
|
||||||
int top = 10;
|
|
||||||
int left = 25;
|
|
||||||
|
|
||||||
for (Trait trait : Trait.all()) {
|
|
||||||
int x = i % cols;
|
|
||||||
int y = i / cols;
|
|
||||||
|
|
||||||
addButton(new TraitButton(left + x * 32, top + y * 32, trait));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case INVENTORY:
|
case INVENTORY:
|
||||||
// handled elsewhere
|
// handled elsewhere
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public enum SpellbookPage {
|
public enum SpellbookPage {
|
||||||
INVENTORY,
|
INVENTORY,
|
||||||
DISCOVERIES,
|
|
||||||
RECIPES;
|
RECIPES;
|
||||||
|
|
||||||
public static final SpellbookPage[] VALUES = values();
|
public static final SpellbookPage[] VALUES = values();
|
||||||
|
|
|
@ -9,15 +9,11 @@ import com.minelittlepony.common.client.gui.dimension.Bounds;
|
||||||
import com.minelittlepony.common.client.gui.element.Button;
|
import com.minelittlepony.common.client.gui.element.Button;
|
||||||
import com.minelittlepony.common.client.gui.sprite.TextureSprite;
|
import com.minelittlepony.common.client.gui.sprite.TextureSprite;
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.TraitDiscovery;
|
|
||||||
import com.minelittlepony.unicopia.container.SpellbookChapterList.*;
|
import com.minelittlepony.unicopia.container.SpellbookChapterList.*;
|
||||||
import com.minelittlepony.unicopia.container.SpellbookScreenHandler.*;
|
import com.minelittlepony.unicopia.container.SpellbookScreenHandler.*;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
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.gui.Drawable;
|
import net.minecraft.client.gui.Drawable;
|
||||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||||
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
|
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
|
||||||
|
@ -251,50 +247,6 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class TraitButton extends ImageButton {
|
|
||||||
private final Trait trait;
|
|
||||||
|
|
||||||
public TraitButton(int x, int y, Trait trait) {
|
|
||||||
super(x, y, 16, 16);
|
|
||||||
this.trait = trait;
|
|
||||||
getStyle().setIcon(new TextureSprite()
|
|
||||||
.setTextureSize(16, 16)
|
|
||||||
.setSize(16, 16)
|
|
||||||
.setTexture(trait.getSprite()));
|
|
||||||
getStyle().setTooltip(trait.getTooltip());
|
|
||||||
|
|
||||||
onClick(sender -> Pony.of(MinecraftClient.getInstance().player).getDiscoveries().markRead(trait));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
|
||||||
TraitDiscovery discoveries = Pony.of(MinecraftClient.getInstance().player).getDiscoveries();
|
|
||||||
setEnabled(discoveries.isKnown(trait));
|
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
|
||||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
|
||||||
RenderSystem.enableBlend();
|
|
||||||
drawTexture(matrices, x - 2, y - 8, 204, 219, 22, 32, 512, 256);
|
|
||||||
|
|
||||||
if (!active) {
|
|
||||||
drawTexture(matrices, x - 2, y - 1, 74, 223, 18, 18, 512, 256);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (discoveries.isUnread(trait)) {
|
|
||||||
drawTexture(matrices, x - 8, y - 8, 225, 219, 35, 32, 512, 256);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.renderButton(matrices, mouseX, mouseY, tickDelta);
|
|
||||||
hovered &= active;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Button setEnabled(boolean enable) {
|
|
||||||
alpha = enable ? 1 : 0.1125F;
|
|
||||||
return super.setEnabled(enable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static class ImageButton extends Button {
|
static class ImageButton extends Button {
|
||||||
|
|
||||||
public ImageButton(int x, int y) {
|
public ImageButton(int x, int y) {
|
||||||
|
|
|
@ -5,9 +5,11 @@ import java.util.List;
|
||||||
|
|
||||||
import com.minelittlepony.common.client.gui.IViewRoot;
|
import com.minelittlepony.common.client.gui.IViewRoot;
|
||||||
import com.minelittlepony.common.client.gui.ScrollContainer;
|
import com.minelittlepony.common.client.gui.ScrollContainer;
|
||||||
|
import com.minelittlepony.common.client.gui.element.Button;
|
||||||
import com.minelittlepony.common.client.gui.element.Label;
|
import com.minelittlepony.common.client.gui.element.Label;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits;
|
import com.minelittlepony.common.client.gui.sprite.TextureSprite;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.*;
|
||||||
|
import com.minelittlepony.unicopia.container.SpellbookScreen.ImageButton;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ 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 SpellbookScreen.TraitButton(width / 2 - 8, 8, trait));
|
addButton(new TraitButton(width / 2 - 8, 8, trait));
|
||||||
addButton(new Label(width / 2, 26).setCentered())
|
addButton(new Label(width / 2, 26).setCentered())
|
||||||
.getStyle()
|
.getStyle()
|
||||||
.setText(known ? Text.translatable("gui.unicopia.trait.label",
|
.setText(known ? Text.translatable("gui.unicopia.trait.label",
|
||||||
|
@ -147,4 +149,49 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel
|
||||||
super.drawOverlays(matrices, mouseX, mouseY, tickDelta);
|
super.drawOverlays(matrices, mouseX, mouseY, tickDelta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class TraitButton extends ImageButton {
|
||||||
|
private final Trait trait;
|
||||||
|
|
||||||
|
public TraitButton(int x, int y, Trait trait) {
|
||||||
|
super(x, y, 16, 16);
|
||||||
|
this.trait = trait;
|
||||||
|
getStyle().setIcon(new TextureSprite()
|
||||||
|
.setTextureSize(16, 16)
|
||||||
|
.setSize(16, 16)
|
||||||
|
.setTexture(trait.getSprite()));
|
||||||
|
getStyle().setTooltip(trait.getTooltip());
|
||||||
|
|
||||||
|
onClick(sender -> Pony.of(MinecraftClient.getInstance().player).getDiscoveries().markRead(trait));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||||
|
TraitDiscovery discoveries = Pony.of(MinecraftClient.getInstance().player).getDiscoveries();
|
||||||
|
setEnabled(discoveries.isKnown(trait));
|
||||||
|
|
||||||
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
|
RenderSystem.setShaderTexture(0, SpellbookScreen.TEXTURE);
|
||||||
|
RenderSystem.enableBlend();
|
||||||
|
drawTexture(matrices, x - 2, y - 8, 204, 219, 22, 32, 512, 256);
|
||||||
|
|
||||||
|
if (!active) {
|
||||||
|
drawTexture(matrices, x - 2, y - 1, 74, 223, 18, 18, 512, 256);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (discoveries.isUnread(trait)) {
|
||||||
|
drawTexture(matrices, x - 8, y - 8, 225, 219, 35, 32, 512, 256);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.renderButton(matrices, mouseX, mouseY, tickDelta);
|
||||||
|
hovered &= active;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Button setEnabled(boolean enable) {
|
||||||
|
alpha = enable ? 1 : 0.1125F;
|
||||||
|
return super.setEnabled(enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,6 @@
|
||||||
"gui.unicopia.tribe_selection.confirm.bads.3.unicopia.changeling": " - Becomes sick from eating regular food and must eat love hasten a cure",
|
"gui.unicopia.tribe_selection.confirm.bads.3.unicopia.changeling": " - Becomes sick from eating regular food and must eat love hasten a cure",
|
||||||
|
|
||||||
"gui.unicopia.spellbook.page.inventory": "Inventory",
|
"gui.unicopia.spellbook.page.inventory": "Inventory",
|
||||||
"gui.unicopia.spellbook.page.discoveries": "Discoveries",
|
|
||||||
"gui.unicopia.spellbook.page.recipes": "Recipes",
|
"gui.unicopia.spellbook.page.recipes": "Recipes",
|
||||||
"gui.unicopia.spellbook.page.recipes.empty": "0 Recipes Unlocked",
|
"gui.unicopia.spellbook.page.recipes.empty": "0 Recipes Unlocked",
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue