-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
276 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
plugins { | ||
id("dev.architectury.loom") | ||
} | ||
|
||
val versionMc: String by rootProject | ||
val versionForge: String by rootProject | ||
|
||
loom { | ||
forge { | ||
mixinConfig("mixins.jeibridge.json") | ||
} | ||
mixin { | ||
defaultRefmapName.set("refmap.jeibridge.json") | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "Jared's maven" | ||
url = uri("https://maven.blamejared.com/") | ||
} | ||
} | ||
|
||
dependencies { | ||
mappings(loom.officialMojangMappings()) | ||
forge("net.minecraftforge:forge:$versionMc-$versionForge") | ||
|
||
modImplementation(group = "dev.su5ed.sinytra", name = "fabric-loader", version = "2.3.4+0.14.21+1.20.1") | ||
modImplementation(group = "dev.su5ed.sinytra.fabric-api", name = "fabric-transfer-api-v1", version = "3.3.1+6acac45477") | ||
|
||
modImplementation(group = "mezz.jei", name = "jei-$versionMc-forge", version = "15.2.0.27") | ||
} |
11 changes: 11 additions & 0 deletions
11
jei-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/jeibridge/JEIBridge.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,11 @@ | ||
package dev.su5ed.sinytra.connectorextras.jeibridge; | ||
|
||
import com.mojang.logging.LogUtils; | ||
import net.minecraftforge.fml.common.Mod; | ||
import org.slf4j.Logger; | ||
|
||
@Mod("connectorextras_jei_bridge") | ||
public class JEIBridge { | ||
private static final Logger LOGGER = LogUtils.getLogger(); | ||
public static final String JEI_MODID = "jei"; | ||
} |
42 changes: 42 additions & 0 deletions
42
...ridge/src/main/java/dev/su5ed/sinytra/connectorextras/jeibridge/JEIBridgeMixinPlugin.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,42 @@ | ||
package dev.su5ed.sinytra.connectorextras.jeibridge; | ||
|
||
import com.google.common.base.Suppliers; | ||
import net.minecraftforge.fml.loading.LoadingModList; | ||
import org.objectweb.asm.tree.ClassNode; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.function.Supplier; | ||
|
||
public class JEIBridgeMixinPlugin implements IMixinConfigPlugin { | ||
private static final Supplier<Boolean> JEI_LOADED = Suppliers.memoize(() -> LoadingModList.get().getModFileById(JEIBridge.JEI_MODID) != null); | ||
|
||
@Override | ||
public void onLoad(String mixinPackage) {} | ||
|
||
@Override | ||
public String getRefMapperConfig() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { | ||
return JEI_LOADED.get(); | ||
} | ||
|
||
@Override | ||
public List<String> getMixins() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {} | ||
|
||
@Override | ||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} | ||
|
||
@Override | ||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} | ||
} |
30 changes: 30 additions & 0 deletions
30
...c/main/java/dev/su5ed/sinytra/connectorextras/jeibridge/mixin/ForgePluginFinderMixin.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,30 @@ | ||
package dev.su5ed.sinytra.connectorextras.jeibridge.mixin; | ||
|
||
import mezz.jei.api.IModPlugin; | ||
import mezz.jei.forge.startup.ForgePluginFinder; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
import net.fabricmc.loader.api.entrypoint.EntrypointContainer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Mixin(ForgePluginFinder.class) | ||
public abstract class ForgePluginFinderMixin { | ||
@Inject(method = "getModPlugins", at = @At("RETURN"), remap = false, cancellable = true) | ||
private static void connectorextras_jei_bridge$addFabricPlugins(CallbackInfoReturnable<List<IModPlugin>> cir) { | ||
List<IModPlugin> forgePlugins = cir.getReturnValue(); | ||
List<IModPlugin> fabricPlugins = FabricLoader.getInstance() | ||
.getEntrypointContainers("jei_mod_plugin", IModPlugin.class) | ||
.stream() | ||
.map(EntrypointContainer::getEntrypoint) | ||
.toList(); | ||
List<IModPlugin> merged = new ArrayList<>(); | ||
merged.addAll(forgePlugins); | ||
merged.addAll(fabricPlugins); | ||
cir.setReturnValue(merged); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
jei-bridge/src/main/java/mezz/jei/api/fabric/constants/FabricTypes.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,58 @@ | ||
/* | ||
* This file is licensed under the MIT License, part of Just Enough Items. | ||
* Copyright (c) 2014-2015 mezz | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package mezz.jei.api.fabric.constants; | ||
|
||
import mezz.jei.api.ingredients.IIngredientType; | ||
import mezz.jei.api.ingredients.IIngredientTypeWithSubtypes; | ||
import mezz.jei.api.fabric.ingredients.fluids.IJeiFluidIngredient; | ||
import net.minecraft.world.level.material.Fluid; | ||
|
||
/** | ||
* Built-in {@link IIngredientType} for Fabric Minecraft. | ||
* | ||
* @since 10.1.0 | ||
*/ | ||
public final class FabricTypes { | ||
/** | ||
* @since 10.1.0 | ||
*/ | ||
public static final IIngredientTypeWithSubtypes<Fluid, IJeiFluidIngredient> FLUID_STACK = new IIngredientTypeWithSubtypes<>() { | ||
@Override | ||
public Class<? extends IJeiFluidIngredient> getIngredientClass() { | ||
return IJeiFluidIngredient.class; | ||
} | ||
|
||
@Override | ||
public Class<? extends Fluid> getIngredientBaseClass() { | ||
return Fluid.class; | ||
} | ||
|
||
@Override | ||
public Fluid getBase(IJeiFluidIngredient ingredient) { | ||
return ingredient.getFluid(); | ||
} | ||
}; | ||
|
||
private FabricTypes() {} | ||
} |
57 changes: 57 additions & 0 deletions
57
jei-bridge/src/main/java/mezz/jei/api/fabric/ingredients/fluids/IJeiFluidIngredient.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,57 @@ | ||
/* | ||
* This file is licensed under the MIT License, part of Just Enough Items. | ||
* Copyright (c) 2014-2015 mezz | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package mezz.jei.api.fabric.ingredients.fluids; | ||
|
||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.world.level.material.Fluid; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* Built-in ingredient for representing Fluids in Fabric Minecraft. | ||
* | ||
* @since 10.1.0 | ||
*/ | ||
public interface IJeiFluidIngredient { | ||
/** | ||
* @return the fluid represented by this ingredient. | ||
* | ||
* @since 10.1.0 | ||
*/ | ||
Fluid getFluid(); | ||
|
||
/** | ||
* @return the amount of fluid. | ||
* | ||
* @since 10.1.0 | ||
*/ | ||
long getAmount(); | ||
|
||
/** | ||
* @return optionally any {@link CompoundTag} extra data for this fluid ingredient. | ||
* | ||
* @since 10.1.0 | ||
*/ | ||
Optional<CompoundTag> getTag(); | ||
} |
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,27 @@ | ||
modLoader="javafml" | ||
loaderVersion="[47,)" | ||
license="MIT" | ||
issueTrackerURL="https://github.com/Sinytra/ConnectorExtras/issues" | ||
|
||
[[mods]] | ||
modId="connectorextras_jei_bridge" | ||
version="${file.jarVersion}" | ||
displayName="Connector Extras JEI Bridge" | ||
authors="Su5eD" | ||
displayURL="https://github.com/Sinytra/ConnectorExtras" | ||
description=''' | ||
Loads JEI plugins of Fabric mods on Forge. | ||
''' | ||
displayTest = 'IGNORE_ALL_VERSION' | ||
[[dependencies.connectorextras_jei_bridge]] | ||
modId="forge" | ||
mandatory=true | ||
versionRange="[47,)" | ||
ordering="NONE" | ||
side="BOTH" | ||
[[dependencies.connectorextras_jei_bridge]] | ||
modId="minecraft" | ||
mandatory=true | ||
versionRange="[1.20.1,1.21)" | ||
ordering="NONE" | ||
side="BOTH" |
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,10 @@ | ||
{ | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_16", | ||
"required": true, | ||
"package": "dev.su5ed.sinytra.connectorextras.jeibridge.mixin", | ||
"plugin": "dev.su5ed.sinytra.connectorextras.jeibridge.JEIBridgeMixinPlugin", | ||
"mixins": [ | ||
"ForgePluginFinderMixin" | ||
] | ||
} |
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,6 @@ | ||
{ | ||
"pack": { | ||
"description": "The default data for jeibridge", | ||
"pack_format": 15 | ||
} | ||
} |
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 |
---|---|---|
|
@@ -43,5 +43,6 @@ include( | |
"amecs-api", | ||
"forgeconfigapiport", | ||
"extras-utils", | ||
"kubejs-bridge" | ||
"kubejs-bridge", | ||
"jei-bridge" | ||
) |