-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move jei plugins to platform modules
- Loading branch information
1 parent
ef13fd0
commit 326d7bd
Showing
7 changed files
with
60 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
common/src/main/java/galena/blissful/compat/BlissfulJeiCompat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package galena.blissful.compat; | ||
|
||
import galena.blissful.BlissfulConstants; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.alchemy.PotionUtils; | ||
|
||
public class BlissfulJeiCompat { | ||
|
||
public static final ResourceLocation ID = new ResourceLocation(BlissfulConstants.MOD_ID, "jei"); | ||
|
||
public static String interpretPotion(ItemStack ingredient, Object unused) { | ||
var potion = PotionUtils.getPotion(ingredient); | ||
var effects = PotionUtils.getMobEffects(ingredient); | ||
var builder = new StringBuilder(potion.getName("")); | ||
effects.forEach(it -> builder.append(";").append(it)); | ||
return builder.toString(); | ||
} | ||
} |
33 changes: 0 additions & 33 deletions
33
common/src/main/java/galena/blissful/compat/BlissfulJeiPlugin.java
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
fabric/src/main/java/galena/blissful/fabric/compat/BlissfulJeiFabricPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package galena.blissful.fabric.compat; | ||
|
||
import galena.blissful.compat.BlissfulJeiCompat; | ||
import galena.blissful.index.BlissfuItems; | ||
import mezz.jei.api.IModPlugin; | ||
import mezz.jei.api.registration.ISubtypeRegistration; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
public class BlissfulJeiFabricPlugin implements IModPlugin { | ||
|
||
@Override | ||
public ResourceLocation getPluginUid() { | ||
return BlissfulJeiCompat.ID; | ||
} | ||
|
||
@Override | ||
public void registerItemSubtypes(ISubtypeRegistration registration) { | ||
registration.registerSubtypeInterpreter(BlissfuItems.POTION_BONG.get(), BlissfulJeiCompat::interpretPotion); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 17 additions & 3 deletions
20
forge/src/main/java/galena/blissful/forge/compat/BlissfulForgeJeiPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,32 @@ | ||
package galena.blissful.forge.compat; | ||
|
||
import galena.blissful.compat.BlissfulJeiPlugin; | ||
import galena.blissful.compat.BlissfulJeiCompat; | ||
import galena.blissful.index.BlissfuItems; | ||
import mezz.jei.api.IModPlugin; | ||
import mezz.jei.api.JeiPlugin; | ||
import mezz.jei.api.registration.IRecipeRegistration; | ||
import mezz.jei.api.registration.ISubtypeRegistration; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraftforge.fml.ModList; | ||
|
||
@JeiPlugin | ||
public class BlissfulForgeJeiPlugin extends BlissfulJeiPlugin { | ||
public class BlissfulForgeJeiPlugin implements IModPlugin { | ||
|
||
@Override | ||
public void registerRecipes(IRecipeRegistration registration) { | ||
if(ModList.get().isLoaded("create")) { | ||
if (ModList.get().isLoaded("create")) { | ||
CreateCompat.addJeiRecipes(registration); | ||
} | ||
} | ||
|
||
@Override | ||
public ResourceLocation getPluginUid() { | ||
return BlissfulJeiCompat.ID; | ||
} | ||
|
||
@Override | ||
public void registerItemSubtypes(ISubtypeRegistration registration) { | ||
registration.registerSubtypeInterpreter(BlissfuItems.POTION_BONG.get(), BlissfulJeiCompat::interpretPotion); | ||
} | ||
|
||
} |