Fix Vanish patch and fix neoforge mods.toml not being resolved

This commit is contained in:
2024-05-19 18:42:46 +02:00
parent 82860ec672
commit f64efbd228
7 changed files with 69 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
plugins {
id 'java'
id "com.hypherionmc.modutils.orion" version "1.0.13"
id "com.hypherionmc.modutils.orion" version "1.0.14"
}
orionporting {

View File

@@ -1 +1 @@
f712036d2e19267bd281397fb48ba4fe94774efa
d9fcf547281e42215550a62152f436953b550e68

View File

@@ -1,5 +1,14 @@
--- a/Forge/build.gradle
+++ b/Forge/build.gradle
@@ -3,7 +3,7 @@
dependencies {
// Compat
- // NOT AVAILABLE ON FORGE modImplementation("maven.modrinth:vanishmod:${vanishmod}")
+ modImplementation("maven.modrinth:vanishmod:${vanishmod}")
// Do not edit or remove
implementation project(":Common")
@@ -104,8 +104,8 @@
setVersionType("release")
setChangelog("https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-forge.md")

View File

@@ -0,0 +1,20 @@
--- a/Forge/src/main/java/com/hypherionmc/craterlib/CraterLib.java
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/CraterLib.java
@@ -3,6 +3,7 @@
import com.hypherionmc.craterlib.api.events.client.LateInitEvent;
import com.hypherionmc.craterlib.common.ForgeServerEvents;
import com.hypherionmc.craterlib.core.event.CraterEventBus;
+import com.hypherionmc.craterlib.compat.Vanish;
import com.hypherionmc.craterlib.core.networking.CraterPacketNetwork;
import com.hypherionmc.craterlib.core.networking.data.PacketSide;
import com.hypherionmc.craterlib.core.platform.ModloaderEnvironment;
@@ -32,5 +33,9 @@
LateInitEvent event = new LateInitEvent(new BridgedMinecraft(), BridgedOptions.of(Minecraft.getInstance().options));
CraterEventBus.INSTANCE.postEvent(event);
});
+
+ if (ModloaderEnvironment.INSTANCE.isModLoaded("vmod")) {
+ MinecraftForge.EVENT_BUS.register(new Vanish());
+ }
}
}

View File

@@ -0,0 +1,28 @@
--- /dev/null
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/compat/Vanish.java
@@ -1,0 +1,25 @@
+package com.hypherionmc.craterlib.compat;
+
+import com.hypherionmc.craterlib.api.events.server.CraterPlayerEvent;
+import com.hypherionmc.craterlib.core.event.CraterEventBus;
+import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
+import net.minecraft.world.entity.player.Player;
+import net.minecraftforge.eventbus.api.SubscribeEvent;
+import redstonedubstep.mods.vanishmod.api.PlayerVanishEvent;
+
+public class Vanish {
+
+ public Vanish() {
+
+ }
+
+ @SubscribeEvent
+ public void vanishevent(PlayerVanishEvent event) {
+ if (event.isVanished()) {
+ CraterEventBus.INSTANCE.postEvent(new CraterPlayerEvent.PlayerLoggedOut(BridgedPlayer.of(event.getEntity())));
+ } else {
+ CraterEventBus.INSTANCE.postEvent(new CraterPlayerEvent.PlayerLoggedIn(BridgedPlayer.of(event.getEntity())));
+ }
+ }
+
+}

View File

@@ -1,5 +1,14 @@
--- a/NeoForge/build.gradle
+++ b/NeoForge/build.gradle
@@ -50,7 +50,7 @@
from project(":Common").sourceSets.main.resources
def buildProps = project.properties.clone()
- filesMatching("META-INF/neoforge.mods.toml") {
+ filesMatching("META-INF/mods.toml") {
expand buildProps
}
}
@@ -103,8 +103,8 @@
setVersionType("release")
setChangelog("https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-forge.md")

View File

@@ -10,4 +10,4 @@ pluginManagement {
}
}
rootProject.name = 'CraterLib'
rootProject.name = 'CraterLibPort'