Skip to content

Commit

Permalink
Add another check for TableBonusLootConditionMixin, bumps version
Browse files Browse the repository at this point in the history
Signed-off-by: Noaaan <[email protected]>
  • Loading branch information
Noaaan committed Mar 17, 2024
1 parent aa89edb commit 4da5def
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
7 changes: 7 additions & 0 deletions PATCHNOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.19.6

## Fixes

- Fix another Mixin issue related to Aether Redux (#229, #231)
- Include the language fix from previous patch (1.20.4 only)

# 0.19.5

## Changes
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ yarn_mappings=1.20.1+build.9
loader_version=0.14.21

# Mod Properties
mod_version = 0.19.5+1.20.1
mod_version = 0.19.6+1.20.1
maven_group = nourl.mythicmetals
archives_base_name = mythicmetals

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ public class ApplyBonusLootFunctionMixin {
ordinal = 0)
private int mythicmetals$increaseFortune(int level, ItemStack drop, LootContext lootCtx) {
// Return early if there is no item
var toolCtx = lootCtx.get(LootContextParameters.TOOL);
if (toolCtx == null) {
var toolCtxStack = lootCtx.get(LootContextParameters.TOOL);
if (toolCtxStack == null) {
return level;
}

if (Abilities.BONUS_FORTUNE.getItems().contains(toolCtx.getItem())) {
if (Abilities.BONUS_FORTUNE.getItems().contains(toolCtxStack.getItem())) {
return level + Abilities.BONUS_FORTUNE.getLevel();
}
if (MythrilDrill.hasUpgradeItem(toolCtx, MythicBlocks.CARMOT.getStorageBlock().asItem())) {
if (MythrilDrill.hasUpgradeItem(toolCtxStack, MythicBlocks.CARMOT.getStorageBlock().asItem())) {
return level + 1;
}
return level;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import java.util.Objects;

@Mixin(TableBonusLootCondition.class)
public class TableBonusLootConditionMixin {
Expand All @@ -21,15 +20,19 @@ public class TableBonusLootConditionMixin {
@ModifyVariable(method = "test(Lnet/minecraft/loot/context/LootContext;)Z",
at = @At(value = "LOAD"))
private int mythicmetals$increaseFortune(int level, LootContext lootCtx) {
var toolCtxStack = lootCtx.get(LootContextParameters.TOOL);
if (toolCtxStack == null) {
return level;
}
// only modify when the loot table bonus loot checks for fortune
if(this.enchantment != Enchantments.FORTUNE) {
return level;
}

if (Abilities.BONUS_FORTUNE.getItems().contains(Objects.requireNonNull(lootCtx.get(LootContextParameters.TOOL)).getItem())) {
if (Abilities.BONUS_FORTUNE.getItems().contains(toolCtxStack.getItem())) {
return (level + Abilities.BONUS_FORTUNE.getLevel());
}
if (MythrilDrill.hasUpgradeItem(Objects.requireNonNull(lootCtx.get(LootContextParameters.TOOL)), MythicBlocks.CARMOT.getStorageBlock().asItem())) {
if (MythrilDrill.hasUpgradeItem(toolCtxStack, MythicBlocks.CARMOT.getStorageBlock().asItem())) {
return level + 1;
}
return level;
Expand Down

0 comments on commit 4da5def

Please sign in to comment.