Skip to content

Commit 2104dab

Browse files
committed
generified give commands and blueprints a bit
1 parent a204473 commit 2104dab

29 files changed

Lines changed: 262 additions & 318 deletions

File tree

CHANGELOG.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,6 @@ v5.0.4
168168

169169
- added new supp gems: LMP, GMP, Barrage versions, faster projectiles
170170

171-
- added leech cap stat, and base leech is now 5% total hp etc capped per second
171+
- added leech cap stat, and base leech is now 5% total hp etc capped per second
172+
173+
- added remaining spirit tooltip to aura gems

src/main/java/com/robertx22/age_of_exile/capability/player/data/DeathFavorData.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
import com.robertx22.age_of_exile.config.forge.ServerContainer;
44
import com.robertx22.age_of_exile.database.data.rarities.GearRarity;
55
import com.robertx22.age_of_exile.database.registry.ExileDB;
6+
import com.robertx22.age_of_exile.mmorpg.SlashRef;
67
import com.robertx22.age_of_exile.uncommon.MathHelper;
78
import com.robertx22.age_of_exile.uncommon.interfaces.data_items.IRarity;
9+
import net.minecraft.ChatFormatting;
810
import net.minecraft.network.chat.Component;
11+
import net.minecraft.resources.ResourceLocation;
912
import net.minecraft.world.entity.player.Player;
1013

14+
import java.util.ArrayList;
15+
import java.util.List;
16+
1117
public class DeathFavorData {
1218

1319
private float favor = 250;
@@ -42,6 +48,30 @@ public GearRarity getRarity() {
4248
return rar;
4349
}
4450

51+
public List<Component> getTooltip() {
52+
List<Component> tooltip = new ArrayList<>();
53+
54+
GearRarity rar = getRarity();
55+
56+
tooltip.add(rar.locName().append(" Favor").withStyle(rar.textFormatting()));
57+
58+
tooltip.add(Component.empty());
59+
60+
tooltip.add(Component.literal("Current: " + (int) favor).withStyle(ChatFormatting.YELLOW));
61+
62+
tooltip.add(Component.empty());
63+
64+
65+
tooltip.add(Component.literal("Loot/Exp Multiplier: " + getLootExpMulti() + "x").withStyle(rar.textFormatting()));
66+
67+
68+
return tooltip;
69+
}
70+
71+
public ResourceLocation getTexture() {
72+
return SlashRef.guiId("favor/" + getRarity().item_tier);
73+
}
74+
4575
public float getLootExpMulti() {
4676
return getRarity().favor_loot_multi;
4777
}

src/main/java/com/robertx22/age_of_exile/capability/player/helper/GemInventoryHelper.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ public List<SkillGemData> getAurasGems() {
118118
return list;
119119
}
120120

121-
public float getSpiritReserved(Player p, float multi) {
121+
public float getSpiritReserved(Player p) {
122+
float multi = getPlayerSpiritReserveMulti(p);
122123

123124
float res = 0;
124125

@@ -129,12 +130,24 @@ public float getSpiritReserved(Player p, float multi) {
129130
return res;
130131
}
131132

132-
public void removeAurasIfCantWear(Player p) {
133+
public float getRemainingSpirit(Player p) {
134+
135+
float reserved = getSpiritReserved(p);
136+
137+
float remaining = 1 - reserved;
138+
139+
return remaining * 100F;
140+
}
133141

142+
public float getPlayerSpiritReserveMulti(Player p) {
134143
float multi = Load.Unit(p).getUnit().getCalculatedStat(AuraCostReduction.getInstance()).getReverseMultiplier();
144+
return multi;
145+
}
135146

136147

137-
if (getSpiritReserved(p, multi) > 1) {
148+
public void removeAurasIfCantWear(Player p) {
149+
150+
if (getSpiritReserved(p) > 1) {
138151
for (ItemStack s : getAuras()) {
139152
PlayerUtils.giveItem(s.copy(), p);
140153
s.shrink(100);

src/main/java/com/robertx22/age_of_exile/database/data/support_gem/SupportGems.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static void init() {
2727
new SupportGem("gmp_barrage", "Greater Barrage Projectiles", PlayStyle.DEX, 1.5F,
2828
Arrays.asList(
2929
new StatMod(-50, -50, Stats.TOTAL_DAMAGE.get(), ModType.MORE),
30-
new StatMod(10, 30, Stats.PROJECTILE_DAMAGE.get(), ModType.MORE),
30+
new StatMod(10, 30, Stats.PROJECTILE_DAMAGE.get(), ModType.FLAT),
3131
new StatMod(4, 4, Stats.PROJECTILE_COUNT.get(), ModType.FLAT),
3232
new StatMod(1, 1, Stats.PROJECTILE_BARRAGE.get(), ModType.FLAT)
3333
))
@@ -37,7 +37,7 @@ public static void init() {
3737
new SupportGem("gmp", "Greater Multiple Projectiles", PlayStyle.DEX, 1.5F,
3838
Arrays.asList(
3939
new StatMod(-50, -50, Stats.TOTAL_DAMAGE.get(), ModType.MORE),
40-
new StatMod(10, 30, Stats.PROJECTILE_DAMAGE.get(), ModType.MORE),
40+
new StatMod(10, 30, Stats.PROJECTILE_DAMAGE.get(), ModType.FLAT),
4141
new StatMod(4, 4, Stats.PROJECTILE_COUNT.get(), ModType.FLAT)
4242
))
4343
.setOneOfAKind(PROJ_COUNT)
@@ -46,7 +46,7 @@ public static void init() {
4646
new SupportGem("lmp_barrage", "Lesser Barrage Projectiles", PlayStyle.DEX, 1.5F,
4747
Arrays.asList(
4848
new StatMod(-30, -30, Stats.TOTAL_DAMAGE.get(), ModType.MORE),
49-
new StatMod(10, 30, Stats.PROJECTILE_DAMAGE.get(), ModType.MORE),
49+
new StatMod(10, 30, Stats.PROJECTILE_DAMAGE.get(), ModType.FLAT),
5050
new StatMod(2, 2, Stats.PROJECTILE_COUNT.get(), ModType.FLAT),
5151
new StatMod(1, 1, Stats.PROJECTILE_BARRAGE.get(), ModType.FLAT)
5252
))
@@ -55,7 +55,7 @@ public static void init() {
5555
new SupportGem("lmp", "Lesser Multiple Projectiles", PlayStyle.DEX, 1.5F,
5656
Arrays.asList(
5757
new StatMod(-30, -30, Stats.TOTAL_DAMAGE.get(), ModType.MORE),
58-
new StatMod(10, 30, Stats.PROJECTILE_DAMAGE.get(), ModType.MORE),
58+
new StatMod(10, 30, Stats.PROJECTILE_DAMAGE.get(), ModType.FLAT),
5959
new StatMod(2, 2, Stats.PROJECTILE_COUNT.get(), ModType.FLAT)
6060
))
6161
.setOneOfAKind(PROJ_COUNT).registerToExileRegistry();
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.robertx22.age_of_exile.gui.buttons;
2+
3+
import com.robertx22.age_of_exile.uncommon.datasaving.Load;
4+
import com.robertx22.library_of_exile.utils.TextUTIL;
5+
import net.minecraft.client.Minecraft;
6+
import net.minecraft.client.gui.GuiGraphics;
7+
import net.minecraft.client.gui.components.ImageButton;
8+
import net.minecraft.client.gui.components.Tooltip;
9+
import net.minecraft.resources.ResourceLocation;
10+
11+
public class FavorButton extends ImageButton {
12+
13+
public static int FAVOR_BUTTON_SIZE_X = 34;
14+
public static int FAVOR_BUTTON_SIZE_Y = 34;
15+
16+
Minecraft mc = Minecraft.getInstance();
17+
18+
public FavorButton(int xPos, int yPos) {
19+
super(xPos, yPos, FAVOR_BUTTON_SIZE_X, FAVOR_BUTTON_SIZE_Y, 0, 0, FAVOR_BUTTON_SIZE_Y, new ResourceLocation("empty"), (button) -> {
20+
});
21+
22+
}
23+
24+
@Override
25+
public void render(GuiGraphics gui, int mouseX, int mouseY, float delta) {
26+
setModTooltip();
27+
super.render(gui, mouseX, mouseY, delta);
28+
}
29+
30+
@Override
31+
public void renderWidget(GuiGraphics gui, int mouseX, int mouseY, float delta) {
32+
ResourceLocation tex = Load.player(mc.player).favor.getTexture();
33+
gui.setColor(1.0F, 1.0F, 1.0F, 1.0F);
34+
gui.blit(tex, getX(), getY(), FAVOR_BUTTON_SIZE_X, FAVOR_BUTTON_SIZE_X, FAVOR_BUTTON_SIZE_X, FAVOR_BUTTON_SIZE_X, FAVOR_BUTTON_SIZE_X, FAVOR_BUTTON_SIZE_X);
35+
36+
}
37+
38+
public void setModTooltip() {
39+
this.setTooltip(Tooltip.create(TextUTIL.mergeList(Load.player(mc.player).favor.getTooltip())));
40+
41+
}
42+
43+
44+
}

src/main/java/com/robertx22/age_of_exile/gui/screens/character_screen/MainHubScreen.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.robertx22.age_of_exile.gui.bases.BaseScreen;
2424
import com.robertx22.age_of_exile.gui.bases.INamedScreen;
2525
import com.robertx22.age_of_exile.gui.buttons.CharacterStatsButtons;
26+
import com.robertx22.age_of_exile.gui.buttons.FavorButton;
2627
import com.robertx22.age_of_exile.gui.inv_gui.GuiInventoryGrids;
2728
import com.robertx22.age_of_exile.gui.screens.OpenBackpack;
2829
import com.robertx22.age_of_exile.gui.screens.OpenInvGuiScreen;
@@ -219,6 +220,9 @@ public void init() {
219220
// screens.add(new SpellScreen());
220221

221222

223+
publicAddButton(new FavorButton(guiLeft + sizeX / 2 - FavorButton.FAVOR_BUTTON_SIZE_X / 2, guiTop - FavorButton.FAVOR_BUTTON_SIZE_Y));
224+
225+
222226
int x = guiLeft + sizeX - 1;
223227
int y = guiTop + 20;
224228

src/main/java/com/robertx22/age_of_exile/loot/blueprints/GearBlueprint.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.robertx22.age_of_exile.loot.blueprints;
22

33
import com.robertx22.age_of_exile.loot.LootInfo;
4-
import com.robertx22.age_of_exile.loot.blueprints.bases.GearItemSlotPart;
5-
import com.robertx22.age_of_exile.loot.blueprints.bases.GearRarityPart;
4+
import com.robertx22.age_of_exile.loot.blueprints.bases.GearTypePart;
65
import com.robertx22.age_of_exile.loot.blueprints.bases.UniqueGearPart;
76
import com.robertx22.age_of_exile.loot.generators.SoulLootGen;
87
import com.robertx22.age_of_exile.loot.generators.util.GearCreationUtils;
@@ -11,7 +10,7 @@
1110
import net.minecraft.world.item.ItemStack;
1211
import net.minecraft.world.item.Items;
1312

14-
public class GearBlueprint extends ItemBlueprint {
13+
public class GearBlueprint extends RarityItemBlueprint implements ITypeBlueprint {
1514

1615
public Item item = Items.AIR;
1716

@@ -22,9 +21,8 @@ public GearBlueprint(LootInfo info) {
2221
this.rarity.setupChances(info);
2322
}
2423

25-
26-
public GearItemSlotPart gearItemSlot = new GearItemSlotPart(this);
27-
public GearRarityPart rarity = new GearRarityPart(this);
24+
25+
public GearTypePart gearItemSlot = new GearTypePart(this);
2826
public UniqueGearPart uniquePart = new UniqueGearPart(this);
2927

3028

@@ -43,4 +41,8 @@ ItemStack generate() {
4341
}
4442
}
4543

44+
@Override
45+
public void setType(String type) {
46+
this.gearItemSlot.set(type);
47+
}
4648
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.robertx22.age_of_exile.loot.blueprints;
2+
3+
public interface ITypeBlueprint {
4+
5+
void setType(String type);
6+
}

src/main/java/com/robertx22/age_of_exile/loot/blueprints/JewelBlueprint.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.robertx22.age_of_exile.loot.blueprints;
22

33
import com.robertx22.age_of_exile.loot.LootInfo;
4-
import com.robertx22.age_of_exile.loot.blueprints.bases.GearRarityPart;
54
import com.robertx22.age_of_exile.saveclasses.jewel.JewelItemData;
65
import com.robertx22.age_of_exile.uncommon.datasaving.StackSaving;
76
import com.robertx22.age_of_exile.uncommon.enumclasses.PlayStyle;
@@ -10,11 +9,9 @@
109

1110
import java.util.Arrays;
1211

13-
public class JewelBlueprint extends ItemBlueprint {
12+
public class JewelBlueprint extends RarityItemBlueprint {
1413

1514

16-
public GearRarityPart rarity = new GearRarityPart(this);
17-
1815
public JewelBlueprint(LootInfo info) {
1916
super(info);
2017
this.rarity.chanceForHigherRarity = 50;

src/main/java/com/robertx22/age_of_exile/loot/blueprints/LootChestBlueprint.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
package com.robertx22.age_of_exile.loot.blueprints;
22

33
import com.robertx22.age_of_exile.database.data.loot_chest.base.LootChestData;
4+
import com.robertx22.age_of_exile.database.registry.ExileDB;
45
import com.robertx22.age_of_exile.loot.LootInfo;
5-
import com.robertx22.age_of_exile.loot.blueprints.bases.GearRarityPart;
66
import com.robertx22.age_of_exile.loot.blueprints.bases.LootChestPart;
77
import com.robertx22.age_of_exile.uncommon.datasaving.StackSaving;
88
import com.robertx22.library_of_exile.utils.RandomUtils;
99
import net.minecraft.world.item.ItemStack;
1010

11-
public class LootChestBlueprint extends ItemBlueprint {
11+
public class LootChestBlueprint extends RarityItemBlueprint implements ITypeBlueprint {
1212

1313
public LootChestBlueprint(LootInfo info) {
1414
super(info);
1515
this.rarity.chanceForHigherRarity = 75;
1616
}
1717

18-
public GearRarityPart rarity = new GearRarityPart(this);
1918
public LootChestPart type = new LootChestPart(this);
2019

2120
@Override
@@ -45,4 +44,8 @@ public LootChestData createData() {
4544
}
4645

4746

47+
@Override
48+
public void setType(String type) {
49+
this.type.set(ExileDB.LootChests().get(type));
50+
}
4851
}

0 commit comments

Comments
 (0)