Skip to content

Commit

Permalink
Refactored and rewrote StewStack, now it's toggable
Browse files Browse the repository at this point in the history
-It is no longer a mixin (though uses mixins under the hood i think but still) (also now it has better mod compat out of the box bc of the use of DefaultItemComponentEvents instead of the previous method w Mixins)
-Now StewStackBool finally works as intented
  • Loading branch information
flatkat committed Sep 21, 2024
1 parent 53dd3bc commit 8358546
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 63 deletions.
3 changes: 3 additions & 0 deletions src/main/java/dev/symphony/harmony/Harmony.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static dev.symphony.harmony.food.StewStack.StewStackMethod;

public class Harmony implements ModInitializer {
public static final String MOD_ID = "harmony";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
Expand All @@ -17,5 +19,6 @@ public static Identifier id (String path) {
@Override
public void onInitialize() {
// be gay, do crime
StewStackMethod();
}
}
39 changes: 39 additions & 0 deletions src/main/java/dev/symphony/harmony/food/StewStack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package dev.symphony.harmony.food;

import dev.symphony.harmony.config.HarmonyConfig;
import net.fabricmc.fabric.api.item.v1.DefaultItemComponentEvents;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.item.Items;

public class StewStack {

// Would be nice if this was applied to all items with a specific custom item tag to facilitate mod compat.
public static void StewStackMethod(){
if(HarmonyConfig.StewStackBool){

DefaultItemComponentEvents.MODIFY.register(context -> {
context.modify(Items.MUSHROOM_STEW, builder -> {
builder.add(DataComponentTypes.MAX_STACK_SIZE, HarmonyConfig.StewStackSize);
});
});

DefaultItemComponentEvents.MODIFY.register(context -> {
context.modify(Items.BEETROOT_SOUP, builder -> {
builder.add(DataComponentTypes.MAX_STACK_SIZE, HarmonyConfig.StewStackSize);
});
});

DefaultItemComponentEvents.MODIFY.register(context -> {
context.modify(Items.RABBIT_STEW, builder -> {
builder.add(DataComponentTypes.MAX_STACK_SIZE, HarmonyConfig.StewStackSize);
});
});

DefaultItemComponentEvents.MODIFY.register(context -> {
context.modify(Items.SUSPICIOUS_STEW, builder -> {
builder.add(DataComponentTypes.MAX_STACK_SIZE, HarmonyConfig.StewStackSize);
});
});
}
}
}
62 changes: 0 additions & 62 deletions src/main/java/dev/symphony/harmony/mixin/food/StewStack.java

This file was deleted.

1 change: 0 additions & 1 deletion src/main/resources/harmony.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"compatibilityLevel": "JAVA_21",

"mixins": [
"food.StewStack",
"transportation.VehiclesMoveThroughLeaves"
],

Expand Down

0 comments on commit 8358546

Please sign in to comment.