Skip to content

Commit

Permalink
recipe manager sync works now
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Oct 5, 2024
1 parent db5ae14 commit 9b39aa5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/main/java/fi/dy/masa/itemscroller/data/DataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import fi.dy.masa.malilib.util.Constants;
import fi.dy.masa.itemscroller.ItemScroller;
import fi.dy.masa.itemscroller.Reference;
import fi.dy.masa.itemscroller.mixin.IMixinServerRecipeManager;
import fi.dy.masa.itemscroller.network.ServuxScrollerHandler;
import fi.dy.masa.itemscroller.network.ServuxScrollerPacket;

Expand Down Expand Up @@ -169,7 +170,11 @@ public boolean hasRecipes()

public @Nullable PreparedRecipes getPreparedRecipes()
{
if (!mc.isIntegratedServerRunning())
if (mc.isIntegratedServerRunning() && this.getRecipeManager() != null)
{
return ((IMixinServerRecipeManager) this.getRecipeManager()).itemscroller_getPreparedRecipes();
}
else if (this.hasRecipes())
{
return this.preparedRecipes;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package fi.dy.masa.itemscroller.mixin;

import net.minecraft.recipe.PreparedRecipes;
import net.minecraft.recipe.ServerRecipeManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(ServerRecipeManager.class)
public interface IMixinServerRecipeManager
{
@Accessor("preparedRecipes")
PreparedRecipes itemscroller_getPreparedRecipes();
}
5 changes: 4 additions & 1 deletion src/main/resources/mixins.itemscroller.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
],
"injectors": {
"defaultRequire": 1
}
},
"mixins": [
"IMixinServerRecipeManager"
]
}

0 comments on commit 9b39aa5

Please sign in to comment.