Port to 1.21.7 (#642)

* Fix fabric.mod.json versioning (#635)

Update fabric.mod.json

* Fix RenderTypeRegistry.register parameters (#636)

* "Port" to 1.21.7

* Missed a 1.21.6

* Adapt to OnlyIn removal

NeoForge 21.7.3 has removed OnlyIn from production. This fixes the crash on startup when Architectury API is used on this version.

* Update workflows
We are keeping the same file name so we can continue the build numbers

---------

Co-authored-by: Jeb Feng <ranzeplay@outlook.com>
Co-authored-by: ENC_Euphony <47242104+pynickle@users.noreply.github.com>
Co-authored-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
Cassian Godsted
2025-07-23 11:17:53 -04:00
committed by GitHub
parent d153cf1e63
commit 55491e14cd
9 changed files with 41 additions and 33 deletions

View File

@@ -7,7 +7,7 @@ on:
- '**.properties'
- '**/src/**'
branches:
- "1.21.6"
- "1.21.7"
types: [ opened, synchronize, reopened ]
jobs:
validate-gradle:

View File

@@ -8,7 +8,7 @@ on:
- '**/src/**'
- '.github/**'
branches:
- "1.21.6"
- "1.21.7"
workflow_dispatch:
inputs:
norelease:

View File

@@ -22,7 +22,7 @@ package dev.architectury.registry.client.rendering;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.Fluid;
@@ -32,12 +32,12 @@ public final class RenderTypeRegistry {
}
@ExpectPlatform
public static void register(RenderType type, Block... blocks) {
public static void register(ChunkSectionLayer type, Block... blocks) {
throw new AssertionError();
}
@ExpectPlatform
public static void register(RenderType type, Fluid... fluids) {
public static void register(ChunkSectionLayer type, Fluid... fluids) {
throw new AssertionError();
}
}

View File

@@ -34,7 +34,7 @@
},
"icon": "icon.png",
"depends": {
"minecraft": "~1.21.6~",
"minecraft": "~1.21.7",
"fabricloader": ">=0.15.4",
"fabric-api": ">=0.127.0"
},

View File

@@ -3,8 +3,8 @@ org.gradle.daemon=false
platforms=fabric,neoforge
minecraft_version=1.21.6
supported_version=1.21.6
minecraft_version=1.21.7
supported_version=1.21.7
artifact_type=release
@@ -15,11 +15,11 @@ maven_group=dev.architectury
version_suffix=
fabric_loader_version=0.16.14
fabric_api_version=0.127.0+1.21.6
fabric_api_version=0.128.1+1.21.7
mod_menu_version=15.0.0-beta.1
forge_version=51.0.0
neoforge_version=21.6.4-beta
neoforge_version=21.7.3-beta
# Set to empty if not snapshots
neoforge_pr=

View File

@@ -121,7 +121,7 @@ unifiedPublishing {
displayName = "[NeoForge $rootProject.supported_version] v$project.version"
releaseType = "$rootProject.artifact_type"
changelog = releaseChangelog()
gameVersions = ["1.21.6"]
gameVersions = ["1.21.7"]
gameLoaders = ["neoforge"]
mainPublication renameJarForPublication

View File

@@ -30,7 +30,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
@EventBusSubscriber(modid = ArchitecturyConstants.MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
@EventBusSubscriber(modid = ArchitecturyConstants.MOD_ID, value = Dist.CLIENT)
public class ClientExtensionsRegistryImpl {
private static final List<Consumer<@Nullable RegisterClientExtensionsEvent>> CALLBACKS = new ArrayList<>();
private static boolean called = false;

View File

@@ -30,7 +30,6 @@ import dev.architectury.utils.ArchitecturyConstants;
import dev.architectury.utils.Env;
import net.minecraft.client.Minecraft;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.Packet;
@@ -49,6 +48,9 @@ import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import org.slf4j.Logger;
import static dev.architectury.networking.forge.client.ClientNetworkManagerImpl.getClientPlayer;
import static dev.architectury.networking.forge.client.ClientNetworkManagerImpl.getClientRegistryAccess;
public class NetworkManagerImpl {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -134,24 +136,4 @@ public class NetworkManagerImpl {
public static Packet<ClientGamePacketListener> createAddEntityPacket(Entity entity, ServerEntity serverEntity) {
return SpawnEntityPacket.create(entity, serverEntity);
}
@OnlyIn(Dist.CLIENT)
public static Player getClientPlayer() {
return Minecraft.getInstance().player;
}
@OnlyIn(Dist.CLIENT)
public static RegistryAccess getClientRegistryAccess() {
if (Minecraft.getInstance().level != null) {
return Minecraft.getInstance().level.registryAccess();
} else if (Minecraft.getInstance().getConnection() != null) {
return Minecraft.getInstance().getConnection().registryAccess();
} else if (Minecraft.getInstance().gameMode != null) {
// Sometimes the packet is sent way too fast and is between the connection and the level, better safe than sorry
return Minecraft.getInstance().gameMode.connection.registryAccess();
}
// Fail-safe
return RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
}
}

View File

@@ -0,0 +1,26 @@
package dev.architectury.networking.forge.client;
import net.minecraft.client.Minecraft;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.entity.player.Player;
public class ClientNetworkManagerImpl {
public static Player getClientPlayer() {
return Minecraft.getInstance().player;
}
public static RegistryAccess getClientRegistryAccess() {
if (Minecraft.getInstance().level != null) {
return Minecraft.getInstance().level.registryAccess();
} else if (Minecraft.getInstance().getConnection() != null) {
return Minecraft.getInstance().getConnection().registryAccess();
} else if (Minecraft.getInstance().gameMode != null) {
// Sometimes the packet is sent way too fast and is between the connection and the level, better safe than sorry
return Minecraft.getInstance().gameMode.connection.registryAccess();
}
// Fail-safe
return RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
}
}