Skip to content

Commit 4087fd6

Browse files
committed
Add Riptide 3 to the Tidesinger Sword
Signed-off-by: Noaaan <[email protected]>
1 parent dfb1bbf commit 4087fd6

File tree

8 files changed

+121
-8
lines changed

8 files changed

+121
-8
lines changed

PATCHNOTES.md

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ yourself a set of **Tidesinger Armor** or **Tools**.
2828

2929
This gear is superior to regular Aquarium in every way, as well as providing a direct swim speed increase.
3030

31+
The sword is special, as it comes with Riptide 3!
32+
3133
## Texture changes
3234

3335
- New Carmot Armor Items

src/main/java/nourl/mythicmetals/abilities/Abilities.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,18 @@ public class Abilities {
4444
public static final Ability SMITE = new Ability("smite", 3);
4545
public static final Ability SPIKED_HELM = new Ability("spiked_helm", 3, false);
4646
public static final Ability WATER_PROTECTION = new Ability("water_protection", 3);
47+
public static final Ability RIPTIDE = new Ability("riptide", 3);
4748

4849
public static void init() {
4950
DrillUpgrades.init();
5051
UniqueStaffBlocks.init();
5152

5253
AQUA_AFFINITY.addItem(MythicArmor.AQUARIUM.getHelmet(), MetalColors.AQUA_STYLE);
5354
AQUA_AFFINITY.addToolSet(MythicTools.AQUARIUM, MetalColors.AQUA_STYLE);
54-
AQUA_AFFINITY.addItem(MythicArmor.TIDESINGER.getHelmet(), MetalColors.AQUA_STYLE);
55-
AQUA_AFFINITY.addToolSet(MythicTools.TIDESINGER, MetalColors.AQUA_STYLE);
56-
BETTER_RESPIRATION.addItem(MythicArmor.TIDESINGER.getChestplate(), MetalColors.AQUA_STYLE);
57-
BETTER_RESPIRATION.addItem(MythicArmor.TIDESINGER.getLeggings(), MetalColors.AQUA_STYLE);
55+
AQUA_AFFINITY.addItem(MythicArmor.TIDESINGER.getHelmet(), MetalColors.TIDESINGER_BLUE);
56+
AQUA_AFFINITY.addToolSet(MythicTools.TIDESINGER, MetalColors.TIDESINGER_BLUE);
57+
BETTER_RESPIRATION.addItem(MythicArmor.TIDESINGER.getChestplate(), MetalColors.TIDESINGER_BLUE);
58+
BETTER_RESPIRATION.addItem(MythicArmor.TIDESINGER.getLeggings(), MetalColors.TIDESINGER_BLUE);
5859
BLAST_MINING.addItem(MythicTools.LEGENDARY_BANGLUM.getPickaxe(), MetalColors.GOLD_STYLE);
5960
BLAST_MINING.addItem(MythicTools.LEGENDARY_BANGLUM.getShovel(), MetalColors.GOLD_STYLE);
6061
BLAST_PADDING.addArmorSet(MythicArmor.BANGLUM, MetalColors.GOLD_STYLE);
@@ -66,7 +67,7 @@ public static void init() {
6667
BONUS_LOOTING.addItem(MythicTools.CARMOT.getSword(), MetalColors.CARMOT_STYLE);
6768
CARMOT_SHIELD.addArmorSet(MythicArmor.CARMOT, MetalColors.CARMOT_STYLE);
6869
DEPTH_STRIDER.addItem(MythicArmor.AQUARIUM.getBoots(), MetalColors.AQUA_STYLE);
69-
DEPTH_STRIDER.addItem(MythicArmor.TIDESINGER.getBoots(), MetalColors.AQUA_STYLE);
70+
DEPTH_STRIDER.addItem(MythicArmor.TIDESINGER.getBoots(), MetalColors.TIDESINGER_BLUE);
7071
FEATHER_FALLING.addItem(MythicArmor.LEGENDARY_BANGLUM.getBoots(), MetalColors.GOLD_STYLE);
7172
FIRE_PROTECTION.addArmorSet(MythicArmor.PALLADIUM, MetalColors.PALLADIUM_STYLE);
7273
HOT.addToolSet(MythicTools.PALLADIUM, MetalColors.PALLADIUM_STYLE);
@@ -93,8 +94,9 @@ public static void init() {
9394
SMITE.addItem(MythicTools.WHITE_AEGIS_SWORD, Style.EMPTY.withColor(Formatting.YELLOW));
9495
if (FabricLoader.getInstance().isModLoaded("origins")) {
9596
WATER_PROTECTION.addItem(MythicArmor.AQUARIUM.getChestplate(), MetalColors.AQUA_STYLE);
96-
BETTER_WATER_PROTECTION.addItem(MythicArmor.TIDESINGER.getChestplate(), MetalColors.AQUA_STYLE);
97+
BETTER_WATER_PROTECTION.addItem(MythicArmor.TIDESINGER.getChestplate(), MetalColors.TIDESINGER_BLUE);
9798
}
99+
RIPTIDE.addItem(MythicTools.TIDESINGER.getSword(), MetalColors.TIDESINGER_BLUE);
98100
}
99101

100102
}

src/main/java/nourl/mythicmetals/item/tools/MythicTools.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public class MythicTools implements SimpleFieldProcessingSubject<ToolSet> {
4343

4444
public static final ToolSet ADAMANTITE = new ToolSet(MythicToolMaterials.ADAMANTITE, DEFAULT_DAMAGE, BETTER_AXE_ATTACK_SPEED);
4545
public static final ToolSet AQUARIUM = new ToolSet(MythicToolMaterials.AQUARIUM, DEFAULT_DAMAGE, DEFAULT_ATTACK_SPEED);
46-
public static final ToolSet TIDESINGER = new ToolSet(MythicToolMaterials.TIDESINGER, DEFAULT_DAMAGE, FASTER_ATTACK_SPEED);
4746
public static final ToolSet BANGLUM = new ToolSet(MythicToolMaterials.BANGLUM, DEFAULT_DAMAGE, DEFAULT_ATTACK_SPEED);
4847
public static final Item BANGLUM_TNT_MINECART = new MinecartItem(MythicMetals.BANGLUM_TNT, new OwoItemSettings().group(MythicMetals.TABBED_GROUP));
4948
public static final ToolSet BRONZE = new ToolSet(MythicToolMaterials.BRONZE, DEFAULT_DAMAGE, DEFAULT_ATTACK_SPEED);
@@ -65,6 +64,7 @@ public class MythicTools implements SimpleFieldProcessingSubject<ToolSet> {
6564
public static final ToolSet STAR_PLATINUM = new ToolSet(MythicToolMaterials.STAR_PLATINUM, DEFAULT_DAMAGE, FASTER_ATTACK_SPEED);
6665
public static final ToolSet STEEL = new ToolSet(MythicToolMaterials.STEEL, DEFAULT_DAMAGE, DEFAULT_ATTACK_SPEED);
6766
public static final ToolSet STORMYX = new ToolSet(MythicToolMaterials.STORMYX, DEFAULT_DAMAGE, DEFAULT_ATTACK_SPEED);
67+
public static final ToolSet TIDESINGER = new TidesingerToolSet(MythicToolMaterials.TIDESINGER, DEFAULT_DAMAGE, FASTER_ATTACK_SPEED);
6868

6969
public static final Item RED_AEGIS_SWORD = new SwordItem(MythicToolMaterials.AEGIS_RED, 5, -3.0F,
7070
new OwoItemSettings().fireproof().rarity(Rarity.UNCOMMON).group(MythicMetals.TABBED_GROUP).tab(2));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package nourl.mythicmetals.item.tools;
2+
3+
import net.minecraft.enchantment.EnchantmentHelper;
4+
import net.minecraft.entity.LivingEntity;
5+
import net.minecraft.entity.MovementType;
6+
import net.minecraft.entity.player.PlayerEntity;
7+
import net.minecraft.item.ItemStack;
8+
import net.minecraft.item.SwordItem;
9+
import net.minecraft.item.ToolMaterial;
10+
import net.minecraft.sound.SoundCategory;
11+
import net.minecraft.sound.SoundEvents;
12+
import net.minecraft.stat.Stats;
13+
import net.minecraft.util.Hand;
14+
import net.minecraft.util.TypedActionResult;
15+
import net.minecraft.util.UseAction;
16+
import net.minecraft.util.math.MathHelper;
17+
import net.minecraft.util.math.Vec3d;
18+
import net.minecraft.world.World;
19+
20+
public class TidesingerSword extends SwordItem {
21+
public static final float TRIDENT_POWER = 3.0f;
22+
23+
public TidesingerSword(ToolMaterial toolMaterial, int attackDamage, float attackSpeed, Settings settings) {
24+
super(toolMaterial, attackDamage, attackSpeed, settings);
25+
}
26+
27+
@Override
28+
public UseAction getUseAction(ItemStack stack) {
29+
return UseAction.SPEAR;
30+
}
31+
32+
@Override
33+
public int getMaxUseTime(ItemStack stack) {
34+
return 72000;
35+
}
36+
37+
@Override
38+
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
39+
ItemStack itemStack = user.getStackInHand(hand);
40+
if (itemStack.getDamage() >= itemStack.getMaxDamage() - 1) {
41+
return TypedActionResult.fail(itemStack);
42+
} else if (EnchantmentHelper.getRiptide(itemStack) > 0 && !user.isTouchingWaterOrRain()) {
43+
return TypedActionResult.fail(itemStack);
44+
} else if (user.getItemCooldownManager().isCoolingDown(itemStack.getItem())) {
45+
return TypedActionResult.fail(itemStack);
46+
} else{
47+
user.setCurrentHand(hand);
48+
return TypedActionResult.consume(itemStack);
49+
}
50+
}
51+
52+
@Override
53+
public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) {
54+
int i = this.getMaxUseTime(stack) - remainingUseTicks;
55+
if (i >= 10 && user instanceof PlayerEntity playerEntity) {
56+
if (playerEntity.isTouchingWaterOrRain()) {
57+
if (!world.isClient) {
58+
stack.damage(1, playerEntity, p -> p.sendToolBreakStatus(user.getActiveHand()));
59+
}
60+
61+
playerEntity.incrementStat(Stats.USED.getOrCreateStat(this));
62+
float yaw = playerEntity.getYaw();
63+
float pitch = playerEntity.getPitch();
64+
float h = -MathHelper.sin(yaw * (float) (Math.PI / 180.0)) * MathHelper.cos(pitch * (float) (Math.PI / 180.0));
65+
float k = -MathHelper.sin(pitch * (float) (Math.PI / 180.0));
66+
float l = MathHelper.cos(yaw * (float) (Math.PI / 180.0)) * MathHelper.cos(pitch * (float) (Math.PI / 180.0));
67+
float m = MathHelper.sqrt(h * h + k * k + l * l);
68+
h *= TRIDENT_POWER / m;
69+
k *= TRIDENT_POWER / m;
70+
l *= TRIDENT_POWER / m;
71+
playerEntity.addVelocity(h, k, l);
72+
playerEntity.useRiptide(20);
73+
if (playerEntity.isOnGround()) {
74+
float o = 1.1999999F;
75+
playerEntity.move(MovementType.SELF, new Vec3d(0.0, o, 0.0));
76+
}
77+
78+
world.playSoundFromEntity(null, playerEntity, SoundEvents.ITEM_TRIDENT_RIPTIDE_3, SoundCategory.PLAYERS, 1.0F, 1.0F);
79+
playerEntity.getItemCooldownManager().set(stack.getItem(), 80);
80+
}
81+
}
82+
}
83+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package nourl.mythicmetals.item.tools;
2+
3+
import net.minecraft.item.Item;
4+
import net.minecraft.item.SwordItem;
5+
import net.minecraft.item.ToolMaterial;
6+
7+
public class TidesingerToolSet extends ToolSet {
8+
public TidesingerToolSet(ToolMaterial material, int[] damage, float[] speed) {
9+
super(material, damage, speed);
10+
}
11+
12+
@Override
13+
protected SwordItem makeSword(ToolMaterial material, int damage, float speed, Item.Settings settings) {
14+
return new TidesingerSword(material, damage, speed, settings);
15+
}
16+
}

src/main/java/nourl/mythicmetals/misc/UsefulSingletonForColorUtil.java

+1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ public static class MetalColors {
6262
public static final Style AQUA_STYLE = Style.EMPTY.withColor(Formatting.AQUA);
6363
public static final Style GOLD_STYLE = Style.EMPTY.withColor(Formatting.GOLD);
6464
public static final Style PALLADIUM_STYLE = Style.EMPTY.withColor(MetalColors.PALLADIUM.rgb());
65+
public static final Style TIDESINGER_BLUE = Style.EMPTY.withColor(0x2F88FB);
6566
}
6667
}

src/main/java/nourl/mythicmetals/mixin/EnchantmentHelperMixin.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import nourl.mythicmetals.item.MythicItems;
1313
import nourl.mythicmetals.item.tools.MythicTools;
1414
import nourl.mythicmetals.item.tools.MythrilDrill;
15+
import nourl.mythicmetals.item.tools.TidesingerSword;
1516
import org.spongepowered.asm.mixin.Mixin;
1617
import org.spongepowered.asm.mixin.injection.At;
1718
import org.spongepowered.asm.mixin.injection.Inject;
@@ -157,13 +158,20 @@ public class EnchantmentHelperMixin {
157158
var amount = cir.getReturnValue();
158159
int change = 0;
159160
if (Abilities.SMITE.getItems().contains(stack.getItem()) && group == EntityGroup.UNDEAD) {
160-
change += Abilities.SMITE.getLevel() * 2.5f;
161+
change += (int) (Abilities.SMITE.getLevel() * 2.5f);
161162
}
162163
if (change != 0) {
163164
cir.setReturnValue(amount + change);
164165
}
165166
}
166167

168+
@Inject(method = "getRiptide", at = @At("TAIL"), cancellable = true)
169+
private static void mythicmetals$hasRiptide(ItemStack stack, CallbackInfoReturnable<Integer> cir) {
170+
if (stack.getItem() instanceof TidesingerSword) {
171+
cir.setReturnValue(Abilities.RIPTIDE.getLevel());
172+
}
173+
}
174+
167175
@Inject(method = "getKnockback", at = @At("TAIL"), cancellable = true)
168176
private static void mythicmetals$increaseKnockback(LivingEntity entity, CallbackInfoReturnable<Integer> cir) {
169177
var amount = cir.getReturnValue();

src/main/resources/assets/mythicmetals/lang/en_us.json

+1
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@
728728
"abilities.mythicmetals.midas_touch": "Midas Touch",
729729
"abilities.mythicmetals.projectile_protection": "Natural Projectile Protection",
730730
"abilities.mythicmetals.respiration": "Natural Respiration",
731+
"abilities.mythicmetals.riptide": "Riptide",
731732
"abilities.mythicmetals.smite": "Holy",
732733
"abilities.mythicmetals.spiked_helm": "Spiked Helmet",
733734
"abilities.mythicmetals.upgrade_tooltip": "Mythril Drill Upgrade",

0 commit comments

Comments
 (0)