Skip to content

Commit

Permalink
Port to 1.20.5 (#493)
Browse files Browse the repository at this point in the history
* port to 1.20.5-rc1

* port to 1.20.5

* remove runtime mod menu

* Update build.gradle

* Prepare for publishing

Signed-off-by: shedaniel <[email protected]>

* Update shadow plugin to fix building J21 binaries

Signed-off-by: shedaniel <[email protected]>

---------

Signed-off-by: shedaniel <[email protected]>
Co-authored-by: shedaniel <[email protected]>
  • Loading branch information
Jab125 and shedaniel authored Apr 24, 2024
1 parent 8effe4a commit 3f0bf22
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 39 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ allprojects {

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
options.release = 21
}

javadoc {
Expand Down
4 changes: 2 additions & 2 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "com.github.johnrengelman.shadow" version "8.1.1"
id "me.shedaniel.unified-publishing"
}

Expand Down Expand Up @@ -128,7 +128,7 @@ unifiedPublishing {
curseforge {
token = CURSE_API_KEY
id = rootProject.curseforge_id
gameVersions.addAll "Java 17", "1.20.5-Snapshot"//, project.minecraft_version
gameVersions.addAll "Java 21", project.minecraft_version
}
}

Expand Down
10 changes: 6 additions & 4 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@
},
"icon": "icon.png",
"depends": {
"minecraft": "~1.20.3-",
"fabricloader": ">=0.14.0",
"fabric-api": ">=0.66.0"
"minecraft": "~1.20.5-",
"fabricloader": ">=0.15.6",
"fabric-api": ">=0.97.6"
},
"breaks": {
"optifabric": "<1.13.0"
},
"custom": {
"modmenu:api": true
"modmenu": {
"badges": ["library"]
}
}
}
22 changes: 11 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
org.gradle.jvmargs=-Xmx6G
org.gradle.daemon=false

platforms=fabric
platforms=fabric,neoforge

minecraft_version=1.20.5-pre1
supported_version=1.20.5-pre1
minecraft_version=1.20.5
supported_version=1.20.5

artifact_type=beta
artifact_type=release

archives_base_name=architectury
archives_base_name_snapshot=architectury-snapshot
base_version=12.0
maven_group=dev.architectury
version_suffix=-beta
version_suffix=

fabric_loader_version=0.15.9
fabric_api_version=0.96.15+1.20.5
mod_menu_version=9.0.0
fabric_loader_version=0.15.10
fabric_api_version=0.97.6+1.20.5
mod_menu_version=10.0.0-beta.1

forge_version=49.0.14
neoforge_version=20.5.0-alpha.24w14a.20240407.201521
forge_version=50.0.0
neoforge_version=20.5.0-beta

# Set to empty if not snapshots
neoforge_pr=794
neoforge_pr=

curseforge_id=419699
modrinth_id=lhGA9TYQ
2 changes: 1 addition & 1 deletion minecraftforge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "com.github.johnrengelman.shadow" version "8.1.1"
id "me.shedaniel.unified-publishing"
}

Expand Down
6 changes: 3 additions & 3 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "com.github.johnrengelman.shadow" version "8.1.1"
id "me.shedaniel.unified-publishing"
}

Expand Down Expand Up @@ -122,7 +122,7 @@ unifiedPublishing {
displayName = "[NeoForge $rootProject.supported_version] v$project.version"
releaseType = "$rootProject.artifact_type"
changelog = releaseChangelog()
gameVersions = ["1.20.4"]
gameVersions = ["1.20.5"]
gameLoaders = ["neoforge"]
mainPublication renameJarForPublication

Expand All @@ -131,7 +131,7 @@ unifiedPublishing {
curseforge {
token = CURSE_API_KEY
id = rootProject.curseforge_id
gameVersions.addAll "Java 17"
gameVersions.addAll "Java 21"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
public class EventHandlerImplClient {
@SubscribeEvent(priority = EventPriority.HIGH)
public static void event(ItemTooltipEvent event) {
ClientTooltipEvent.ITEM.invoker().append(event.getItemStack(), event.getToolTip(), event.getFlags());
ClientTooltipEvent.ITEM.invoker().append(event.getItemStack(), event.getToolTip(), event.getContext(), event.getFlags());
}

@SubscribeEvent(priority = EventPriority.HIGH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public static void eventChunkDataEvent(ChunkDataEvent.Save event) {

@SubscribeEvent(priority = EventPriority.HIGH)
public static void eventChunkDataEvent(ChunkDataEvent.Load event) {
LevelAccessor level = event.getChunk().getWorldForge();
LevelAccessor level = event.getChunk().getLevel();
if (!(level instanceof ServerLevel) && event instanceof LevelEventAttachment) {
level = ((LevelEventAttachment) event).architectury$getAttachedLevel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
import net.minecraft.world.entity.player.Player;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.event.RegisterPayloadHandlerEvent;
import net.neoforged.neoforge.network.handling.ISynchronizedWorkHandler;
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import org.slf4j.Logger;

public class NetworkManagerImpl {
Expand All @@ -56,9 +56,9 @@ public static NetworkAggregator.Adaptor getAdaptor() {
@Override
public <T extends CustomPacketPayload> void registerC2S(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, NetworkReceiver<T> receiver) {
EventBusesHooks.whenAvailable(ArchitecturyConstants.MOD_ID, bus -> {
bus.<RegisterPayloadHandlerEvent>addListener(event -> {
event.registrar(type.id().getNamespace()).optional().play(type, codec, (arg, context) -> {
receiver.receive(arg, context(context.player().orElse(null), context.workHandler(), false));
bus.<RegisterPayloadHandlersEvent>addListener(event -> {
event.registrar(type.id().getNamespace()).optional().playToServer(type, codec, (arg, context) -> {
receiver.receive(arg, context(context.player(), context, false));
});
});
});
Expand All @@ -67,9 +67,9 @@ public <T extends CustomPacketPayload> void registerC2S(CustomPacketPayload.Type
@Override
public <T extends CustomPacketPayload> void registerS2C(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, NetworkReceiver<T> receiver) {
EventBusesHooks.whenAvailable(ArchitecturyConstants.MOD_ID, bus -> {
bus.<RegisterPayloadHandlerEvent>addListener(event -> {
event.registrar(type.id().getNamespace()).optional().play(type, codec, (arg, context) -> {
receiver.receive(arg, context(context.player().orElse(null), context.workHandler(), true));
bus.<RegisterPayloadHandlersEvent>addListener(event -> {
event.registrar(type.id().getNamespace()).optional().playToClient(type, codec, (arg, context) -> {
receiver.receive(arg, context(context.player(), context, true));
});
});
});
Expand All @@ -91,7 +91,7 @@ public <T extends CustomPacketPayload> void registerS2CType(CustomPacketPayload.
});
}

public NetworkManager.PacketContext context(Player player, ISynchronizedWorkHandler taskQueue, boolean client) {
public NetworkManager.PacketContext context(Player player, IPayloadContext taskQueue, boolean client) {
return new NetworkManager.PacketContext() {
@Override
public Player getPlayer() {
Expand All @@ -100,7 +100,7 @@ public Player getPlayer() {

@Override
public void queue(Runnable runnable) {
taskQueue.submitAsync(runnable);
taskQueue.enqueueWork(runnable);
}

@Override
Expand All @@ -120,14 +120,14 @@ public RegistryAccess registryAccess() {
@OnlyIn(Dist.CLIENT)
public static boolean canServerReceive(ResourceLocation id) {
if (Minecraft.getInstance().getConnection() != null) {
return Minecraft.getInstance().getConnection().isConnected(id);
return Minecraft.getInstance().getConnection().hasChannel(id);
} else {
return false;
}
}

public static boolean canPlayerReceive(ServerPlayer player, ResourceLocation id) {
return player.connection.isConnected(id);
return player.connection.hasChannel(id);
}

public static Packet<ClientGamePacketListener> createAddEntityPacket(Entity entity) {
Expand Down
2 changes: 1 addition & 1 deletion neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ side = "BOTH"
[[dependencies.architectury]]
modId = "neoforge"
type = "required"
versionRange = "[20.5.0-alpha.24w14a,)"
versionRange = "[20.5.0-beta,)"
ordering = "NONE"
side = "BOTH"

Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ include("common")
include("fabric")
//include("forge")
//include("minecraftforge")
//include("neoforge")
include("neoforge")
include("testmod-common")
include("testmod-fabric")
//include("testmod-forge")
//include("testmod-neoforge")
include("testmod-neoforge")

rootProject.name = "architectury"

0 comments on commit 3f0bf22

Please sign in to comment.