Skip to content

Commit 91bec88

Browse files
authored
Merge pull request #612 from ArikSquad/feat/items-abilities
Soulflow & AOTV
2 parents 49d4fa4 + 2fbd88f commit 91bec88

11 files changed

Lines changed: 284 additions & 4 deletions

File tree

commons/src/main/java/net/swofty/commons/skyblock/item/ItemType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public enum ItemType {
3434
NEW_YEAR_CAKE(Material.CAKE, Rarity.SPECIAL),
3535
NEW_YEAR_CAKE_BAG(Material.PLAYER_HEAD, Rarity.UNCOMMON),
3636

37+
RAW_SOULFLOW(Material.PLAYER_HEAD, Rarity.UNCOMMON),
38+
SOULFLOW(Material.PLAYER_HEAD, Rarity.RARE),
39+
3740
/**
3841
* Accessories
3942
*/
@@ -621,6 +624,8 @@ public enum ItemType {
621624
ASPECT_OF_THE_END(Material.DIAMOND_SWORD, Rarity.RARE),
622625
SQUIRE_SWORD(Material.IRON_SWORD, Rarity.UNCOMMON),
623626
MERCENARY_AXE(Material.IRON_AXE, Rarity.RARE),
627+
ASPECT_OF_THE_DRAGON(Material.DIAMOND_SWORD, Rarity.LEGENDARY),
628+
ASPECT_OF_THE_VOID(Material.DIAMOND_SHOVEL, Rarity.EPIC),
624629

625630
/**
626631
* Shovels
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
items:
2+
- id: RAW_SOULFLOW
3+
material: PLAYER_HEAD
4+
rarity: UNCOMMON
5+
components:
6+
- id: SOULFLOW
7+
amount: 1
8+
- id: SKULL_HEAD
9+
texture: 84f0214329bb2575b8f4d7623376255d7ec4a439296e140ae9a2c6138a4270c1
10+
- id: SOULFLOW
11+
material: PLAYER_HEAD
12+
rarity: RARE
13+
components:
14+
- id: SOULFLOW
15+
amount: 160
16+
- id: SKULL_HEAD
17+
texture: bc85e2fdf9b1b020ac2827d11ae00d90f81c5c6bd361cbd1c8b8e9087757e4b0

configuration/skyblock/items/weapons.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,25 @@ items:
4646
type: ASPECT_OF_THE_JERRY
4747
amount: 1
4848

49+
- id: ASPECT_OF_THE_DRAGON
50+
material: DIAMOND_SWORD
51+
rarity: LEGENDARY
52+
abilities:
53+
- DRAGON_RAGE
54+
default_statistics:
55+
damage: 225
56+
strength: 100
57+
components:
58+
- id: ABILITY
59+
abilities:
60+
- DRAGON_RAGE
61+
- id: SELLABLE
62+
value: 100000
63+
- id: STANDARD_ITEM
64+
standard_item_type: SWORD
65+
- id: CUSTOM_DISPLAY_NAME
66+
display_name: "Aspect of the Dragons"
67+
4968
- id: END_SWORD
5069
material: IRON_SWORD
5170
rarity: UNCOMMON
@@ -58,6 +77,25 @@ items:
5877
- id: STANDARD_ITEM
5978
standard_item_type: SWORD
6079

80+
- id: ASPECT_OF_THE_VOID
81+
material: DIAMOND_SHOVEL
82+
rarity: EPIC
83+
default_statistics:
84+
damage: 120
85+
strength: 100
86+
abilities:
87+
- INSTANT_TRANSMISSION
88+
- ETHER_TRANSMISSION
89+
components:
90+
- id: ABILITY
91+
abilities:
92+
- INSTANT_TRANSMISSION
93+
- ETHER_TRANSMISSION
94+
- id: STANDARD_ITEM
95+
standard_item_type: SWORD
96+
- id: CUSTOM_DISPLAY_NAME
97+
display_name: "Aspect of the Void"
98+
6199
- id: FANCY_SWORD
62100
material: GOLDEN_SWORD
63101
rarity: UNCOMMON

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/data/SkyBlockDataHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ DatapointInteger.class, new DatapointInteger("latest_new_year_cake_year", 0)),
434434
LATEST_YEAR_PRESENT_PICKUP("latest_year_pickup_present", false, false, false,
435435
DatapointPresentYear.class, new DatapointPresentYear("latest_year_pickup_present")),
436436

437+
SOULFLOW("soulflow", false, false, false,
438+
DatapointInteger.class, new DatapointInteger("soulflow", 0)),
439+
437440
KAT("kat", false, false, false,
438441
DatapointKat.class, new DatapointKat("kat")),
439442

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/event/actions/item/ActionItemAbilityLeftUse.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ public void run(PlayerHandAnimationEvent event) {
2323

2424
if (item.hasComponent(AbilityComponent.class)) {
2525
AbilityComponent abilityComponent = item.getComponent(AbilityComponent.class);
26-
RegisteredAbility ability = abilityComponent.getAbility(RegisteredAbility.AbilityActivation.LEFT_CLICK);
26+
27+
RegisteredAbility ability = null;
28+
if(player.isSneaking()) {
29+
ability = abilityComponent.getAbility(RegisteredAbility.AbilityActivation.SNEAK_LEFT_CLICK);
30+
}
31+
if (ability == null) {
32+
abilityComponent.getAbility(RegisteredAbility.AbilityActivation.LEFT_CLICK);
33+
}
34+
2735
if (ability != null) {
2836
if (!ability.getCost().canUse(player)) {
2937
ability.getCost().onFail(player);

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/event/actions/item/ActionItemAbilityRightUse.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ public void run(PlayerUseItemEvent event) {
2828

2929
if (item.hasComponent(AbilityComponent.class)) {
3030
AbilityComponent abilityComponent = item.getComponent(AbilityComponent.class);
31-
RegisteredAbility ability = abilityComponent.getAbility(RegisteredAbility.AbilityActivation.RIGHT_CLICK);
31+
32+
RegisteredAbility ability = null;
33+
if(player.isSneaking()) {
34+
ability = abilityComponent.getAbility(RegisteredAbility.AbilityActivation.SNEAK_RIGHT_CLICK);
35+
}
36+
if (ability == null) {
37+
abilityComponent.getAbility(RegisteredAbility.AbilityActivation.RIGHT_CLICK);
38+
}
39+
3240
if (ability != null) {
3341
if (!ability.getCost().canUse(player)) {
3442
ability.getCost().onFail(player);
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package net.swofty.type.skyblockgeneric.gui.inventories;
2+
3+
import net.minestom.server.event.inventory.InventoryPreClickEvent;
4+
import net.minestom.server.inventory.InventoryType;
5+
import net.minestom.server.item.ItemStack;
6+
import net.swofty.type.generic.data.datapoints.DatapointInteger;
7+
import net.swofty.type.generic.gui.inventory.HypixelInventoryGUI;
8+
import net.swofty.type.generic.gui.inventory.ItemStackCreator;
9+
import net.swofty.type.generic.gui.inventory.item.GUIClickableItem;
10+
import net.swofty.type.generic.user.HypixelPlayer;
11+
import net.swofty.type.skyblockgeneric.data.SkyBlockDataHandler;
12+
import net.swofty.type.skyblockgeneric.item.SkyBlockItem;
13+
import net.swofty.type.skyblockgeneric.item.components.SoulflowComponent;
14+
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
15+
16+
public class GUIConsumeSoulflow extends HypixelInventoryGUI {
17+
18+
private final SkyBlockItem item;
19+
20+
public GUIConsumeSoulflow(SkyBlockItem item) {
21+
super("Consume Soulflow?", InventoryType.CHEST_4_ROW);
22+
this.item = item;
23+
24+
if (!item.hasComponent(SoulflowComponent.class)) {
25+
throw new IllegalArgumentException("Item does not have SoulflowComponent");
26+
}
27+
}
28+
29+
@Override
30+
public void onOpen(InventoryGUIOpenEvent e) {
31+
fill(FILLER_ITEM);
32+
set(new GUIClickableItem(13) {
33+
@Override
34+
public void run(InventoryPreClickEvent e, HypixelPlayer p) {
35+
SkyBlockPlayer player = (SkyBlockPlayer) p;
36+
SkyBlockDataHandler data = player.getSkyblockDataHandler();
37+
int soulflow = data.get(SkyBlockDataHandler.Data.SOULFLOW, DatapointInteger.class).getValue();
38+
int itemSoulflow = item.getComponent(SoulflowComponent.class).getAmount();
39+
int addition = item.getAmount() * itemSoulflow;
40+
41+
data.get(SkyBlockDataHandler.Data.SOULFLOW, DatapointInteger.class).setValue(soulflow + addition);
42+
player.sendMessage("§bYou internalized §3+" + addition + "⸎ Soulflow §band have a total of §3" + (soulflow + addition) + "⸎§b!");
43+
44+
player.getInventory().setItemStack(player.getHeldSlot(), ItemStack.AIR);
45+
player.closeInventory();
46+
}
47+
48+
@Override
49+
public ItemStack.Builder getItem(HypixelPlayer p) {
50+
SkyBlockPlayer player = (SkyBlockPlayer) p;
51+
SkyBlockDataHandler data = player.getSkyblockDataHandler();
52+
int soulflow = data.get(SkyBlockDataHandler.Data.SOULFLOW, DatapointInteger.class).getValue();
53+
54+
int itemSoulflow = item.getComponent(SoulflowComponent.class).getAmount();
55+
int addition = item.getAmount() * itemSoulflow;
56+
57+
return ItemStackCreator.getStackHead(
58+
"§aConsume Soulflow?",
59+
"94f0c693b85658b0bae792c9f9b717eb024ab8c4b349455648ea08358b50ddc4",
60+
1,
61+
"§7Takes all the §3⸎ Soulflow §7items in",
62+
"§7your inventory and internalizes them",
63+
"§7to be ready for use.",
64+
"",
65+
"§7Internalized: §3" + soulflow + "⸎",
66+
"",
67+
"§7Adding from inventory: §3+" + addition + "⸎ Soulflow",
68+
"",
69+
"§eClick to consume!"
70+
);
71+
}
72+
});
73+
set(GUIClickableItem.getCloseItem(31));
74+
updateItemStacks(getInventory(), getPlayer());
75+
}
76+
77+
@Override
78+
public boolean allowHotkeying() {
79+
return false;
80+
}
81+
82+
@Override
83+
public void onBottomClick(InventoryPreClickEvent e) {
84+
e.setCancelled(true);
85+
}
86+
}

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/item/ItemConfigParser.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ public static ConfigurableSkyBlockItem parseItem(Map<String, Object> config) {
119119
List<ItemAnimation> animations = (List<ItemAnimation>) config.get("disabled_animations");
120120
yield new DisableAnimationComponent(animations);
121121
}
122+
case "SOULFLOW" -> {
123+
int amount = (int) config.get("amount");
124+
yield new SoulflowComponent(amount);
125+
}
122126
case "DRILL" -> new DrillComponent();
123127
case "ABIPHONE" -> {
124128
List<String> features = (List<String>) config.get("features");
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package net.swofty.type.skyblockgeneric.item.components;
2+
3+
import lombok.Getter;
4+
import net.swofty.type.skyblockgeneric.gui.inventories.GUIConsumeSoulflow;
5+
import net.swofty.type.skyblockgeneric.item.SkyBlockItemComponent;
6+
7+
import java.util.List;
8+
9+
public class SoulflowComponent extends SkyBlockItemComponent {
10+
11+
@Getter
12+
private final int amount;
13+
14+
public SoulflowComponent(int amount) {
15+
addInheritedComponent(new LoreUpdateComponent(
16+
List.of(
17+
"§7Hold and right-click to consume,",
18+
"§7gaining §3+" + amount + "⸎ Soulflow§7."
19+
), false
20+
));
21+
addInheritedComponent(
22+
new InteractableComponent((player, item) -> {
23+
new GUIConsumeSoulflow(item).open(player);
24+
}, null, null)
25+
);
26+
this.amount = amount;
27+
}
28+
29+
}

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/item/handlers/ability/AbilityRegistry.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package net.swofty.type.skyblockgeneric.item.handlers.ability;
22

3+
import net.minestom.server.coordinate.BlockVec;
4+
import net.minestom.server.coordinate.Point;
5+
import net.minestom.server.coordinate.Pos;
36
import net.swofty.type.skyblockgeneric.item.handlers.ability.abilities.BuildersWandAbility;
47

58
import java.util.HashMap;
@@ -24,13 +27,29 @@ public class AbilityRegistry {
2427
register(new RegisteredAbility(
2528
"INSTANT_TRANSMISSION",
2629
"Instant Transmission",
27-
"§7Teleports §a8 Blocks §7ahead of you and gain §a+50 §fSpeed for §a3 seconds§f.",
30+
"§7Teleports §a8 Blocks §7ahead of you and gain §a+50 §fSpeed for §a3 seconds§7.",
2831
RegisteredAbility.AbilityActivation.RIGHT_CLICK,
2932
5,
3033
new RegisteredAbility.AbilityManaCost(50),
3134
(player, item, ignored, ignored2) -> {
3235
player.teleport(player.getPosition().add(player.getPosition().direction().mul(8)));
33-
// add speed too
36+
// TODO: add speed too
37+
}
38+
));
39+
40+
register(new RegisteredAbility(
41+
"ETHER_TRANSMISSION",
42+
"Ether Transmission",
43+
"§7Teleport to your targeted block up to §a57 §7blocks away.",
44+
RegisteredAbility.AbilityActivation.SNEAK_RIGHT_CLICK,
45+
5,
46+
new RegisteredAbility.AbilityManaSoulflowCost(180, 1),
47+
(player, item, ignored, ignored2) -> {
48+
Point targetedBlock = player.getTargetBlockPosition(57);
49+
if (targetedBlock == null) return;
50+
BlockVec tpPos = targetedBlock.asBlockVec();
51+
if (!player.getInstance().getBlock(tpPos.add(0, 1, 0)).isAir() || !player.getInstance().getBlock(tpPos.add(0, 2, 0)).isAir()) return; // TODO: don't consume mana/soulflow if teleport fails
52+
player.teleport(new Pos(tpPos.add(0, 1, 0), player.getPosition().yaw(), player.getPosition().pitch()));
3453
}
3554
));
3655

0 commit comments

Comments
 (0)