Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ loader_version=0.16.10
fabric_kotlin_version=1.13.1+kotlin.2.1.10

# Mod Properties
mod_version=1.1.6
mod_version=1.1.7
maven_group=gay.thehivemind.hexchanting
archives_base_name=hexchanting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Pair;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -57,17 +59,18 @@ public void triggerBootsOnFall(ServerPlayerEntity instance, double heightDiffere
public void triggerLeggingsOnDeath(DamageSource source, Operation<Void> original) {
// We want to trigger the spell after items have been splattered, but we need to check the player's
// inventory before that else the armour won't be present
Optional<ItemStack> hexPantsStack = StreamSupport.stream(this.getArmorItems().spliterator(), false)
Optional<Pair<ItemStack,HexArmorItem>> hexPantsStack = StreamSupport.stream(this.getArmorItems().spliterator(), false)
.filter((ItemStack stack) -> stack.getItem() instanceof HexArmorItem armour && armour.getType() == ArmorItem.Type.LEGGINGS)
.map((ItemStack stack) -> new Pair<>(stack, (HexArmorItem) stack.getItem()))
.findFirst();

// Always need to call the original function
original.call(source);

// If the armour is present then cast
// FIX: There'll be no media available so this will draw from the item
hexPantsStack.ifPresent((ItemStack stack) -> {
((HexArmorItem) stack.getItem()).castOnDeath(stack, source, this);
hexPantsStack.ifPresent((Pair<ItemStack,HexArmorItem> pair) -> {
pair.getRight().castOnDeath(pair.getLeft(), source, this);
});
}
}
Loading