[NO-ORBIT] Unified Porting Branch

This commit is contained in:
2024-05-19 19:08:42 +02:00
parent f64efbd228
commit be3fc20246
277 changed files with 8174 additions and 128 deletions

View File

@@ -0,0 +1,22 @@
--- 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")
setProjectVersion("${minecraft_version}-${project.version}")
- setDisplayName("[Forge 1.20.6] CraterLib - ${project.version}")
- setGameVersions("1.20.6")
+ setDisplayName("[Forge 1.20.2] CraterLib - ${project.version}")
+ setGameVersions("1.20.2")
setLoaders("forge")
setArtifact(remapJar)
setCurseEnvironment("both")

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

@@ -0,0 +1,11 @@
--- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
@@ -22,7 +22,7 @@
public ServerPlayer player;
@Inject(
- method = "lambda$handleChat$5",
+ method = "lambda$handleChat$6",
at = @At("HEAD"),
cancellable = true
)

View File

@@ -0,0 +1,11 @@
--- a/Forge/src/main/java/com/hypherionmc/craterlib/network/CraterForgeNetworkHandler.java
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/network/CraterForgeNetworkHandler.java
@@ -36,7 +36,7 @@
protected <T> void registerPacket(PacketHolder<T> holder) {
if (CHANNELS.get(holder.messageType()) == null) {
SimpleChannel channel = ChannelBuilder
- .named(holder.type().id())
+ .named(holder.type().toMojang())
.clientAcceptedVersions((a, b) -> true)
.serverAcceptedVersions((a, b) -> true)
.networkProtocolVersion(1)

View File

@@ -0,0 +1,25 @@
--- a/Forge/src/main/resources/META-INF/mods.toml
+++ b/Forge/src/main/resources/META-INF/mods.toml
@@ -1,5 +1,5 @@
modLoader = "javafml"
-loaderVersion = "[50,)"
+loaderVersion = "[48,)"
license = "MIT"
issueTrackerURL = "https://github.com/firstdarkdev/craterLib/issues"
@@ -19,13 +19,13 @@
[[dependencies.${ mod_id }]]
modId = "forge"
mandatory = true
- versionRange = "[50,)"
+ versionRange = "[48,)"
ordering = "NONE"
side = "BOTH"
[[dependencies.${ mod_id }]]
modId = "minecraft"
mandatory = true
- versionRange = "[1.20.6,1.21)"
+ versionRange = "[1.20.2,1.20.3)"
ordering = "NONE"
side = "BOTH"