-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relates to #829
- Loading branch information
Showing
12 changed files
with
191 additions
and
20 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
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
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,24 @@ | ||
plugins { | ||
id("dev.architectury.loom") | ||
} | ||
|
||
val versionMc: String by rootProject | ||
val versionForge: String by rootProject | ||
|
||
loom { | ||
forge { | ||
mixinConfig("mixins.pehkuibridge.json") | ||
} | ||
mixin { | ||
defaultRefmapName.set("refmap.pehkuibridge.json") | ||
} | ||
} | ||
|
||
dependencies { | ||
mappings(loom.officialMojangMappings()) | ||
forge("net.minecraftforge:forge:$versionMc-$versionForge") | ||
|
||
modImplementation(group = "dev.su5ed.sinytra.fabric-api", name = "fabric-api-base", version = "0.4.31+ef105b4977") | ||
|
||
modImplementation(group = "curse.maven", name = "pehkui-319596", version = "4974824") | ||
} |
8 changes: 8 additions & 0 deletions
8
pehkui-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/pehkuibridge/PehkuiBridge.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,8 @@ | ||
package dev.su5ed.sinytra.connectorextras.pehkuibridge; | ||
|
||
import net.minecraftforge.fml.common.Mod; | ||
|
||
@Mod("connectorextras_pehkui_bridge") | ||
public class PehkuiBridge { | ||
public static final String PEHKUI_MODID = "pehkui"; | ||
} |
42 changes: 42 additions & 0 deletions
42
...src/main/java/dev/su5ed/sinytra/connectorextras/pehkuibridge/PehkuiBridgeMixinPlugin.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.pehkuibridge; | ||
|
||
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 PehkuiBridgeMixinPlugin implements IMixinConfigPlugin { | ||
private static final Supplier<Boolean> PEHKUI_LOADED = Suppliers.memoize(() -> LoadingModList.get().getModFileById(PehkuiBridge.PEHKUI_MODID) != null); | ||
|
||
@Override | ||
public void onLoad(String mixinPackage) {} | ||
|
||
@Override | ||
public String getRefMapperConfig() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { | ||
return PEHKUI_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) {} | ||
} |
61 changes: 61 additions & 0 deletions
61
...ge/src/main/java/dev/su5ed/sinytra/connectorextras/pehkuibridge/mixin/ScaleTypeMixin.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,61 @@ | ||
package dev.su5ed.sinytra.connectorextras.pehkuibridge.mixin; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import virtuoel.pehkui.api.ScaleEventCallback; | ||
import virtuoel.pehkui.api.ScaleType; | ||
|
||
@Mixin(ScaleType.class) | ||
public class ScaleTypeMixin { | ||
@Unique | ||
private Event<ScaleEventCallback> connectorextras_scaleTypeChangedEvent; | ||
@Unique | ||
private Event<ScaleEventCallback> connectorextras_preTickChangedEvent = connector_createScaleEvent(); | ||
@Unique | ||
private Event<ScaleEventCallback> connectorextras_postTickChangedEvent = connector_createScaleEvent(); | ||
|
||
@Inject(method = "<init>", at = @At("TAIL")) | ||
private void onInit(ScaleType.Builder builder, CallbackInfo ci) { | ||
this.connectorextras_scaleTypeChangedEvent = connector_createScaleEvent(); | ||
this.connectorextras_preTickChangedEvent = connector_createScaleEvent(); | ||
this.connectorextras_postTickChangedEvent = connector_createScaleEvent(); | ||
((ScaleType) (Object) this).getScaleChangedEvent().add(data -> connectorextras_scaleTypeChangedEvent.invoker().onEvent(data)); | ||
((ScaleType) (Object) this).getPreTickEvent().add(data -> connectorextras_preTickChangedEvent.invoker().onEvent(data)); | ||
((ScaleType) (Object) this).getPostTickEvent().add(data -> connectorextras_postTickChangedEvent.invoker().onEvent(data)); | ||
} | ||
|
||
@Unique | ||
public Event<ScaleEventCallback> getScaleChangedEvent() { | ||
return this.connectorextras_scaleTypeChangedEvent; | ||
} | ||
|
||
@Unique | ||
public Event<ScaleEventCallback> getPreTickEvent() { | ||
return this.connectorextras_preTickChangedEvent; | ||
} | ||
|
||
@Unique | ||
public Event<ScaleEventCallback> getPostTickEvent() { | ||
return this.connectorextras_postTickChangedEvent; | ||
} | ||
|
||
@Unique | ||
private static Event<ScaleEventCallback> connector_createScaleEvent() { | ||
return EventFactory.createArrayBacked( | ||
ScaleEventCallback.class, | ||
data -> { | ||
}, | ||
callbacks -> data -> | ||
{ | ||
for (ScaleEventCallback callback : callbacks) { | ||
callback.onEvent(data); | ||
} | ||
} | ||
); | ||
} | ||
} |
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_pehkui_bridge" | ||
version="${file.jarVersion}" | ||
displayName="Connector Extras Pehkui Bridge" | ||
authors="Su5eD" | ||
displayURL="https://github.com/Sinytra/ConnectorExtras" | ||
description=''' | ||
Compatibility bridge for Pehkui's Fabric API on Forge | ||
''' | ||
displayTest = 'IGNORE_ALL_VERSION' | ||
[[dependencies.connectorextras_pehkui_bridge]] | ||
modId="forge" | ||
mandatory=true | ||
versionRange="[47,)" | ||
ordering="NONE" | ||
side="BOTH" | ||
[[dependencies.connectorextras_pehkui_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.pehkuibridge.mixin", | ||
"plugin": "dev.su5ed.sinytra.connectorextras.pehkuibridge.PehkuiBridgeMixinPlugin", | ||
"mixins": [ | ||
"ScaleTypeMixin" | ||
] | ||
} |
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 pehkuibridge", | ||
"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 |
---|---|---|
|
@@ -44,5 +44,6 @@ include( | |
"forgeconfigapiport", | ||
"extras-utils", | ||
"kubejs-bridge", | ||
"jei-bridge" | ||
"jei-bridge", | ||
"pehkui-bridge" | ||
) |