|
@@ -9,30 +9,37 @@ import io.wispforest.owo.ui.core.Positioning;
|
|
import io.wispforest.owo.ui.core.Sizing;
|
|
import io.wispforest.owo.ui.core.Sizing;
|
|
import io.wispforest.owo.ui.event.MouseEnter;
|
|
import io.wispforest.owo.ui.event.MouseEnter;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
+import net.kyori.adventure.platform.fabric.FabricAudiences;
|
|
|
|
+import net.kyori.adventure.platform.fabric.FabricServerAudiences;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
+import net.minecraft.text.OrderedText;
|
|
|
|
+import net.minecraft.text.Text;
|
|
import net.minecraft.util.Identifier;
|
|
import net.minecraft.util.Identifier;
|
|
|
|
+import xyz.tbvns.rogue_block.Upgrades.Upgrade;
|
|
import xyz.tbvns.rogue_block.Upgrades.UpgradeRarity;
|
|
import xyz.tbvns.rogue_block.Upgrades.UpgradeRarity;
|
|
import xyz.tbvns.rogue_block.Utils;
|
|
import xyz.tbvns.rogue_block.Utils;
|
|
|
|
+import xyz.tbvns.rogue_block.client.Rogue_blockClient;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
public class UpgradeComponent {
|
|
public class UpgradeComponent {
|
|
- ItemStack stack;
|
|
|
|
- UpgradeRarity rarity;
|
|
|
|
- double x, y;
|
|
|
|
|
|
+ Upgrade upgrade;
|
|
boolean isHovered = false;
|
|
boolean isHovered = false;
|
|
|
|
+ double x, y;
|
|
|
|
|
|
Component textureComponent;
|
|
Component textureComponent;
|
|
Component itemComponent;
|
|
Component itemComponent;
|
|
|
|
|
|
- public UpgradeComponent(ItemStack stack, UpgradeRarity rarity, int posX, int posY) {
|
|
|
|
- this.stack = stack;
|
|
|
|
- this.rarity = rarity;
|
|
|
|
- x = posX; y = posY;
|
|
|
|
|
|
+ public UpgradeComponent(Upgrade upgrade) {
|
|
|
|
+ this.upgrade = upgrade;
|
|
|
|
+ x = upgrade.getGuiPos()[0];
|
|
|
|
+ y = upgrade.getGuiPos()[1];
|
|
}
|
|
}
|
|
|
|
|
|
public void add(FlowLayout layout) {
|
|
public void add(FlowLayout layout) {
|
|
- Component item = Components.item(stack);
|
|
|
|
|
|
+ Component item = Components.item(upgrade.itemDisplay());
|
|
item.positioning().set(Positioning.absolute((int) x, (int) y));
|
|
item.positioning().set(Positioning.absolute((int) x, (int) y));
|
|
- Component component = getTextureComponent(rarity.unobtained, item);
|
|
|
|
|
|
+ Component component = getTextureComponent(upgrade.getRarity().unobtained, item);
|
|
|
|
|
|
layout.child(component);
|
|
layout.child(component);
|
|
layout.child(item);
|
|
layout.child(item);
|
|
@@ -57,7 +64,7 @@ public class UpgradeComponent {
|
|
component.sizing(Sizing.fixed(25), Sizing.fixed(25));
|
|
component.sizing(Sizing.fixed(25), Sizing.fixed(25));
|
|
item.sizing(Sizing.fixed(20), Sizing.fixed(20));
|
|
item.sizing(Sizing.fixed(20), Sizing.fixed(20));
|
|
isHovered = true;
|
|
isHovered = true;
|
|
-
|
|
|
|
|
|
+ UpgradeScreen.toolTip = Rogue_blockClient.audiences.toNative(upgrade.generateTooltip());
|
|
UpgradeScreen.update();
|
|
UpgradeScreen.update();
|
|
});
|
|
});
|
|
|
|
|
|
@@ -65,7 +72,7 @@ public class UpgradeComponent {
|
|
component.sizing(Sizing.fixed(21), Sizing.fixed(21));
|
|
component.sizing(Sizing.fixed(21), Sizing.fixed(21));
|
|
item.sizing(Sizing.fixed(16), Sizing.fixed(16));
|
|
item.sizing(Sizing.fixed(16), Sizing.fixed(16));
|
|
isHovered = false;
|
|
isHovered = false;
|
|
-
|
|
|
|
|
|
+ UpgradeScreen.toolTip = Text.empty();
|
|
UpgradeScreen.update();
|
|
UpgradeScreen.update();
|
|
});
|
|
});
|
|
|
|
|
|
@@ -73,7 +80,7 @@ public class UpgradeComponent {
|
|
ParentComponent parentComponent = textureComponent.root();
|
|
ParentComponent parentComponent = textureComponent.root();
|
|
textureComponent.remove();
|
|
textureComponent.remove();
|
|
FlowLayout layout = (FlowLayout) parentComponent;
|
|
FlowLayout layout = (FlowLayout) parentComponent;
|
|
- textureComponent = getTextureComponent(rarity.obtained, item);
|
|
|
|
|
|
+ textureComponent = getTextureComponent(upgrade.getRarity().obtained, item);
|
|
layout.child(textureComponent);
|
|
layout.child(textureComponent);
|
|
return true;
|
|
return true;
|
|
});
|
|
});
|