Port to 1.21.11 (#685)

* feat: Port to 1.21.11

* style: remove some unused import

* fix: fix the wrong workflow

* chore: only setup gradle once

* fix: fix validate access wideners error

* fix: fix testmod not working

* fix: fix game rule test error

* fix: add missing part

* fix: fix neoforge grass color override
This commit is contained in:
ENC_Euphony
2025-12-16 12:16:42 +08:00
committed by GitHub
parent ab35a72832
commit 369c884819
84 changed files with 538 additions and 920 deletions

View File

@@ -1,4 +1,4 @@
name: Build PR snapshot (1.21.9)
name: Build PR snapshot (1.21.11)
on:
pull_request:
@@ -7,35 +7,35 @@ on:
- '**.properties'
- '**/src/**'
branches:
- "1.21.9"
- "1.21.10"
- "1.21.11"
types: [ opened, synchronize, reopened ]
jobs:
validate-gradle:
name: "Validate Gradle wrapper"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: gradle/actions/wrapper-validation@v3
- uses: gradle/actions/wrapper-validation@v5
license:
name: "Verify License integrity"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v2
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
- name: Setup Gradle and verify license using Licenser
uses: gradle/gradle-build-action@v2
with:
arguments: licenseCheck
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Verify license using Licenser
run: ./gradlew licenseCheck
build:
name: "Build"
@@ -43,18 +43,19 @@ jobs:
if: |
!contains(github.event.pull_request.title, '[ci skip]')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v2
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
- name: Setup and Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build --stacktrace --no-daemon
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Build with Gradle
run: ./gradlew build --stacktrace --no-daemon
- name: Setting mod version
run: |
@@ -63,7 +64,7 @@ jobs:
cat $GITHUB_WORKSPACE/gradle.properties | grep ^base_version= >> $GITHUB_ENV
- name: Create package name
run: echo "package_name=[$minecraft_version] $archives_base_name-$base_version-SNAPSHOT.PR${{ github.event.number }}" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v5
with:
name: ${{ env.package_name }}
path: |

View File

@@ -1,4 +1,4 @@
name: Build and Release (1.21.9)
name: Build and Release (1.21.11)
on:
push:
@@ -8,8 +8,7 @@ on:
- '**/src/**'
- '.github/**'
branches:
- "1.21.9"
- "1.21.10"
- "1.21.11"
workflow_dispatch:
inputs:
norelease:
@@ -24,26 +23,25 @@ jobs:
if: |
!contains(github.event.head_commit.message, '[ci skip]')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v2
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
uses: gradle/actions/wrapper-validation@v5
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Verify license using Licenser
uses: gradle/gradle-build-action@v2
with:
arguments: licenseCheck
run: ./gradlew licenseCheck
- name: Setup and Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build --stacktrace --no-daemon
- name: Build with Gradle
run: ./gradlew build --stacktrace --no-daemon
- name: Setting mod version
run: |
@@ -52,7 +50,7 @@ jobs:
cat $GITHUB_WORKSPACE/gradle.properties | grep ^base_version= >> $GITHUB_ENV
- name: Create package name
run: echo "package_name=[$minecraft_version] $archives_base_name-$base_version.${{ github.run_number }}" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
with:
name: ${{ env.package_name }}
path: |
@@ -64,15 +62,12 @@ jobs:
!**/testmod*/
- name: Release to Maven and CurseForge
uses: gradle/gradle-build-action@v2
if: |
!contains(github.event.head_commit.message, '[norelease]') && github.event.inputs.norelease != 'true'
!contains(github.event.head_commit.message, '[norelease]') &&
github.event.inputs.norelease != 'true'
env:
# currently unused, may want to use these for changelogs though!
# GIT_COMMIT: ${{ github.event.after }}
# GIT_PREVIOUS_COMMIT: ${{ github.event.before }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
CURSE_API_KEY: ${{ secrets.CURSE_API_KEY }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
with:
arguments: publish publishUnified --stacktrace --no-daemon
run: |
./gradlew publish publishUnified --stacktrace --no-daemon

View File

@@ -8,7 +8,7 @@ buildscript {
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.11-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.13-SNAPSHOT" apply false
id "org.cadixdev.licenser" version "0.6.1"
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id "maven-publish"

View File

@@ -22,7 +22,7 @@ package dev.architectury.core.fluid;
import dev.architectury.fluid.FluidStack;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
@@ -202,7 +202,7 @@ public interface ArchitecturyFluidAttributes {
* or {@link #getSourceTexture(FluidStack)} instead, this method will be removed in a future version.
*/
@Deprecated(forRemoval = true)
ResourceLocation getSourceTexture(@Nullable FluidStack stack, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos);
Identifier getSourceTexture(@Nullable FluidStack stack, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos);
/**
* Returns the texture location of this fluid in its source form.
@@ -214,7 +214,7 @@ public interface ArchitecturyFluidAttributes {
* @param pos the position, can be {@code null}
* @return the texture location
*/
default ResourceLocation getSourceTexture(@Nullable FluidState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
default Identifier getSourceTexture(@Nullable FluidState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
return getSourceTexture(state == null ? null : FluidStack.create(state.getType(), FluidStack.bucketAmount()), level, pos);
}
@@ -226,7 +226,7 @@ public interface ArchitecturyFluidAttributes {
* @param stack the fluid stack, can be {@code null}
* @return the texture location
*/
default ResourceLocation getSourceTexture(@Nullable FluidStack stack) {
default Identifier getSourceTexture(@Nullable FluidStack stack) {
return getSourceTexture(stack, null, null);
}
@@ -237,7 +237,7 @@ public interface ArchitecturyFluidAttributes {
*
* @return the texture location
*/
default ResourceLocation getSourceTexture() {
default Identifier getSourceTexture() {
return getSourceTexture(null);
}
@@ -254,7 +254,7 @@ public interface ArchitecturyFluidAttributes {
* or {@link #getFlowingTexture(FluidStack)} instead, this method will be removed in a future version.
*/
@Deprecated(forRemoval = true)
ResourceLocation getFlowingTexture(@Nullable FluidStack stack, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos);
Identifier getFlowingTexture(@Nullable FluidStack stack, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos);
/**
* Returns the texture location of this fluid in its flowing form.
@@ -266,7 +266,7 @@ public interface ArchitecturyFluidAttributes {
* @param pos the position, can be {@code null}
* @return the texture location
*/
default ResourceLocation getFlowingTexture(@Nullable FluidState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
default Identifier getFlowingTexture(@Nullable FluidState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
return getFlowingTexture(state == null ? null : FluidStack.create(state.getType(), FluidStack.bucketAmount()), level, pos);
}
@@ -278,7 +278,7 @@ public interface ArchitecturyFluidAttributes {
* @param stack the fluid stack, can be {@code null}
* @return the texture location
*/
default ResourceLocation getFlowingTexture(@Nullable FluidStack stack) {
default Identifier getFlowingTexture(@Nullable FluidStack stack) {
return getFlowingTexture(stack, null, null);
}
@@ -289,7 +289,7 @@ public interface ArchitecturyFluidAttributes {
*
* @return the texture location
*/
default ResourceLocation getFlowingTexture() {
default Identifier getFlowingTexture() {
return getFlowingTexture(null);
}
@@ -304,7 +304,7 @@ public interface ArchitecturyFluidAttributes {
* @return the texture location, can be {@code null}
*/
@Nullable
default ResourceLocation getOverlayTexture(@Nullable FluidState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
default Identifier getOverlayTexture(@Nullable FluidState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
return null;
}
@@ -317,7 +317,7 @@ public interface ArchitecturyFluidAttributes {
* @return the texture location, can be {@code null}
*/
@Nullable
default ResourceLocation getOverlayTexture(@Nullable FluidStack stack) {
default Identifier getOverlayTexture(@Nullable FluidStack stack) {
return null;
}
@@ -329,7 +329,7 @@ public interface ArchitecturyFluidAttributes {
* @return the texture location, can be {@code null}
*/
@Nullable
default ResourceLocation getOverlayTexture() {
default Identifier getOverlayTexture() {
return getOverlayTexture(null);
}

View File

@@ -22,9 +22,9 @@ package dev.architectury.core.fluid;
import com.google.common.base.Suppliers;
import dev.architectury.fluid.FluidStack;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.Util;
import net.minecraft.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.item.Item;
@@ -51,11 +51,11 @@ public class SimpleArchitecturyFluidAttributes implements ArchitecturyFluidAttri
private float explosionResistance = 100.0F;
private Supplier<? extends Optional<? extends LiquidBlock>> block = Optional::empty;
@Nullable
private ResourceLocation sourceTexture;
private Identifier sourceTexture;
@Nullable
private ResourceLocation flowingTexture;
private Identifier flowingTexture;
@Nullable
private ResourceLocation overlayTexture;
private Identifier overlayTexture;
private int color = 0xffffff;
private int luminosity = 0;
private int density = 1000;
@@ -170,7 +170,7 @@ public class SimpleArchitecturyFluidAttributes implements ArchitecturyFluidAttri
/**
* @see ArchitecturyFluidAttributes#getSourceTexture(FluidState, BlockAndTintGetter, BlockPos)
*/
public SimpleArchitecturyFluidAttributes sourceTexture(ResourceLocation sourceTexture) {
public SimpleArchitecturyFluidAttributes sourceTexture(Identifier sourceTexture) {
this.sourceTexture = sourceTexture;
return this;
}
@@ -178,7 +178,7 @@ public class SimpleArchitecturyFluidAttributes implements ArchitecturyFluidAttri
/**
* @see ArchitecturyFluidAttributes#getFlowingTexture(FluidState, BlockAndTintGetter, BlockPos)
*/
public SimpleArchitecturyFluidAttributes flowingTexture(ResourceLocation flowingTexture) {
public SimpleArchitecturyFluidAttributes flowingTexture(Identifier flowingTexture) {
this.flowingTexture = flowingTexture;
return this;
}
@@ -186,7 +186,7 @@ public class SimpleArchitecturyFluidAttributes implements ArchitecturyFluidAttri
/**
* @see ArchitecturyFluidAttributes#getFlowingTexture(FluidState, BlockAndTintGetter, BlockPos)
*/
public SimpleArchitecturyFluidAttributes overlayTexture(ResourceLocation overlayTexture) {
public SimpleArchitecturyFluidAttributes overlayTexture(Identifier overlayTexture) {
this.overlayTexture = overlayTexture;
return this;
}
@@ -317,17 +317,17 @@ public class SimpleArchitecturyFluidAttributes implements ArchitecturyFluidAttri
}
@Override
public ResourceLocation getSourceTexture(@Nullable FluidStack stack, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
public Identifier getSourceTexture(@Nullable FluidStack stack, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
return sourceTexture;
}
@Override
public ResourceLocation getFlowingTexture(@Nullable FluidStack stack, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
public Identifier getFlowingTexture(@Nullable FluidStack stack, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
return flowingTexture;
}
@Override
public ResourceLocation getOverlayTexture(@Nullable FluidState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
public Identifier getOverlayTexture(@Nullable FluidState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos) {
return overlayTexture;
}

View File

@@ -21,14 +21,14 @@ package dev.architectury.extensions.injected;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import org.jetbrains.annotations.Nullable;
public interface InjectedRegistryEntryExtension<T> {
Holder<T> arch$holder();
@Nullable
default ResourceLocation arch$registryName() {
return arch$holder().unwrapKey().map(ResourceKey::location).orElse(null);
default Identifier arch$registryName() {
return arch$holder().unwrapKey().map(ResourceKey::identifier).orElse(null);
}
}

View File

@@ -21,19 +21,14 @@ package dev.architectury.hooks.fluid;
import dev.architectury.fluid.FluidStack;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;

View File

@@ -21,13 +21,14 @@ package dev.architectury.hooks.level.biome;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.core.Holder;
import net.minecraft.sounds.Music;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.random.WeightedList;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.biome.*;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeGenerationSettings;
import net.minecraft.world.level.biome.BiomeSpecialEffects;
import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
@@ -205,36 +206,24 @@ public final class BiomeHooks {
this.effects = effects;
}
@Override
public EffectsProperties.Mutable setFogColor(int color) {
effects.fogColor = color;
return this;
}
@Override
public EffectsProperties.Mutable setWaterColor(int color) {
effects.waterColor = color;
return this;
}
@Override
public EffectsProperties.Mutable setWaterFogColor(int color) {
effects.waterFogColor = color;
return this;
}
@Override
public EffectsProperties.Mutable setSkyColor(int color) {
effects.skyColor = color;
return this;
}
@Override
public EffectsProperties.Mutable setFoliageColorOverride(@Nullable Integer colorOverride) {
effects.foliageColorOverride = Optional.ofNullable(colorOverride);
return this;
}
@Override
public EffectsProperties.Mutable setDryFoliageColorOverride(@Nullable Integer colorOverride) {
effects.dryFoliageColorOverride = Optional.ofNullable(colorOverride);
return this;
}
@Override
public EffectsProperties.Mutable setGrassColorOverride(@Nullable Integer colorOverride) {
effects.grassColorOverride = Optional.ofNullable(colorOverride);
@@ -247,61 +236,21 @@ public final class BiomeHooks {
return this;
}
@Override
public EffectsProperties.Mutable setAmbientParticle(@Nullable AmbientParticleSettings settings) {
effects.ambientParticleSettings = Optional.ofNullable(settings);
return this;
}
@Override
public EffectsProperties.Mutable setAmbientLoopSound(@Nullable Holder<SoundEvent> sound) {
effects.ambientLoopSoundEvent = Optional.ofNullable(sound);
return this;
}
@Override
public EffectsProperties.Mutable setAmbientMoodSound(@Nullable AmbientMoodSettings settings) {
effects.ambientMoodSettings = Optional.ofNullable(settings);
return this;
}
@Override
public EffectsProperties.Mutable setAmbientAdditionsSound(@Nullable AmbientAdditionsSettings settings) {
effects.ambientAdditionsSettings = Optional.ofNullable(settings);
return this;
}
@Override
public EffectsProperties.Mutable setBackgroundMusic(@Nullable WeightedList<Music> music) {
effects.backgroundMusic = Optional.ofNullable(music);
return this;
}
@Override
public int getFogColor() {
return effects.fogColor;
}
@Override
public int getWaterColor() {
return effects.waterColor;
}
@Override
public int getWaterFogColor() {
return effects.waterFogColor;
}
@Override
public int getSkyColor() {
return effects.skyColor;
}
@Override
public OptionalInt getFoliageColorOverride() {
return effects.foliageColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
}
@Override
public OptionalInt getDryFoliageColorOverride() {
return effects.dryFoliageColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
}
@Override
public OptionalInt getGrassColorOverride() {
return effects.grassColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
@@ -311,31 +260,6 @@ public final class BiomeHooks {
public GrassColorModifier getGrassColorModifier() {
return effects.grassColorModifier;
}
@Override
public Optional<AmbientParticleSettings> getAmbientParticle() {
return effects.ambientParticleSettings;
}
@Override
public Optional<Holder<SoundEvent>> getAmbientLoopSound() {
return effects.ambientLoopSoundEvent;
}
@Override
public Optional<AmbientMoodSettings> getAmbientMoodSound() {
return effects.ambientMoodSettings;
}
@Override
public Optional<AmbientAdditionsSettings> getAmbientAdditionsSound() {
return effects.ambientAdditionsSettings;
}
@Override
public Optional<WeightedList<Music>> getBackgroundMusic() {
return effects.backgroundMusic;
}
}
public static class GenerationSettingsWrapped implements GenerationProperties {

View File

@@ -19,67 +19,31 @@
package dev.architectury.hooks.level.biome;
import net.minecraft.core.Holder;
import net.minecraft.sounds.Music;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.random.WeightedList;
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
import net.minecraft.world.level.biome.AmbientMoodSettings;
import net.minecraft.world.level.biome.AmbientParticleSettings;
import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
import java.util.OptionalInt;
public interface EffectsProperties {
int getFogColor();
int getWaterColor();
int getWaterFogColor();
int getSkyColor();
OptionalInt getFoliageColorOverride();
OptionalInt getDryFoliageColorOverride();
OptionalInt getGrassColorOverride();
GrassColorModifier getGrassColorModifier();
Optional<AmbientParticleSettings> getAmbientParticle();
Optional<Holder<SoundEvent>> getAmbientLoopSound();
Optional<AmbientMoodSettings> getAmbientMoodSound();
Optional<AmbientAdditionsSettings> getAmbientAdditionsSound();
Optional<WeightedList<Music>> getBackgroundMusic();
interface Mutable extends EffectsProperties {
EffectsProperties.Mutable setFogColor(int color);
EffectsProperties.Mutable setWaterColor(int color);
EffectsProperties.Mutable setWaterFogColor(int color);
EffectsProperties.Mutable setSkyColor(int color);
EffectsProperties.Mutable setFoliageColorOverride(@Nullable Integer colorOverride);
EffectsProperties.Mutable setDryFoliageColorOverride(@Nullable Integer colorOverride);
EffectsProperties.Mutable setGrassColorOverride(@Nullable Integer colorOverride);
EffectsProperties.Mutable setGrassColorModifier(GrassColorModifier modifier);
EffectsProperties.Mutable setAmbientParticle(@Nullable AmbientParticleSettings settings);
EffectsProperties.Mutable setAmbientLoopSound(@Nullable Holder<SoundEvent> sound);
EffectsProperties.Mutable setAmbientMoodSound(@Nullable AmbientMoodSettings settings);
EffectsProperties.Mutable setAmbientAdditionsSound(@Nullable AmbientAdditionsSettings settings);
EffectsProperties.Mutable setBackgroundMusic(@Nullable WeightedList<Music> music);
}
}

View File

@@ -32,7 +32,7 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import org.jetbrains.annotations.ApiStatus;
import java.lang.reflect.Method;
@@ -53,16 +53,16 @@ public class NetworkAggregator {
throw new RuntimeException(throwable);
}
});
public static final Map<ResourceLocation, CustomPacketPayload.Type<BufCustomPacketPayload>> C2S_TYPE = new HashMap<>();
public static final Map<ResourceLocation, CustomPacketPayload.Type<BufCustomPacketPayload>> S2C_TYPE = new HashMap<>();
public static final Map<ResourceLocation, NetworkManager.NetworkReceiver<?>> C2S_RECEIVER = new HashMap<>();
public static final Map<ResourceLocation, NetworkManager.NetworkReceiver<?>> S2C_RECEIVER = new HashMap<>();
public static final Map<ResourceLocation, StreamCodec<ByteBuf, ?>> C2S_CODECS = new HashMap<>();
public static final Map<ResourceLocation, StreamCodec<ByteBuf, ?>> S2C_CODECS = new HashMap<>();
public static final Map<ResourceLocation, PacketTransformer> C2S_TRANSFORMERS = new HashMap<>();
public static final Map<ResourceLocation, PacketTransformer> S2C_TRANSFORMERS = new HashMap<>();
public static final Map<Identifier, CustomPacketPayload.Type<BufCustomPacketPayload>> C2S_TYPE = new HashMap<>();
public static final Map<Identifier, CustomPacketPayload.Type<BufCustomPacketPayload>> S2C_TYPE = new HashMap<>();
public static final Map<Identifier, NetworkManager.NetworkReceiver<?>> C2S_RECEIVER = new HashMap<>();
public static final Map<Identifier, NetworkManager.NetworkReceiver<?>> S2C_RECEIVER = new HashMap<>();
public static final Map<Identifier, StreamCodec<ByteBuf, ?>> C2S_CODECS = new HashMap<>();
public static final Map<Identifier, StreamCodec<ByteBuf, ?>> S2C_CODECS = new HashMap<>();
public static final Map<Identifier, PacketTransformer> C2S_TRANSFORMERS = new HashMap<>();
public static final Map<Identifier, PacketTransformer> S2C_TRANSFORMERS = new HashMap<>();
public static void registerReceiver(NetworkManager.Side side, ResourceLocation id, List<PacketTransformer> packetTransformers, NetworkManager.NetworkReceiver<RegistryFriendlyByteBuf> receiver) {
public static void registerReceiver(NetworkManager.Side side, Identifier id, List<PacketTransformer> packetTransformers, NetworkManager.NetworkReceiver<RegistryFriendlyByteBuf> receiver) {
CustomPacketPayload.Type<BufCustomPacketPayload> type = new CustomPacketPayload.Type<>(id);
if (side == NetworkManager.Side.C2S) {
C2S_TYPE.put(id, type);
@@ -130,7 +130,7 @@ public class NetworkAggregator {
});
}
public static void collectPackets(PacketSink sink, NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf) {
public static void collectPackets(PacketSink sink, NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf) {
if (side == NetworkManager.Side.C2S) {
collectPackets(sink, side, new BufCustomPacketPayload(C2S_TYPE.get(id), ByteBufUtil.getBytes(buf)), buf.registryAccess());
} else {
@@ -171,7 +171,7 @@ public class NetworkAggregator {
throw new IllegalArgumentException("Invalid side: " + side);
}
public static void registerS2CType(ResourceLocation id, List<PacketTransformer> packetTransformers) {
public static void registerS2CType(Identifier id, List<PacketTransformer> packetTransformers) {
CustomPacketPayload.Type<BufCustomPacketPayload> type = new CustomPacketPayload.Type<>(id);
S2C_TYPE.put(id, type);
registerS2CType(type, BufCustomPacketPayload.streamCodec(type), packetTransformers);

View File

@@ -24,7 +24,7 @@ import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderOwner;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.tags.TagKey;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
@@ -49,7 +49,7 @@ public interface RegistrySupplierImpl<T> extends RegistrySupplier<T> {
}
@Override
default boolean is(ResourceLocation resourceLocation) {
default boolean is(Identifier resourceLocation) {
return getId().equals(resourceLocation);
}

View File

@@ -33,7 +33,7 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.level.ServerEntity;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
@@ -50,7 +50,7 @@ public final class NetworkManager {
* while {@link #registerS2CPayloadType} should be called on the server side.
*/
@Deprecated(forRemoval = true)
public static void registerS2CPayloadType(ResourceLocation id) {
public static void registerS2CPayloadType(Identifier id) {
NetworkAggregator.registerS2CType(id, List.of());
}
@@ -67,7 +67,7 @@ public final class NetworkManager {
* while {@link #registerS2CPayloadType} should be called on the server side.
*/
@Deprecated(forRemoval = true)
public static void registerS2CPayloadType(ResourceLocation id, List<PacketTransformer> packetTransformers) {
public static void registerS2CPayloadType(Identifier id, List<PacketTransformer> packetTransformers) {
NetworkAggregator.registerS2CType(id, packetTransformers);
}
@@ -80,13 +80,13 @@ public final class NetworkManager {
}
@Deprecated(forRemoval = true)
public static void registerReceiver(Side side, ResourceLocation id, NetworkReceiver<RegistryFriendlyByteBuf> receiver) {
public static void registerReceiver(Side side, Identifier id, NetworkReceiver<RegistryFriendlyByteBuf> receiver) {
registerReceiver(side, id, Collections.emptyList(), receiver);
}
@ApiStatus.Experimental
@Deprecated(forRemoval = true)
public static void registerReceiver(Side side, ResourceLocation id, List<PacketTransformer> packetTransformers, NetworkReceiver<RegistryFriendlyByteBuf> receiver) {
public static void registerReceiver(Side side, Identifier id, List<PacketTransformer> packetTransformers, NetworkReceiver<RegistryFriendlyByteBuf> receiver) {
NetworkAggregator.registerReceiver(side, id, packetTransformers, receiver);
}
@@ -100,14 +100,14 @@ public final class NetworkManager {
}
@Deprecated(forRemoval = true)
public static Packet<?> toPacket(Side side, ResourceLocation id, RegistryFriendlyByteBuf buf) {
public static Packet<?> toPacket(Side side, Identifier id, RegistryFriendlyByteBuf buf) {
SinglePacketCollector sink = new SinglePacketCollector(null);
collectPackets(sink, side, id, buf);
return sink.getPacket();
}
@Deprecated(forRemoval = true)
public static List<Packet<?>> toPackets(Side side, ResourceLocation id, RegistryFriendlyByteBuf buf) {
public static List<Packet<?>> toPackets(Side side, Identifier id, RegistryFriendlyByteBuf buf) {
PacketCollector sink = new PacketCollector(null);
collectPackets(sink, side, id, buf);
return sink.collect();
@@ -126,7 +126,7 @@ public final class NetworkManager {
}
@Deprecated(forRemoval = true)
public static void collectPackets(PacketSink sink, Side side, ResourceLocation id, RegistryFriendlyByteBuf buf) {
public static void collectPackets(PacketSink sink, Side side, Identifier id, RegistryFriendlyByteBuf buf) {
NetworkAggregator.collectPackets(sink, side, id, buf);
}
@@ -135,17 +135,17 @@ public final class NetworkManager {
}
@Deprecated(forRemoval = true)
public static void sendToPlayer(ServerPlayer player, ResourceLocation id, RegistryFriendlyByteBuf buf) {
public static void sendToPlayer(ServerPlayer player, Identifier id, RegistryFriendlyByteBuf buf) {
collectPackets(PacketSink.ofPlayer(player), serverToClient(), id, buf);
}
@Deprecated(forRemoval = true)
public static void sendToPlayers(Iterable<ServerPlayer> players, ResourceLocation id, RegistryFriendlyByteBuf buf) {
public static void sendToPlayers(Iterable<ServerPlayer> players, Identifier id, RegistryFriendlyByteBuf buf) {
collectPackets(PacketSink.ofPlayers(players), serverToClient(), id, buf);
}
@Deprecated(forRemoval = true)
public static void sendToServer(ResourceLocation id, RegistryFriendlyByteBuf buf) {
public static void sendToServer(Identifier id, RegistryFriendlyByteBuf buf) {
collectPackets(PacketSink.client(), clientToServer(), id, buf);
}
@@ -165,12 +165,12 @@ public final class NetworkManager {
}
@ExpectPlatform
public static boolean canServerReceive(ResourceLocation id) {
public static boolean canServerReceive(Identifier id) {
throw new AssertionError();
}
@ExpectPlatform
public static boolean canPlayerReceive(ServerPlayer player, ResourceLocation id) {
public static boolean canPlayerReceive(ServerPlayer player, Identifier id) {
throw new AssertionError();
}

View File

@@ -31,7 +31,7 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.level.ServerEntity;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
@@ -42,7 +42,7 @@ import java.util.UUID;
* @see net.minecraft.network.protocol.game.ClientboundAddEntityPacket
*/
public class SpawnEntityPacket {
static final ResourceLocation PACKET_ID = ResourceLocation.fromNamespaceAndPath("architectury", "spawn_entity_packet");
static final Identifier PACKET_ID = Identifier.fromNamespaceAndPath("architectury", "spawn_entity_packet");
static final CustomPacketPayload.Type<PacketPayload> PACKET_TYPE = new CustomPacketPayload.Type<>(PACKET_ID);
static final StreamCodec<RegistryFriendlyByteBuf, PacketPayload> PACKET_CODEC = CustomPacketPayload.codec(PacketPayload::write, PacketPayload::new);

View File

@@ -21,7 +21,7 @@ package dev.architectury.networking.transformers;
import dev.architectury.networking.NetworkManager;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
@@ -31,24 +31,24 @@ import java.util.List;
@ApiStatus.Experimental
public interface PacketTransformer {
void inbound(NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf, NetworkManager.PacketContext context, TransformationSink sink);
void inbound(NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf, NetworkManager.PacketContext context, TransformationSink sink);
void outbound(NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf, TransformationSink sink);
void outbound(NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf, TransformationSink sink);
@FunctionalInterface
interface TransformationSink {
void accept(NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf);
void accept(NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf);
}
static PacketTransformer none() {
return new PacketTransformer() {
@Override
public void inbound(NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf, NetworkManager.PacketContext context, TransformationSink sink) {
public void inbound(NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf, NetworkManager.PacketContext context, TransformationSink sink) {
sink.accept(side, id, buf);
}
@Override
public void outbound(NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf, TransformationSink sink) {
public void outbound(NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf, TransformationSink sink) {
sink.accept(side, id, buf);
}
};
@@ -62,16 +62,16 @@ public interface PacketTransformer {
}
return new PacketTransformer() {
@Override
public void inbound(NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf, NetworkManager.PacketContext context, TransformationSink sink) {
public void inbound(NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf, NetworkManager.PacketContext context, TransformationSink sink) {
traverse(side, id, buf, context, sink, true, 0);
}
@Override
public void outbound(NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf, TransformationSink sink) {
public void outbound(NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf, TransformationSink sink) {
traverse(side, id, buf, null, sink, false, 0);
}
private void traverse(NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf, @Nullable NetworkManager.PacketContext context, TransformationSink outerSink, boolean inbound, int index) {
private void traverse(NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf, @Nullable NetworkManager.PacketContext context, TransformationSink outerSink, boolean inbound, int index) {
if (transformers instanceof List) {
if (((List<? extends PacketTransformer>) transformers).size() > index) {
PacketTransformer transformer = ((List<? extends PacketTransformer>) transformers).get(index);

View File

@@ -27,7 +27,7 @@ import dev.architectury.utils.EnvExecutor;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.ApiStatus;
@@ -49,11 +49,11 @@ public class SplitPacketTransformer implements PacketTransformer {
}
public record PartData(
ResourceLocation id,
Identifier id,
int partsExpected,
List<RegistryFriendlyByteBuf> parts
) {
private PartData(ResourceLocation id, int partsExpected) {
private PartData(Identifier id, int partsExpected) {
this(id, partsExpected, new ArrayList<>());
}
}
@@ -68,7 +68,7 @@ public class SplitPacketTransformer implements PacketTransformer {
}
@Override
public void inbound(NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf, NetworkManager.PacketContext context, TransformationSink sink) {
public void inbound(NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf, NetworkManager.PacketContext context, TransformationSink sink) {
PartKey key = side == NetworkManager.Side.S2C ? new PartKey(side, null) : new PartKey(side, context.getPlayer().getUUID());
PartData data;
switch (buf.readByte()) {
@@ -138,7 +138,7 @@ public class SplitPacketTransformer implements PacketTransformer {
}
@Override
public void outbound(NetworkManager.Side side, ResourceLocation id, RegistryFriendlyByteBuf buf, TransformationSink sink) {
public void outbound(NetworkManager.Side side, Identifier id, RegistryFriendlyByteBuf buf, TransformationSink sink) {
int maxSize = (side == NetworkManager.Side.C2S ? 32767 : 1048576) - 1 - 20 - id.toString().getBytes(StandardCharsets.UTF_8).length;
if (buf.readableBytes() <= maxSize) {
ByteBuf stateBuf = Unpooled.buffer(1);

View File

@@ -24,7 +24,7 @@ import dev.architectury.injectables.annotations.ExpectPlatform;
import dev.architectury.registry.registries.DeferredSupplier;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
@@ -93,7 +93,7 @@ public final class CreativeTabRegistry {
*/
@ExpectPlatform
@ApiStatus.Experimental
public static DeferredSupplier<CreativeModeTab> defer(ResourceLocation name) {
public static DeferredSupplier<CreativeModeTab> defer(Identifier name) {
throw new AssertionError();
}
@@ -105,7 +105,7 @@ public final class CreativeTabRegistry {
*/
@ApiStatus.Experimental
public static DeferredSupplier<CreativeModeTab> defer(ResourceKey<CreativeModeTab> name) {
return defer(name.location());
return defer(name.identifier());
}
@ApiStatus.Experimental

View File

@@ -20,10 +20,9 @@
package dev.architectury.registry;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.resources.PreparableReloadListener;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.List;
@@ -32,12 +31,12 @@ public final class ReloadListenerRegistry {
private ReloadListenerRegistry() {
}
public static void register(PackType type, PreparableReloadListener listener, ResourceLocation listenerId) {
public static void register(PackType type, PreparableReloadListener listener, Identifier listenerId) {
register(type, listener, listenerId, List.of());
}
@ExpectPlatform
public static void register(PackType type, PreparableReloadListener listener, ResourceLocation listenerId, Collection<ResourceLocation> dependencies) {
public static void register(PackType type, PreparableReloadListener listener, Identifier listenerId, Collection<Identifier> dependencies) {
throw new AssertionError();
}
}

View File

@@ -22,7 +22,7 @@ package dev.architectury.registry.level.biome;
import com.google.common.base.Predicates;
import dev.architectury.hooks.level.biome.BiomeProperties;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.biome.Biome;
@@ -89,7 +89,7 @@ public final class BiomeModifications {
}
public interface BiomeContext {
Optional<ResourceLocation> getKey();
Optional<Identifier> getKey();
BiomeProperties getProperties();

View File

@@ -19,9 +19,10 @@
package dev.architectury.registry.level.entity.trade;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.npc.VillagerTrades;
import net.minecraft.world.entity.npc.villager.VillagerTrades;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.trading.ItemCost;
import net.minecraft.world.item.trading.MerchantOffer;
@@ -58,7 +59,7 @@ public record SimpleTrade(ItemCost primaryPrice, Optional<ItemCost> secondaryPri
@Nullable
@Override
public MerchantOffer getOffer(Entity entity, RandomSource random) {
public MerchantOffer getOffer(ServerLevel level, Entity entity, RandomSource random) {
return new MerchantOffer(this.primaryPrice, this.secondaryPrice, this.sale, this.maxTrades, this.experiencePoints, this.priceMultiplier);
}
}

View File

@@ -21,8 +21,8 @@ package dev.architectury.registry.level.entity.trade;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.entity.npc.VillagerTrades;
import net.minecraft.world.entity.npc.villager.VillagerProfession;
import net.minecraft.world.entity.npc.villager.VillagerTrades;
public class TradeRegistry {
private TradeRegistry() {

View File

@@ -24,7 +24,7 @@ import dev.architectury.impl.RegistrySupplierImpl;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import org.jetbrains.annotations.Nullable;
import java.util.*;
@@ -55,10 +55,10 @@ public class DeferredRegister<T> implements Iterable<RegistrySupplier<T>> {
throw new NullPointerException("You must create the deferred register with a mod id to register entries without the namespace!");
}
return register(ResourceLocation.fromNamespaceAndPath(modId, id), supplier);
return register(Identifier.fromNamespaceAndPath(modId, id), supplier);
}
public <R extends T> RegistrySupplier<R> register(ResourceLocation id, Supplier<? extends R> supplier) {
public <R extends T> RegistrySupplier<R> register(Identifier id, Supplier<? extends R> supplier) {
var entry = new Entry<T>(id, (Supplier<T>) supplier);
this.entries.add(entry);
if (registered) {
@@ -93,13 +93,13 @@ public class DeferredRegister<T> implements Iterable<RegistrySupplier<T>> {
}
private class Entry<R> implements RegistrySupplierImpl<R> {
private final ResourceLocation id;
private final Identifier id;
private final Supplier<R> supplier;
private RegistrySupplier<R> value;
@Nullable
private Holder<R> holder = null;
public Entry(ResourceLocation id, Supplier<R> supplier) {
public Entry(Identifier id, Supplier<R> supplier) {
this.id = id;
this.supplier = supplier;
}
@@ -127,12 +127,12 @@ public class DeferredRegister<T> implements Iterable<RegistrySupplier<T>> {
}
@Override
public ResourceLocation getRegistryId() {
return key.location();
public Identifier getRegistryId() {
return key.identifier();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return id;
}

View File

@@ -22,13 +22,13 @@ package dev.architectury.registry.registries;
import dev.architectury.utils.OptionalSupplier;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
public interface DeferredSupplier<T> extends OptionalSupplier<T> {
/**
* @return the identifier of the registry
*/
ResourceLocation getRegistryId();
Identifier getRegistryId();
/**
* @return the identifier of the registry
@@ -40,7 +40,7 @@ public interface DeferredSupplier<T> extends OptionalSupplier<T> {
/**
* @return the identifier of the entry
*/
ResourceLocation getId();
Identifier getId();
/**
* Returns the registry key of the creative tab.

View File

@@ -22,7 +22,7 @@ package dev.architectury.registry.registries;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
@@ -32,10 +32,10 @@ import java.util.function.Consumer;
import java.util.function.Supplier;
public interface Registrar<T> extends Iterable<T> {
RegistrySupplier<T> delegate(ResourceLocation id);
RegistrySupplier<T> delegate(Identifier id);
default <R extends T> RegistrySupplier<R> wrap(R obj) {
ResourceLocation id = getId(obj);
Identifier id = getId(obj);
if (id == null) {
throw new IllegalArgumentException("Cannot wrap an object without an id: " + obj);
@@ -44,26 +44,26 @@ public interface Registrar<T> extends Iterable<T> {
}
}
<E extends T> RegistrySupplier<E> register(ResourceLocation id, Supplier<E> supplier);
<E extends T> RegistrySupplier<E> register(Identifier id, Supplier<E> supplier);
@Nullable
ResourceLocation getId(T obj);
Identifier getId(T obj);
int getRawId(T obj);
Optional<ResourceKey<T>> getKey(T obj);
@Nullable
T get(ResourceLocation id);
T get(Identifier id);
@Nullable
T byRawId(int rawId);
boolean contains(ResourceLocation id);
boolean contains(Identifier id);
boolean containsValue(T obj);
Set<ResourceLocation> getIds();
Set<Identifier> getIds();
Set<Map.Entry<ResourceKey<T>, T>> entrySet();
@@ -73,7 +73,7 @@ public interface Registrar<T> extends Iterable<T> {
Holder<T> getHolder(ResourceKey<T> key);
@Nullable
default Holder<T> getHolder(ResourceLocation id) {
default Holder<T> getHolder(Identifier id) {
return getHolder(ResourceKey.create(key(), id));
}
@@ -103,5 +103,5 @@ public interface Registrar<T> extends Iterable<T> {
* @param id the entry to listen to
* @param callback the action to call when the registry entry is registered
*/
void listen(ResourceLocation id, Consumer<T> callback);
void listen(Identifier id, Consumer<T> callback);
}

View File

@@ -23,7 +23,7 @@ import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
@@ -71,7 +71,7 @@ public final class RegistrarManager {
}
@SafeVarargs
public final <T> RegistrarBuilder<T> builder(ResourceLocation registryId, T... typeGetter) {
public final <T> RegistrarBuilder<T> builder(Identifier registryId, T... typeGetter) {
if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!");
return this.provider.builder((Class<T>) typeGetter.getClass().getComponentType(), registryId);
}
@@ -81,10 +81,10 @@ public final class RegistrarManager {
* Fabric: Use registry
*/
@Nullable
public static <T> ResourceLocation getId(T object, @Nullable ResourceKey<Registry<T>> fallback) {
public static <T> Identifier getId(T object, @Nullable ResourceKey<Registry<T>> fallback) {
if (fallback == null)
return null;
return getId(object, (Registry<T>) BuiltInRegistries.REGISTRY.getValue(fallback.location()));
return getId(object, (Registry<T>) BuiltInRegistries.REGISTRY.getValue(fallback.identifier()));
}
/**
@@ -93,7 +93,7 @@ public final class RegistrarManager {
*/
@Nullable
@Deprecated
public static <T> ResourceLocation getId(T object, @Nullable Registry<T> fallback) {
public static <T> Identifier getId(T object, @Nullable Registry<T> fallback) {
if (fallback == null)
return null;
return fallback.getKey(object);
@@ -117,6 +117,6 @@ public final class RegistrarManager {
<T> void forRegistry(ResourceKey<Registry<T>> key, Consumer<Registrar<T>> consumer);
<T> RegistrarBuilder<T> builder(Class<T> type, ResourceLocation registryId);
<T> RegistrarBuilder<T> builder(Class<T> type, Identifier registryId);
}
}

View File

@@ -19,7 +19,7 @@
package dev.architectury.registry.registries.options;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
public record DefaultIdRegistrarOption(ResourceLocation defaultId) implements RegistrarOption {
public record DefaultIdRegistrarOption(Identifier defaultId) implements RegistrarOption {
}

View File

@@ -46,7 +46,6 @@ accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties
mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties dynamicShape Z
accessible method net/minecraft/world/level/block/state/BlockBehaviour$Properties <init> ()V
accessible field net/minecraft/world/level/block/entity/FuelValues$Builder values Lit/unimi/dsi/fastutil/objects/Object2IntSortedMap;
transitive-accessible method net/minecraft/world/entity/player/Player closeContainer ()V
transitive-accessible method net/minecraft/advancements/CriteriaTriggers register (Ljava/lang/String;Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger;
transitive-accessible method net/minecraft/world/inventory/MenuType <init> (Lnet/minecraft/world/inventory/MenuType$MenuSupplier;Lnet/minecraft/world/flag/FeatureFlagSet;)V
transitive-accessible class net/minecraft/world/inventory/MenuType$MenuSupplier
@@ -62,50 +61,29 @@ accessible field net/minecraft/world/level/biome/Biome$ClimateSettings temperatu
mutable field net/minecraft/world/level/biome/Biome$ClimateSettings temperatureModifier Lnet/minecraft/world/level/biome/Biome$TemperatureModifier;
accessible field net/minecraft/world/level/biome/Biome$ClimateSettings downfall F
mutable field net/minecraft/world/level/biome/Biome$ClimateSettings downfall F
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects fogColor I
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects fogColor I
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects waterColor I
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects waterColor I
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects waterFogColor I
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects waterFogColor I
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects skyColor I
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects skyColor I
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects foliageColorOverride Ljava/util/Optional;
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects foliageColorOverride Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects dryFoliageColorOverride Ljava/util/Optional;
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects dryFoliageColorOverride Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorOverride Ljava/util/Optional;
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorOverride Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorModifier Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier;
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorModifier Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientParticleSettings Ljava/util/Optional;
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientParticleSettings Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientLoopSoundEvent Ljava/util/Optional;
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientLoopSoundEvent Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientMoodSettings Ljava/util/Optional;
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientMoodSettings Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditionsSettings Ljava/util/Optional;
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditionsSettings Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional;
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder fogColor Ljava/util/OptionalInt;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder waterColor Ljava/util/OptionalInt;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder waterFogColor Ljava/util/OptionalInt;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder skyColor Ljava/util/OptionalInt;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder foliageColorOverride Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder dryFoliageColorOverride Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder grassColorOverride Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder grassColorModifier Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder ambientParticle Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder ambientLoopSoundEvent Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder ambientMoodSettings Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder ambientAdditionsSettings Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects$Builder backgroundMusic Ljava/util/Optional;
accessible field net/minecraft/world/level/biome/MobSpawnSettings$Builder spawners Ljava/util/Map;
accessible field net/minecraft/world/level/biome/MobSpawnSettings$Builder mobSpawnCosts Ljava/util/Map;
accessible field net/minecraft/world/level/biome/MobSpawnSettings$Builder creatureGenerationProbability F
transitive-accessible method net/minecraft/world/level/GameRules register (Ljava/lang/String;Lnet/minecraft/world/level/GameRules$Category;Lnet/minecraft/world/level/GameRules$Type;)Lnet/minecraft/world/level/GameRules$Key;
transitive-accessible method net/minecraft/world/level/GameRules$BooleanValue create (ZLjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type;
transitive-accessible method net/minecraft/world/level/GameRules$BooleanValue create (Z)Lnet/minecraft/world/level/GameRules$Type;
transitive-accessible method net/minecraft/world/level/GameRules$IntegerValue create (ILjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type;
transitive-accessible method net/minecraft/world/level/GameRules$IntegerValue create (I)Lnet/minecraft/world/level/GameRules$Type;
transitive-accessible method net/minecraft/world/level/gamerules/GameRules register (Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;Lnet/minecraft/world/level/gamerules/GameRuleType;Lcom/mojang/brigadier/arguments/ArgumentType;Lcom/mojang/serialization/Codec;Ljava/lang/Object;Lnet/minecraft/world/flag/FeatureFlagSet;Lnet/minecraft/world/level/gamerules/GameRules$VisitorCaller;Ljava/util/function/ToIntFunction;)Lnet/minecraft/world/level/gamerules/GameRule;
transitive-accessible method net/minecraft/world/level/gamerules/GameRules registerBoolean (Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;Z)Lnet/minecraft/world/level/gamerules/GameRule;
transitive-accessible method net/minecraft/world/level/gamerules/GameRules registerInteger (Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;II)Lnet/minecraft/world/level/gamerules/GameRule;
transitive-accessible method net/minecraft/world/level/gamerules/GameRules registerInteger (Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;III)Lnet/minecraft/world/level/gamerules/GameRule;
transitive-accessible method net/minecraft/world/level/gamerules/GameRules registerInteger (Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;IIILnet/minecraft/world/flag/FeatureFlagSet;)Lnet/minecraft/world/level/gamerules/GameRule;
transitive-accessible method net/minecraft/world/level/storage/LevelResource <init> (Ljava/lang/String;)V
transitive-accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier
accessible field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map;
@@ -115,18 +93,17 @@ mutable field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map;
accessible field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map;
mutable field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map;
transitive-accessible method net/minecraft/world/entity/player/Player closeContainer ()V
transitive-accessible method net/minecraft/client/renderer/RenderType create (Ljava/lang/String;ILcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/client/renderer/RenderType$CompositeState;)Lnet/minecraft/client/renderer/RenderType$CompositeRenderType;
transitive-accessible method net/minecraft/client/renderer/RenderType create (Ljava/lang/String;IZZLcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/client/renderer/RenderType$CompositeState;)Lnet/minecraft/client/renderer/RenderType$CompositeRenderType;
transitive-accessible class net/minecraft/client/renderer/RenderType$CompositeState
transitive-accessible class net/minecraft/client/renderer/RenderType$CompositeRenderType
transitive-accessible class net/minecraft/client/renderer/RenderType$OutlineProperty
transitive-accessible method net/minecraft/client/renderer/rendertype/RenderType create (Ljava/lang/String;Lnet/minecraft/client/renderer/rendertype/RenderSetup;)Lnet/minecraft/client/renderer/rendertype/RenderType;
transitive-accessible field net/minecraft/client/renderer/rendertype/RenderType state Lnet/minecraft/client/renderer/rendertype/RenderSetup;
transitive-accessible field net/minecraft/client/renderer/rendertype/RenderType outline Ljava/util/Optional;
transitive-accessible field net/minecraft/client/renderer/rendertype/RenderType name Ljava/lang/String;
accessible class net/minecraft/client/particle/ParticleResources$MutableSpriteSet
accessible field net/minecraft/client/particle/ParticleResources$MutableSpriteSet sprites Ljava/util/List;
transitive-accessible class net/minecraft/world/item/CreativeModeTab$Output
transitive-accessible class net/minecraft/world/item/CreativeModeTab$TabVisibility
accessible field net/minecraft/client/multiplayer/MultiPlayerGameMode connection Lnet/minecraft/client/multiplayer/ClientPacketListener;
accessible field net/minecraft/client/Minecraft particleResources Lnet/minecraft/client/particle/ParticleResources;
transitive-accessible method net/minecraft/client/gui/components/debug/DebugScreenEntries register (Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/gui/components/debug/DebugScreenEntry;)Lnet/minecraft/resources/ResourceLocation;
transitive-accessible method net/minecraft/client/gui/components/debug/DebugScreenEntries register (Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/gui/components/debug/DebugScreenEntry;)Lnet/minecraft/resources/Identifier;
##############################
# This section is generated automatically with Gradle task generateAccessWidener!!!
@@ -239,49 +216,6 @@ transitive-accessible method net/minecraft/world/level/block/WitherSkullBlock <i
transitive-accessible method net/minecraft/world/level/block/WitherWallSkullBlock <init> (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V
transitive-accessible method net/minecraft/world/level/block/WoolCarpetBlock <init> (Lnet/minecraft/world/item/DyeColor;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V
# RenderStateShard fields
transitive-accessible field net/minecraft/client/renderer/RenderStateShard BLOCK_SHEET_MIPPED Lnet/minecraft/client/renderer/RenderStateShard$TextureStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard BLOCK_SHEET Lnet/minecraft/client/renderer/RenderStateShard$TextureStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_TEXTURE Lnet/minecraft/client/renderer/RenderStateShard$EmptyTextureStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard DEFAULT_TEXTURING Lnet/minecraft/client/renderer/RenderStateShard$TexturingStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard GLINT_TEXTURING Lnet/minecraft/client/renderer/RenderStateShard$TexturingStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard ENTITY_GLINT_TEXTURING Lnet/minecraft/client/renderer/RenderStateShard$TexturingStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard ARMOR_ENTITY_GLINT_TEXTURING Lnet/minecraft/client/renderer/RenderStateShard$TexturingStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard LIGHTMAP Lnet/minecraft/client/renderer/RenderStateShard$LightmapStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_LIGHTMAP Lnet/minecraft/client/renderer/RenderStateShard$LightmapStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard OVERLAY Lnet/minecraft/client/renderer/RenderStateShard$OverlayStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_OVERLAY Lnet/minecraft/client/renderer/RenderStateShard$OverlayStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_LAYERING Lnet/minecraft/client/renderer/RenderStateShard$LayeringStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard VIEW_OFFSET_Z_LAYERING Lnet/minecraft/client/renderer/RenderStateShard$LayeringStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard VIEW_OFFSET_Z_LAYERING_FORWARD Lnet/minecraft/client/renderer/RenderStateShard$LayeringStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard MAIN_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard OUTLINE_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard WEATHER_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard ITEM_ENTITY_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard;
transitive-accessible field net/minecraft/client/renderer/RenderStateShard DEFAULT_LINE Lnet/minecraft/client/renderer/RenderStateShard$LineStateShard;
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$TextureStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$EmptyTextureStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$TexturingStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$LightmapStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$OverlayStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$LayeringStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$OutputStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$LineStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$OffsetTexturingStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$MultiTextureStateShard
# CompositeStateBuilder methods
transitive-accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder <init> ()V
transitive-accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder setTextureState (Lnet/minecraft/client/renderer/RenderStateShard$EmptyTextureStateShard;)Lnet/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder;
transitive-accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder setLightmapState (Lnet/minecraft/client/renderer/RenderStateShard$LightmapStateShard;)Lnet/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder;
transitive-accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder setOverlayState (Lnet/minecraft/client/renderer/RenderStateShard$OverlayStateShard;)Lnet/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder;
transitive-accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder setLayeringState (Lnet/minecraft/client/renderer/RenderStateShard$LayeringStateShard;)Lnet/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder;
transitive-accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder setOutputState (Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard;)Lnet/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder;
transitive-accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder setTexturingState (Lnet/minecraft/client/renderer/RenderStateShard$TexturingStateShard;)Lnet/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder;
transitive-accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder setLineState (Lnet/minecraft/client/renderer/RenderStateShard$LineStateShard;)Lnet/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder;
transitive-accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder createCompositeState (Z)Lnet/minecraft/client/renderer/RenderType$CompositeState;
transitive-accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder createCompositeState (Lnet/minecraft/client/renderer/RenderType$OutlineProperty;)Lnet/minecraft/client/renderer/RenderType$CompositeState;
# RenderPipelines fields
transitive-accessible field net/minecraft/client/renderer/RenderPipelines PIPELINES_BY_LOCATION Ljava/util/Map;
transitive-accessible field net/minecraft/client/renderer/RenderPipelines MATRICES_PROJECTION_SNIPPET Lcom/mojang/blaze3d/pipeline/RenderPipeline$Snippet;

View File

@@ -30,7 +30,7 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.material.FluidState;
import org.jetbrains.annotations.Nullable;
@@ -52,7 +52,7 @@ class ArchitecturyFluidRenderingFabric implements FluidVariantRenderHandler, Flu
@Nullable
public TextureAtlasSprite[] getSprites(FluidVariant variant) {
FluidStack stack = FluidStackHooksFabric.fromFabric(variant, FluidStack.bucketAmount());
ResourceLocation overlayTexture = attributes.getOverlayTexture(stack);
Identifier overlayTexture = attributes.getOverlayTexture(stack);
TextureAtlasSprite overlaySprite = overlayTexture == null ? null : atlas.getSprite(overlayTexture);
TextureAtlasSprite[] sprites = overlaySprite == null ? this.sprites : spritesOverlaid;
sprites[0] = atlas.getSprite(attributes.getSourceTexture(stack));
@@ -68,7 +68,7 @@ class ArchitecturyFluidRenderingFabric implements FluidVariantRenderHandler, Flu
@Override
public TextureAtlasSprite[] getFluidSprites(@Nullable BlockAndTintGetter view, @Nullable BlockPos pos, FluidState state) {
ResourceLocation overlayTexture = attributes.getOverlayTexture(state, view, pos);
Identifier overlayTexture = attributes.getOverlayTexture(state, view, pos);
TextureAtlasSprite overlaySprite = overlayTexture == null ? null : atlas.getSprite(overlayTexture);
TextureAtlasSprite[] sprites = overlaySprite == null ? this.spritesOther : spritesOtherOverlaid;
sprites[0] = atlas.getSprite(attributes.getSourceTexture(state, view, pos));

View File

@@ -22,7 +22,6 @@ package dev.architectury.impl.fabric;
import dev.architectury.event.events.common.ChatEvent;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
@ApiStatus.Internal
public class ChatComponentImpl implements ChatEvent.ChatComponent {

View File

@@ -21,7 +21,7 @@ package dev.architectury.mixin.fabric;
import dev.architectury.event.events.common.EntityEvent;
import net.minecraft.world.entity.ai.goal.RunAroundLikeCrazyGoal;
import net.minecraft.world.entity.animal.horse.AbstractHorse;
import net.minecraft.world.entity.animal.equine.AbstractHorse;
import net.minecraft.world.entity.player.Player;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -39,7 +39,7 @@ public class HorseTameInvoker {
@Inject(method = "tick",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/animal/horse/AbstractHorse;tameWithName(Lnet/minecraft/world/entity/player/Player;)Z"
target = "Lnet/minecraft/world/entity/animal/equine/AbstractHorse;tameWithName(Lnet/minecraft/world/entity/player/Player;)Z"
), cancellable = true
)
private void tick(CallbackInfo ci) {

View File

@@ -24,7 +24,7 @@ import dev.architectury.event.events.common.EntityEvent;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.EntitySpawnReason;
import net.minecraft.world.entity.animal.Cat;
import net.minecraft.world.entity.animal.feline.Cat;
import net.minecraft.world.entity.npc.CatSpawner;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

View File

@@ -23,7 +23,7 @@ import dev.architectury.event.events.common.EntityEvent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.animal.Ocelot;
import net.minecraft.world.entity.animal.feline.Ocelot;
import net.minecraft.world.entity.player.Player;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -35,7 +35,7 @@ public class MixinOcelot {
@Inject(method = "mobInteract",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/animal/Ocelot;setTrusting(Z)V"
target = "Lnet/minecraft/world/entity/animal/feline/Ocelot;setTrusting(Z)V"
), cancellable = true)
private void mobInteract(Player player, InteractionHand hand, CallbackInfoReturnable<InteractionResult> cir) {
if (EntityEvent.ANIMAL_TAME.invoker().tame((Animal) (Object) this, player).isFalse()) {

View File

@@ -24,7 +24,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.Container;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.animal.horse.AbstractHorse;
import net.minecraft.world.entity.animal.equine.AbstractHorse;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;

View File

@@ -25,7 +25,7 @@ import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
@@ -48,12 +48,12 @@ public abstract class MixinGuiGraphics {
}
@Inject(method = "renderTooltip", at = @At("RETURN"))
private void postRenderTooltipItem(Font font, List<ClientTooltipComponent> list, int i, int j, ClientTooltipPositioner clientTooltipPositioner, ResourceLocation resourceLocation, CallbackInfo ci) {
private void postRenderTooltipItem(Font font, List<ClientTooltipComponent> list, int i, int j, ClientTooltipPositioner clientTooltipPositioner, Identifier resourceLocation, CallbackInfo ci) {
ClientTooltipEvent.additionalContexts().setItem(null);
}
@Inject(method = "renderTooltip", at = @At("HEAD"), cancellable = true)
private void renderTooltip(Font font, List<ClientTooltipComponent> list, int x, int y, ClientTooltipPositioner positioner, @Nullable ResourceLocation background, CallbackInfo ci) {
private void renderTooltip(Font font, List<ClientTooltipComponent> list, int x, int y, ClientTooltipPositioner positioner, @Nullable Identifier background, CallbackInfo ci) {
if (!list.isEmpty()) {
var positionContext = tooltipPositionContext.get();
positionContext.reset(x, y);

View File

@@ -57,9 +57,9 @@ public abstract class MixinMinecraft {
@Unique
private ThreadLocal<Boolean> setScreenCancelled = new ThreadLocal<>();
@Inject(method = "disconnect(Lnet/minecraft/client/gui/screens/Screen;Z)V",
@Inject(method = "Lnet/minecraft/client/Minecraft;disconnect(Lnet/minecraft/client/gui/screens/Screen;ZZ)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/GameNarrator;clear()V"))
private void handleLogin(Screen screen, boolean retainDownloadedPacks, CallbackInfo ci) {
private void handleLogin(Screen screen, boolean retainDownloadedPacks, boolean bl2, CallbackInfo ci) {
ClientPlayerEvent.CLIENT_PLAYER_QUIT.invoker().quit(player);
}

View File

@@ -23,7 +23,6 @@ import dev.architectury.event.events.client.ClientGuiEvent;
import dev.architectury.hooks.client.screen.ScreenAccess;
import dev.architectury.impl.ScreenAccessImpl;
import dev.architectury.impl.fabric.ScreenInputDelegate;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.screens.Screen;
import org.spongepowered.asm.mixin.Mixin;
@@ -64,15 +63,15 @@ public abstract class MixinScreen implements ScreenInputDelegate {
return inputDelegate;
}
@Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At(value = "INVOKE",
@Inject(method = "Lnet/minecraft/client/gui/screens/Screen;init(II)V", at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/gui/screens/Screen;init()V"), cancellable = true)
private void preInit(Minecraft minecraft, int width, int height, CallbackInfo ci) {
private void preInit(int width, int height, CallbackInfo ci) {
if (ClientGuiEvent.INIT_PRE.invoker().init((Screen) (Object) this, getAccess()).isFalse()) {
ci.cancel();
}
}
@Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At(value = "INVOKE",
@Inject(method = "Lnet/minecraft/client/gui/screens/Screen;init(II)V", at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/gui/screens/Screen;init()V", shift = At.Shift.AFTER))
private void postInit(CallbackInfo ci) {
ClientGuiEvent.INIT_POST.invoker().init((Screen) (Object) this, getAccess());

View File

@@ -25,7 +25,6 @@ import dev.architectury.networking.fabric.NetworkManagerImpl;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;

View File

@@ -41,7 +41,7 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.level.ServerEntity;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.thread.BlockableEventLoop;
@@ -113,11 +113,11 @@ public class NetworkManagerImpl {
}
@Environment(EnvType.CLIENT)
public static boolean canServerReceive(ResourceLocation id) {
public static boolean canServerReceive(Identifier id) {
return ClientPlayNetworking.canSend(id);
}
public static boolean canPlayerReceive(ServerPlayer player, ResourceLocation id) {
public static boolean canPlayerReceive(ServerPlayer player, Identifier id) {
return ServerPlayNetworking.canSend(player, id);
}

View File

@@ -28,7 +28,7 @@ import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.ApiStatus;
@@ -39,7 +39,7 @@ import java.util.function.Consumer;
import java.util.function.Supplier;
public class CreativeTabRegistryImpl {
private static final Multimap<ResourceLocation, Supplier<ItemStack>> APPENDS = MultimapBuilder.hashKeys().arrayListValues().build();
private static final Multimap<Identifier, Supplier<ItemStack>> APPENDS = MultimapBuilder.hashKeys().arrayListValues().build();
@ApiStatus.Experimental
public static CreativeModeTab create(Consumer<CreativeModeTab.Builder> callback) {
@@ -50,18 +50,18 @@ public class CreativeTabRegistryImpl {
@ApiStatus.Experimental
public static DeferredSupplier<CreativeModeTab> ofBuiltin(CreativeModeTab tab) {
ResourceLocation key = BuiltInRegistries.CREATIVE_MODE_TAB.getKey(tab);
Identifier key = BuiltInRegistries.CREATIVE_MODE_TAB.getKey(tab);
if (key == null) {
throw new IllegalArgumentException("Builtin tab %s is not registered!".formatted(tab));
}
return new DeferredSupplier<>() {
@Override
public ResourceLocation getRegistryId() {
return Registries.CREATIVE_MODE_TAB.location();
public Identifier getRegistryId() {
return Registries.CREATIVE_MODE_TAB.identifier();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return BuiltInRegistries.CREATIVE_MODE_TAB.getKey(tab);
}
@@ -78,18 +78,18 @@ public class CreativeTabRegistryImpl {
}
@ApiStatus.Experimental
public static DeferredSupplier<CreativeModeTab> defer(ResourceLocation name) {
public static DeferredSupplier<CreativeModeTab> defer(Identifier name) {
return new DeferredSupplier<>() {
@Nullable
private CreativeModeTab tab;
@Override
public ResourceLocation getRegistryId() {
return Registries.CREATIVE_MODE_TAB.location();
public Identifier getRegistryId() {
return Registries.CREATIVE_MODE_TAB.identifier();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return name;
}

View File

@@ -22,7 +22,7 @@ package dev.architectury.registry.fabric;
import com.google.common.primitives.Longs;
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.resources.PreparableReloadListener;
import org.apache.commons.lang3.StringUtils;
@@ -35,13 +35,13 @@ import java.util.concurrent.Executor;
public class ReloadListenerRegistryImpl {
private static final SecureRandom RANDOM = new SecureRandom();
public static void register(PackType type, PreparableReloadListener listener, ResourceLocation listenerId, Collection<ResourceLocation> dependencies) {
public static void register(PackType type, PreparableReloadListener listener, Identifier listenerId, Collection<Identifier> dependencies) {
var bytes = new byte[8];
RANDOM.nextBytes(bytes);
var id = listenerId != null ? listenerId : ResourceLocation.parse("architectury:reload_" + StringUtils.leftPad(Math.abs(Longs.fromByteArray(bytes)) + "", 19, '0'));
var id = listenerId != null ? listenerId : Identifier.parse("architectury:reload_" + StringUtils.leftPad(Math.abs(Longs.fromByteArray(bytes)) + "", 19, '0'));
ResourceManagerHelper.get(type).registerReloadListener(new IdentifiableResourceReloadListener() {
@Override
public ResourceLocation getFabricId() {
public Identifier getFabricId() {
return id;
}
@@ -51,7 +51,7 @@ public class ReloadListenerRegistryImpl {
}
@Override
public Collection<ResourceLocation> getFabricDependencies() {
public Collection<Identifier> getFabricDependencies() {
return dependencies;
}

View File

@@ -29,17 +29,15 @@ import net.fabricmc.fabric.api.biome.v1.BiomeModificationContext;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext;
import net.fabricmc.fabric.api.biome.v1.ModificationPhase;
import net.minecraft.core.Holder;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.Music;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.tags.TagKey;
import net.minecraft.util.random.WeightedList;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.biome.*;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biome.TemperatureModifier;
import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
@@ -55,7 +53,7 @@ import java.util.function.Predicate;
import static net.fabricmc.fabric.api.biome.v1.BiomeModificationContext.*;
public class BiomeModificationsImpl {
private static final ResourceLocation FABRIC_MODIFICATION = ResourceLocation.fromNamespaceAndPath("architectury", "fabric_modification");
private static final Identifier FABRIC_MODIFICATION = Identifier.fromNamespaceAndPath("architectury", "fabric_modification");
private static final List<Pair<Predicate<BiomeContext>, BiConsumer<BiomeContext, BiomeProperties.Mutable>>> ADDITIONS = Lists.newArrayList();
private static final List<Pair<Predicate<BiomeContext>, BiConsumer<BiomeContext, BiomeProperties.Mutable>>> POST_PROCESSING = Lists.newArrayList();
private static final List<Pair<Predicate<BiomeContext>, BiConsumer<BiomeContext, BiomeProperties.Mutable>>> REMOVALS = Lists.newArrayList();
@@ -102,8 +100,8 @@ public class BiomeModificationsImpl {
BiomeProperties properties = BiomeHooks.getBiomeProperties(context.getBiome());
@Override
public Optional<ResourceLocation> getKey() {
return Optional.ofNullable(context.getBiomeKey().location());
public Optional<Identifier> getKey() {
return Optional.ofNullable(context.getBiomeKey().identifier());
}
@Override
@@ -258,36 +256,24 @@ public class BiomeModificationsImpl {
private static EffectsProperties.Mutable wrapEffects(Biome biome, EffectsContext context) {
return new BiomeHooks.EffectsWrapped(biome) {
@Override
public EffectsProperties.Mutable setFogColor(int color) {
context.setFogColor(color);
return this;
}
@Override
public EffectsProperties.Mutable setWaterColor(int color) {
context.setWaterColor(color);
return this;
}
@Override
public EffectsProperties.Mutable setWaterFogColor(int color) {
context.setWaterFogColor(color);
return this;
}
@Override
public EffectsProperties.Mutable setSkyColor(int color) {
context.setSkyColor(color);
return this;
}
@Override
public EffectsProperties.Mutable setFoliageColorOverride(@Nullable Integer colorOverride) {
context.setFoliageColor(Optional.ofNullable(colorOverride));
return this;
}
@Override
public EffectsProperties.Mutable setDryFoliageColorOverride(@Nullable Integer colorOverride) {
context.setDryFoliageColor(Optional.ofNullable(colorOverride));
return this;
}
@Override
public EffectsProperties.Mutable setGrassColorOverride(@Nullable Integer colorOverride) {
context.setGrassColor(Optional.ofNullable(colorOverride));
@@ -299,36 +285,6 @@ public class BiomeModificationsImpl {
context.setGrassColorModifier(modifier);
return this;
}
@Override
public EffectsProperties.Mutable setAmbientParticle(@Nullable AmbientParticleSettings settings) {
context.setParticleConfig(Optional.ofNullable(settings));
return this;
}
@Override
public EffectsProperties.Mutable setAmbientLoopSound(@Nullable Holder<SoundEvent> sound) {
context.setAmbientSound(Optional.ofNullable(sound));
return this;
}
@Override
public EffectsProperties.Mutable setAmbientMoodSound(@Nullable AmbientMoodSettings settings) {
context.setMoodSound(Optional.ofNullable(settings));
return this;
}
@Override
public EffectsProperties.Mutable setAmbientAdditionsSound(@Nullable AmbientAdditionsSettings settings) {
context.setAdditionsSound(Optional.ofNullable(settings));
return this;
}
@Override
public EffectsProperties.Mutable setBackgroundMusic(@Nullable WeightedList<Music> music) {
context.setMusic(Optional.ofNullable(music));
return this;
}
};
}

View File

@@ -22,8 +22,8 @@ package dev.architectury.registry.level.entity.trade.fabric;
import dev.architectury.registry.level.entity.trade.TradeRegistry;
import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.entity.npc.VillagerTrades;
import net.minecraft.world.entity.npc.villager.VillagerProfession;
import net.minecraft.world.entity.npc.villager.VillagerTrades;
import java.util.Collections;

View File

@@ -39,7 +39,7 @@ import net.minecraft.core.MappedRegistry;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import org.jetbrains.annotations.Nullable;
import java.util.*;
@@ -50,9 +50,9 @@ public class RegistrarManagerImpl {
private static final Multimap<RegistryEntryId<?>, Consumer<?>> LISTENERS = HashMultimap.create();
private static final Set<ResourceKey<?>> LISTENED_REGISTRIES = new HashSet<>();
private static void listen(ResourceKey<?> resourceKey, ResourceLocation id, Consumer<?> listener) {
private static void listen(ResourceKey<?> resourceKey, Identifier id, Consumer<?> listener) {
if (LISTENED_REGISTRIES.add(resourceKey)) {
Registry<?> registry = java.util.Objects.requireNonNull(BuiltInRegistries.REGISTRY.getValue(resourceKey.location()), "Registry " + resourceKey + " not found!");
Registry<?> registry = java.util.Objects.requireNonNull(BuiltInRegistries.REGISTRY.getValue(resourceKey.identifier()), "Registry " + resourceKey + " not found!");
RegistryEntryAddedCallback.event(registry).register((rawId, entryId, object) -> {
RegistryEntryId<?> registryEntryId = new RegistryEntryId<>(resourceKey, entryId);
for (Consumer<?> consumer : LISTENERS.get(registryEntryId)) {
@@ -78,7 +78,7 @@ public class RegistrarManagerImpl {
@Override
public <T> Registrar<T> get(ResourceKey<Registry<T>> key) {
return new RegistrarImpl<>(modId, (Registry<T>) java.util.Objects.requireNonNull(BuiltInRegistries.REGISTRY.getValue(key.location()), "Registry " + key + " not found!"));
return new RegistrarImpl<>(modId, (Registry<T>) java.util.Objects.requireNonNull(BuiltInRegistries.REGISTRY.getValue(key.identifier()), "Registry " + key + " not found!"));
}
@Override
@@ -92,16 +92,16 @@ public class RegistrarManagerImpl {
}
@Override
public <T> RegistrarBuilder<T> builder(Class<T> type, ResourceLocation registryId) {
public <T> RegistrarBuilder<T> builder(Class<T> type, Identifier registryId) {
return new RegistrarBuilderWrapper<>(modId, type, registryId);
}
}
public static class RegistryEntryId<T> {
private final ResourceKey<T> registryKey;
private final ResourceLocation id;
private final Identifier id;
public RegistryEntryId(ResourceKey<T> registryKey, ResourceLocation id) {
public RegistryEntryId(ResourceKey<T> registryKey, Identifier id) {
this.registryKey = registryKey;
this.id = id;
}
@@ -123,12 +123,12 @@ public class RegistrarManagerImpl {
public static class RegistrarBuilderWrapper<T> implements RegistrarBuilder<T> {
private final String modId;
private final Class<T> type;
private final ResourceLocation registryId;
private final Identifier registryId;
private final List<Consumer<FabricRegistryBuilder<T, ? extends MappedRegistry<T>>>> apply = new ArrayList<>();
@Nullable
private ResourceLocation defaultId;
private Identifier defaultId;
public RegistrarBuilderWrapper(String modId, Class<T> type, ResourceLocation registryId) {
public RegistrarBuilderWrapper(String modId, Class<T> type, Identifier registryId) {
this.modId = modId;
this.type = type;
this.registryId = registryId;
@@ -164,7 +164,7 @@ public class RegistrarManagerImpl {
}
@Override
public RegistrySupplier<T> delegate(ResourceLocation id) {
public RegistrySupplier<T> delegate(Identifier id) {
Supplier<T> value = Suppliers.memoize(() -> get(id));
RegistrarImpl<T> registrar = this;
return new RegistrySupplierImpl<T>() {
@@ -189,12 +189,12 @@ public class RegistrarManagerImpl {
}
@Override
public ResourceLocation getRegistryId() {
return delegate.key().location();
public Identifier getRegistryId() {
return delegate.key().identifier();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return id;
}
@@ -228,13 +228,13 @@ public class RegistrarManagerImpl {
}
@Override
public <E extends T> RegistrySupplier<E> register(ResourceLocation id, Supplier<E> supplier) {
public <E extends T> RegistrySupplier<E> register(Identifier id, Supplier<E> supplier) {
Registry.register(delegate, id, supplier.get());
return (RegistrySupplier<E>) delegate(id);
}
@Override
public @Nullable ResourceLocation getId(T obj) {
public @Nullable Identifier getId(T obj) {
return delegate.getKey(obj);
}
@@ -249,7 +249,7 @@ public class RegistrarManagerImpl {
}
@Override
public @Nullable T get(ResourceLocation id) {
public @Nullable T get(Identifier id) {
return delegate.getValue(id);
}
@@ -259,7 +259,7 @@ public class RegistrarManagerImpl {
}
@Override
public boolean contains(ResourceLocation id) {
public boolean contains(Identifier id) {
return delegate.keySet().contains(id);
}
@@ -269,7 +269,7 @@ public class RegistrarManagerImpl {
}
@Override
public Set<ResourceLocation> getIds() {
public Set<Identifier> getIds() {
return delegate.keySet();
}
@@ -295,7 +295,7 @@ public class RegistrarManagerImpl {
}
@Override
public void listen(ResourceLocation id, Consumer<T> callback) {
public void listen(Identifier id, Consumer<T> callback) {
if (contains(id)) {
callback.accept(get(id));
} else {

View File

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

View File

@@ -26,7 +26,7 @@ import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
@@ -83,34 +83,34 @@ class ArchitecturyFluidAttributesForge extends FluidType {
}
@Override
public ResourceLocation getStillTexture() {
public Identifier getStillTexture() {
return attributes.getSourceTexture();
}
@Override
public ResourceLocation getFlowingTexture() {
public Identifier getFlowingTexture() {
return attributes.getFlowingTexture();
}
@Override
@Nullable
public ResourceLocation getOverlayTexture() {
public Identifier getOverlayTexture() {
return attributes.getOverlayTexture();
}
@Override
public ResourceLocation getStillTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
public Identifier getStillTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
return attributes.getSourceTexture(state, getter, pos);
}
@Override
public ResourceLocation getFlowingTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
public Identifier getFlowingTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
return attributes.getFlowingTexture(state, getter, pos);
}
@Override
@Nullable
public ResourceLocation getOverlayTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
public Identifier getOverlayTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
return attributes.getOverlayTexture(state, getter, pos);
}
@@ -125,18 +125,18 @@ class ArchitecturyFluidAttributesForge extends FluidType {
}
@Override
public ResourceLocation getStillTexture(FluidStack stack) {
public Identifier getStillTexture(FluidStack stack) {
return attributes.getSourceTexture(convertSafe(stack));
}
@Override
public ResourceLocation getFlowingTexture(FluidStack stack) {
public Identifier getFlowingTexture(FluidStack stack) {
return attributes.getFlowingTexture(convertSafe(stack));
}
@Override
@Nullable
public ResourceLocation getOverlayTexture(FluidStack stack) {
public Identifier getOverlayTexture(FluidStack stack) {
return attributes.getOverlayTexture(convertSafe(stack));
}
});

View File

@@ -27,7 +27,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.material.Fluid;
@@ -71,7 +71,7 @@ public class FluidStackHooksImpl {
@Nullable
public static TextureAtlasSprite getStillTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) {
if (state.getType() == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(state).getStillTexture(state, level, pos);
Identifier texture = IClientFluidTypeExtensions.of(state).getStillTexture(state, level, pos);
return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture);
}
@@ -79,7 +79,7 @@ public class FluidStackHooksImpl {
@Nullable
public static TextureAtlasSprite getStillTexture(FluidStack stack) {
if (stack.getFluid() == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(stack.getFluid()).getStillTexture(FluidStackHooksForge.toForge(stack));
Identifier texture = IClientFluidTypeExtensions.of(stack.getFluid()).getStillTexture(FluidStackHooksForge.toForge(stack));
return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture);
}
@@ -87,7 +87,7 @@ public class FluidStackHooksImpl {
@Nullable
public static TextureAtlasSprite getStillTexture(Fluid fluid) {
if (fluid == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(fluid).getStillTexture();
Identifier texture = IClientFluidTypeExtensions.of(fluid).getStillTexture();
return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture);
}
@@ -95,7 +95,7 @@ public class FluidStackHooksImpl {
@Nullable
public static TextureAtlasSprite getFlowingTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) {
if (state.getType() == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(state).getFlowingTexture(state, level, pos);
Identifier texture = IClientFluidTypeExtensions.of(state).getFlowingTexture(state, level, pos);
return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture);
}
@@ -103,7 +103,7 @@ public class FluidStackHooksImpl {
@Nullable
public static TextureAtlasSprite getFlowingTexture(FluidStack stack) {
if (stack.getFluid() == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(stack.getFluid()).getFlowingTexture(FluidStackHooksForge.toForge(stack));
Identifier texture = IClientFluidTypeExtensions.of(stack.getFluid()).getFlowingTexture(FluidStackHooksForge.toForge(stack));
return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture);
}
@@ -111,7 +111,7 @@ public class FluidStackHooksImpl {
@Nullable
public static TextureAtlasSprite getFlowingTexture(Fluid fluid) {
if (fluid == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(fluid).getFlowingTexture();
Identifier texture = IClientFluidTypeExtensions.of(fluid).getFlowingTexture();
return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture);
}

View File

@@ -21,7 +21,7 @@ package dev.architectury.hooks.forgelike;
import com.mojang.serialization.Codec;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.Item;
import net.minecraftforge.common.world.BiomeModifier;
import org.jetbrains.annotations.ApiStatus;
@@ -31,7 +31,7 @@ import java.util.function.Supplier;
@ApiStatus.Internal
public class ForgeLikeHooks {
@ExpectPlatform
public static void registerBiomeModifier(ResourceLocation id, Supplier<Codec<? extends BiomeModifier>> codecSupplier) {
public static void registerBiomeModifier(Identifier id, Supplier<Codec<? extends BiomeModifier>> codecSupplier) {
throw new AssertionError();
}

View File

@@ -29,7 +29,7 @@ import dev.architectury.registry.registries.DeferredSupplier;
import dev.architectury.utils.ArchitecturyConstants;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.CreativeModeTabRegistry;
@@ -92,18 +92,18 @@ public class CreativeTabRegistryImpl {
@ApiStatus.Experimental
public static DeferredSupplier<CreativeModeTab> ofBuiltin(CreativeModeTab tab) {
ResourceLocation key = BuiltInRegistries.CREATIVE_MODE_TAB.getKey(tab);
Identifier key = BuiltInRegistries.CREATIVE_MODE_TAB.getKey(tab);
if (key == null) {
throw new IllegalArgumentException("Builtin tab %s is not registered!".formatted(tab));
}
return new DeferredSupplier<>() {
@Override
public ResourceLocation getRegistryId() {
public Identifier getRegistryId() {
return Registries.CREATIVE_MODE_TAB.location();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return BuiltInRegistries.CREATIVE_MODE_TAB.getKey(tab);
}
@@ -120,18 +120,18 @@ public class CreativeTabRegistryImpl {
}
@ApiStatus.Experimental
public static DeferredSupplier<CreativeModeTab> defer(ResourceLocation name) {
public static DeferredSupplier<CreativeModeTab> defer(Identifier name) {
return new DeferredSupplier<>() {
@Nullable
private CreativeModeTab tab;
@Override
public ResourceLocation getRegistryId() {
public Identifier getRegistryId() {
return Registries.CREATIVE_MODE_TAB.location();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return name;
}

View File

@@ -23,7 +23,7 @@ import com.google.common.collect.Lists;
import dev.architectury.platform.hooks.EventBusesHooks;
import dev.architectury.utils.ArchitecturyConstants;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.resources.PreparableReloadListener;
import net.minecraft.server.packs.resources.ReloadableResourceManager;
@@ -43,7 +43,7 @@ public class ReloadListenerRegistryImpl {
MinecraftForge.EVENT_BUS.addListener(ReloadListenerRegistryImpl::addReloadListeners);
}
public static void register(PackType type, PreparableReloadListener listener, ResourceLocation listenerId, Collection<ResourceLocation> dependencies) {
public static void register(PackType type, PreparableReloadListener listener, Identifier listenerId, Collection<Identifier> dependencies) {
if (type == PackType.SERVER_DATA) {
serverDataReloadListeners.add(listener);
} else if (type == PackType.CLIENT_RESOURCES) {

View File

@@ -21,16 +21,16 @@ package dev.architectury.registry.item.forge;
import net.minecraft.client.renderer.item.ClampedItemPropertyFunction;
import net.minecraft.client.renderer.item.ItemProperties;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.ItemLike;
public class ItemPropertiesRegistryImpl {
public static ClampedItemPropertyFunction registerGeneric(ResourceLocation propertyId, ClampedItemPropertyFunction function) {
public static ClampedItemPropertyFunction registerGeneric(Identifier propertyId, ClampedItemPropertyFunction function) {
ItemProperties.registerGeneric(propertyId, function);
return function;
}
public static ClampedItemPropertyFunction register(ItemLike item, ResourceLocation propertyId, ClampedItemPropertyFunction function) {
public static ClampedItemPropertyFunction register(ItemLike item, Identifier propertyId, ClampedItemPropertyFunction function) {
ItemProperties.register(item.asItem(), propertyId, function);
return function;
}

View File

@@ -30,7 +30,7 @@ import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.MinecraftServer;
import net.minecraft.sounds.Music;
import net.minecraft.sounds.SoundEvent;
@@ -62,7 +62,7 @@ public class BiomeModificationsImpl {
private static Codec<BiomeModifierImpl> noneBiomeModCodec = null;
public static void init() {
ForgeLikeHooks.registerBiomeModifier(new ResourceLocation(ArchitecturyConstants.MOD_ID, "none_biome_mod_codec"),
ForgeLikeHooks.registerBiomeModifier(new Identifier(ArchitecturyConstants.MOD_ID, "none_biome_mod_codec"),
() -> noneBiomeModCodec = Codec.unit(BiomeModifierImpl.INSTANCE));
}
@@ -121,7 +121,7 @@ public class BiomeModificationsImpl {
BiomeProperties properties = new BiomeWrapped(event);
@Override
public Optional<ResourceLocation> getKey() {
public Optional<Identifier> getKey() {
return biomeResourceKey.map(ResourceKey::location);
}
@@ -329,35 +329,21 @@ public class BiomeModificationsImpl {
this.builder = builder;
}
@Override
public int getFogColor() {
if (builder instanceof BiomeSpecialEffectsBuilder b) return b.getFogColor();
return builder.fogColor.orElse(-1);
}
@Override
public int getWaterColor() {
if (builder instanceof BiomeSpecialEffectsBuilder b) return b.getWaterFogColor();
return builder.waterColor.orElse(-1);
}
@Override
public int getWaterFogColor() {
if (builder instanceof BiomeSpecialEffectsBuilder b) return b.getWaterFogColor();
return builder.waterFogColor.orElse(-1);
}
@Override
public int getSkyColor() {
if (builder instanceof BiomeSpecialEffectsBuilder b) return b.getSkyColor();
return builder.skyColor.orElse(-1);
}
@Override
public OptionalInt getFoliageColorOverride() {
return builder.foliageColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
}
@Override
public OptionalInt getDryFoliageColorOverride() {
return builder.dryFoliageColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
}
@Override
public OptionalInt getGrassColorOverride() {
return builder.grassColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
@@ -368,61 +354,24 @@ public class BiomeModificationsImpl {
return builder.grassColorModifier;
}
@Override
public Optional<AmbientParticleSettings> getAmbientParticle() {
return builder.ambientParticle;
}
@Override
public Optional<Holder<SoundEvent>> getAmbientLoopSound() {
return builder.ambientLoopSoundEvent;
}
@Override
public Optional<AmbientMoodSettings> getAmbientMoodSound() {
return builder.ambientMoodSettings;
}
@Override
public Optional<AmbientAdditionsSettings> getAmbientAdditionsSound() {
return builder.ambientAdditionsSettings;
}
@Override
public Optional<Music> getBackgroundMusic() {
return builder.backgroundMusic;
}
@Override
public Mutable setFogColor(int color) {
builder.fogColor(color);
return this;
}
@Override
public Mutable setWaterColor(int color) {
builder.waterColor(color);
return this;
}
@Override
public Mutable setWaterFogColor(int color) {
builder.waterFogColor(color);
return this;
}
@Override
public Mutable setSkyColor(int color) {
builder.skyColor(color);
return this;
}
@Override
public Mutable setFoliageColorOverride(@Nullable Integer colorOverride) {
builder.foliageColorOverride = Optional.ofNullable(colorOverride);
return this;
}
@Override
public Mutable setDryFoliageColorOverride(@Nullable Integer colorOverride) {
builder.dryFoliageColorOverride = Optional.ofNullable(colorOverride);
return this;
}
@Override
public Mutable setGrassColorOverride(@Nullable Integer colorOverride) {
builder.foliageColorOverride = Optional.ofNullable(colorOverride);
@@ -434,36 +383,6 @@ public class BiomeModificationsImpl {
builder.grassColorModifier(modifier);
return this;
}
@Override
public Mutable setAmbientParticle(@Nullable AmbientParticleSettings settings) {
builder.ambientParticle = Optional.ofNullable(settings);
return this;
}
@Override
public Mutable setAmbientLoopSound(@Nullable Holder<SoundEvent> sound) {
builder.ambientLoopSoundEvent = Optional.ofNullable(sound);
return this;
}
@Override
public Mutable setAmbientMoodSound(@Nullable AmbientMoodSettings settings) {
builder.ambientMoodSettings = Optional.ofNullable(settings);
return this;
}
@Override
public Mutable setAmbientAdditionsSound(@Nullable AmbientAdditionsSettings settings) {
builder.ambientAdditionsSettings = Optional.ofNullable(settings);
return this;
}
@Override
public Mutable setBackgroundMusic(@Nullable Music music) {
builder.backgroundMusic = Optional.ofNullable(music);
return this;
}
}
private static class MutableGenerationSettingsBuilderWrapped extends GenerationSettingsBuilderWrapped implements GenerationProperties.Mutable {

View File

@@ -3,23 +3,23 @@ org.gradle.daemon=false
platforms=fabric,neoforge
minecraft_version=1.21.10
supported_version=1.21.10
minecraft_version=1.21.11
supported_version=1.21.11
artifact_type=release
archives_base_name=architectury
archives_base_name_snapshot=architectury-snapshot
base_version=18.0
base_version=19.0
maven_group=dev.architectury
version_suffix=
fabric_loader_version=0.17.2
fabric_api_version=0.136.0+1.21.10
mod_menu_version=15.0.0-beta.1
fabric_loader_version=0.18.2
fabric_api_version=0.139.4+1.21.11
mod_menu_version=17.0.0-alpha.1
forge_version=51.0.0
neoforge_version=21.10.38-beta
forge_version=61.0.1
neoforge_version=21.11.0-beta
# Set to empty if not snapshots
neoforge_pr=

View File

@@ -22,7 +22,7 @@ package dev.architectury.hooks.forgelike.forge;
import com.mojang.serialization.Codec;
import dev.architectury.platform.hooks.EventBusesHooks;
import dev.architectury.utils.ArchitecturyConstants;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.Item;
import net.minecraftforge.common.world.BiomeModifier;
import net.minecraftforge.registries.ForgeRegistries;
@@ -31,7 +31,7 @@ import net.minecraftforge.registries.RegisterEvent;
import java.util.function.Supplier;
public class ForgeLikeHooksImpl {
public static void registerBiomeModifier(ResourceLocation id, Supplier<Codec<? extends BiomeModifier>> codecSupplier) {
public static void registerBiomeModifier(Identifier id, Supplier<Codec<? extends BiomeModifier>> codecSupplier) {
EventBusesHooks.whenAvailable(ArchitecturyConstants.MOD_ID, bus -> {
bus.<RegisterEvent>addListener(event -> {
event.register(ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, registry -> {

View File

@@ -21,7 +21,7 @@ package dev.architectury.networking.forge;
import dev.architectury.networking.NetworkManager;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -40,11 +40,11 @@ public class ClientNetworkingManager {
MinecraftForge.EVENT_BUS.register(ClientNetworkingManager.class);
NetworkManagerImpl.registerS2CReceiver(NetworkManagerImpl.SYNC_IDS, Collections.emptyList(), (buffer, context) -> {
Set<ResourceLocation> receivables = NetworkManagerImpl.serverReceivables;
Set<Identifier> receivables = NetworkManagerImpl.serverReceivables;
int size = buffer.readInt();
receivables.clear();
for (int i = 0; i < size; i++) {
receivables.add(buffer.readResourceLocation());
receivables.add(buffer.readIdentifier());
}
context.queue(() -> {
NetworkManager.sendToServer(NetworkManagerImpl.SYNC_IDS, NetworkManagerImpl.sendSyncPacket(NetworkManagerImpl.C2S));

View File

@@ -31,7 +31,7 @@ import io.netty.buffer.Unpooled;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
@@ -54,7 +54,7 @@ import java.util.function.Consumer;
@Mod.EventBusSubscriber(modid = "architectury")
public class NetworkManagerImpl {
public static void registerReceiver(NetworkManager.Side side, ResourceLocation id, List<PacketTransformer> packetTransformers, NetworkReceiver receiver) {
public static void registerReceiver(NetworkManager.Side side, Identifier id, List<PacketTransformer> packetTransformers, NetworkReceiver receiver) {
Objects.requireNonNull(id, "Cannot register receiver with a null ID!");
packetTransformers = Objects.requireNonNullElse(packetTransformers, List.of());
Objects.requireNonNull(receiver, "Cannot register a null receiver!");
@@ -65,14 +65,14 @@ public class NetworkManagerImpl {
}
}
public static Packet<?> toPacket(NetworkManager.Side side, ResourceLocation id, FriendlyByteBuf buffer) {
public static Packet<?> toPacket(NetworkManager.Side side, Identifier id, FriendlyByteBuf buffer) {
FriendlyByteBuf packetBuffer = new FriendlyByteBuf(Unpooled.buffer());
packetBuffer.writeResourceLocation(id);
packetBuffer.writeIdentifier(id);
packetBuffer.writeBytes(buffer);
return (side == NetworkManager.Side.C2S ? NetworkDirection.PLAY_TO_SERVER : NetworkDirection.PLAY_TO_CLIENT).buildPacket(packetBuffer, CHANNEL_ID).getThis();
}
public static void collectPackets(PacketSink sink, NetworkManager.Side side, ResourceLocation id, FriendlyByteBuf buf) {
public static void collectPackets(PacketSink sink, NetworkManager.Side side, Identifier id, FriendlyByteBuf buf) {
PacketTransformer transformer = side == NetworkManager.Side.C2S ? C2S_TRANSFORMERS.get(id) : S2C_TRANSFORMERS.get(id);
if (transformer != null) {
transformer.outbound(side, id, buf, (side1, id1, buf1) -> {
@@ -84,15 +84,15 @@ public class NetworkManagerImpl {
}
private static final Logger LOGGER = LogUtils.getLogger();
private static final ResourceLocation CHANNEL_ID = new ResourceLocation("architectury:network");
static final ResourceLocation SYNC_IDS = new ResourceLocation("architectury:sync_ids");
private static final Identifier CHANNEL_ID = new Identifier("architectury:network");
static final Identifier SYNC_IDS = new Identifier("architectury:sync_ids");
static final EventNetworkChannel CHANNEL = ChannelBuilder.named(CHANNEL_ID).acceptedVersions((status, version) -> true).optional().eventNetworkChannel();
static final Map<ResourceLocation, NetworkReceiver> S2C = Maps.newHashMap();
static final Map<ResourceLocation, NetworkReceiver> C2S = Maps.newHashMap();
static final Map<ResourceLocation, PacketTransformer> S2C_TRANSFORMERS = Maps.newHashMap();
static final Map<ResourceLocation, PacketTransformer> C2S_TRANSFORMERS = Maps.newHashMap();
static final Set<ResourceLocation> serverReceivables = Sets.newHashSet();
private static final Multimap<Player, ResourceLocation> clientReceivables = Multimaps.newMultimap(Maps.newHashMap(), Sets::newHashSet);
static final Map<Identifier, NetworkReceiver> S2C = Maps.newHashMap();
static final Map<Identifier, NetworkReceiver> C2S = Maps.newHashMap();
static final Map<Identifier, PacketTransformer> S2C_TRANSFORMERS = Maps.newHashMap();
static final Map<Identifier, PacketTransformer> C2S_TRANSFORMERS = Maps.newHashMap();
static final Set<Identifier> serverReceivables = Sets.newHashSet();
private static final Multimap<Player, Identifier> clientReceivables = Multimaps.newMultimap(Maps.newHashMap(), Sets::newHashSet);
static {
CHANNEL.addListener(createPacketHandler(NetworkDirection.PLAY_TO_SERVER, C2S_TRANSFORMERS));
@@ -100,23 +100,23 @@ public class NetworkManagerImpl {
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> ClientNetworkingManager::initClient);
registerC2SReceiver(SYNC_IDS, Collections.emptyList(), (buffer, context) -> {
Set<ResourceLocation> receivables = (Set<ResourceLocation>) clientReceivables.get(context.getPlayer());
Set<Identifier> receivables = (Set<Identifier>) clientReceivables.get(context.getPlayer());
int size = buffer.readInt();
receivables.clear();
for (int i = 0; i < size; i++) {
receivables.add(buffer.readResourceLocation());
receivables.add(buffer.readIdentifier());
}
});
}
static <T extends CustomPayloadEvent> Consumer<T> createPacketHandler(NetworkDirection direction, Map<ResourceLocation, PacketTransformer> map) {
static <T extends CustomPayloadEvent> Consumer<T> createPacketHandler(NetworkDirection direction, Map<Identifier, PacketTransformer> map) {
return event -> {
CustomPayloadEvent.Context context = event.getSource();
if (context.getDirection() != direction) return;
if (context.getPacketHandled()) return;
FriendlyByteBuf buffer = event.getPayload();
if (buffer == null) return;
ResourceLocation type = buffer.readResourceLocation();
Identifier type = buffer.readIdentifier();
PacketTransformer transformer = map.get(type);
if (transformer != null) {
@@ -157,25 +157,25 @@ public class NetworkManagerImpl {
}
@OnlyIn(Dist.CLIENT)
public static void registerS2CReceiver(ResourceLocation id, List<PacketTransformer> packetTransformers, NetworkReceiver receiver) {
public static void registerS2CReceiver(Identifier id, List<PacketTransformer> packetTransformers, NetworkReceiver receiver) {
LOGGER.info("Registering S2C receiver with id {}", id);
S2C.put(id, receiver);
PacketTransformer transformer = PacketTransformer.concat(packetTransformers);
S2C_TRANSFORMERS.put(id, transformer);
}
public static void registerC2SReceiver(ResourceLocation id, List<PacketTransformer> packetTransformers, NetworkReceiver receiver) {
public static void registerC2SReceiver(Identifier id, List<PacketTransformer> packetTransformers, NetworkReceiver receiver) {
LOGGER.info("Registering C2S receiver with id {}", id);
C2S.put(id, receiver);
PacketTransformer transformer = PacketTransformer.concat(packetTransformers);
C2S_TRANSFORMERS.put(id, transformer);
}
public static boolean canServerReceive(ResourceLocation id) {
public static boolean canServerReceive(Identifier id) {
return serverReceivables.contains(id);
}
public static boolean canPlayerReceive(ServerPlayer player, ResourceLocation id) {
public static boolean canPlayerReceive(ServerPlayer player, Identifier id) {
return clientReceivables.get(player).contains(id);
}
@@ -183,12 +183,12 @@ public class NetworkManagerImpl {
return ForgeHooks.getEntitySpawnPacket(entity);
}
static FriendlyByteBuf sendSyncPacket(Map<ResourceLocation, NetworkReceiver> map) {
List<ResourceLocation> availableIds = Lists.newArrayList(map.keySet());
static FriendlyByteBuf sendSyncPacket(Map<Identifier, NetworkReceiver> map) {
List<Identifier> availableIds = Lists.newArrayList(map.keySet());
FriendlyByteBuf packetBuffer = new FriendlyByteBuf(Unpooled.buffer());
packetBuffer.writeInt(availableIds.size());
for (ResourceLocation availableId : availableIds) {
packetBuffer.writeResourceLocation(availableId);
for (Identifier availableId : availableIds) {
packetBuffer.writeIdentifier(availableId);
}
return packetBuffer;
}

View File

@@ -36,7 +36,7 @@ import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@@ -54,7 +54,7 @@ public class RegistrarManagerImpl {
private static final Logger LOGGER = LogManager.getLogger(RegistrarManagerImpl.class);
private static final Multimap<RegistryEntryId<?>, Consumer<?>> LISTENERS = HashMultimap.create();
private static void listen(ResourceKey<?> resourceKey, ResourceLocation id, Consumer<?> listener, boolean vanilla) {
private static void listen(ResourceKey<?> resourceKey, Identifier id, Consumer<?> listener, boolean vanilla) {
LISTENERS.put(new RegistryEntryId<>(resourceKey, id), listener);
}
@@ -64,9 +64,9 @@ public class RegistrarManagerImpl {
public static class Data<T> {
private boolean registered = false;
private final Map<ResourceLocation, Supplier<? extends T>> objects = new LinkedHashMap<>();
private final Map<Identifier, Supplier<? extends T>> objects = new LinkedHashMap<>();
public void registerForForge(IForgeRegistry<T> registry, ResourceLocation location, Object[] objectArr, Supplier<? extends T> reference) {
public void registerForForge(IForgeRegistry<T> registry, Identifier location, Object[] objectArr, Supplier<? extends T> reference) {
if (!registered) {
objects.put(location, () -> {
T value = reference.get();
@@ -87,7 +87,7 @@ public class RegistrarManagerImpl {
}
}
public void register(Registry<T> registry, ResourceLocation location, Supplier<? extends T> reference) {
public void register(Registry<T> registry, Identifier location, Supplier<? extends T> reference) {
if (!registered) {
objects.put(location, reference);
} else {
@@ -103,7 +103,7 @@ public class RegistrarManagerImpl {
}
}
public record RegistryEntryId<T>(ResourceKey<T> registryKey, ResourceLocation id) {
public record RegistryEntryId<T>(ResourceKey<T> registryKey, Identifier id) {
@Override
public String toString() {
return "Registry Entry [%s / %s]".formatted(registryKey.location(), id);
@@ -173,7 +173,7 @@ public class RegistrarManagerImpl {
}
@Override
public <T> RegistrarBuilder<T> builder(Class<T> type, ResourceLocation registryId) {
public <T> RegistrarBuilder<T> builder(Class<T> type, Identifier registryId) {
return new RegistryBuilderWrapper<>(this, new net.minecraftforge.registries.RegistryBuilder<>()
.setName(registryId), registryId);
}
@@ -193,8 +193,8 @@ public class RegistrarManagerImpl {
event.register(resourceKey, registry -> {
data.registered = true;
for (Map.Entry<ResourceLocation, Supplier<? extends T>> entry : data.objects.entrySet()) {
ResourceLocation location = entry.getKey();
for (Map.Entry<Identifier, Supplier<? extends T>> entry : data.objects.entrySet()) {
Identifier location = entry.getKey();
T value = entry.getValue().get();
registry.register(location, value);
@@ -273,10 +273,10 @@ public class RegistrarManagerImpl {
public static class RegistryBuilderWrapper<T> implements RegistrarBuilder<T> {
private final RegistryProviderImpl provider;
private final net.minecraftforge.registries.RegistryBuilder<?> builder;
private final ResourceLocation registryId;
private final Identifier registryId;
private boolean syncToClients = false;
public RegistryBuilderWrapper(RegistryProviderImpl provider, RegistryBuilder<?> builder, ResourceLocation registryId) {
public RegistryBuilderWrapper(RegistryProviderImpl provider, RegistryBuilder<?> builder, Identifier registryId) {
this.provider = provider;
this.builder = builder;
this.registryId = registryId;
@@ -324,7 +324,7 @@ public class RegistrarManagerImpl {
}
@Override
public RegistrySupplier<T> delegate(ResourceLocation id) {
public RegistrySupplier<T> delegate(Identifier id) {
Supplier<T> value = Suppliers.memoize(() -> get(id));
Registrar<T> registrar = this;
return new RegistrySupplierImpl<T>() {
@@ -349,12 +349,12 @@ public class RegistrarManagerImpl {
}
@Override
public ResourceLocation getRegistryId() {
public Identifier getRegistryId() {
return delegate.key().location();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return id;
}
@@ -389,7 +389,7 @@ public class RegistrarManagerImpl {
}
@Override
public <E extends T> RegistrySupplier<E> register(ResourceLocation id, Supplier<E> supplier) {
public <E extends T> RegistrySupplier<E> register(Identifier id, Supplier<E> supplier) {
Data<T> data = (Data<T>) registry.computeIfAbsent(key(), type -> new Data<>());
data.register(delegate, id, supplier);
return (RegistrySupplier<E>) delegate(id);
@@ -397,7 +397,7 @@ public class RegistrarManagerImpl {
@Override
@Nullable
public ResourceLocation getId(T obj) {
public Identifier getId(T obj) {
return delegate.getKey(obj);
}
@@ -413,7 +413,7 @@ public class RegistrarManagerImpl {
@Override
@Nullable
public T get(ResourceLocation id) {
public T get(Identifier id) {
return delegate.get(id);
}
@@ -423,7 +423,7 @@ public class RegistrarManagerImpl {
}
@Override
public boolean contains(ResourceLocation resourceLocation) {
public boolean contains(Identifier resourceLocation) {
return delegate.keySet().contains(resourceLocation);
}
@@ -433,7 +433,7 @@ public class RegistrarManagerImpl {
}
@Override
public Set<ResourceLocation> getIds() {
public Set<Identifier> getIds() {
return delegate.keySet();
}
@@ -459,7 +459,7 @@ public class RegistrarManagerImpl {
}
@Override
public void listen(ResourceLocation id, Consumer<T> callback) {
public void listen(Identifier id, Consumer<T> callback) {
if (contains(id)) {
callback.accept(get(id));
} else {
@@ -480,7 +480,7 @@ public class RegistrarManagerImpl {
}
@Override
public RegistrySupplier<T> delegate(ResourceLocation id) {
public RegistrySupplier<T> delegate(Identifier id) {
Supplier<T> value = Suppliers.memoize(() -> get(id));
Registrar<T> registrar = this;
return new RegistrySupplierImpl<T>() {
@@ -505,12 +505,12 @@ public class RegistrarManagerImpl {
}
@Override
public ResourceLocation getRegistryId() {
public Identifier getRegistryId() {
return delegate.getRegistryName();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return id;
}
@@ -545,7 +545,7 @@ public class RegistrarManagerImpl {
}
@Override
public <E extends T> RegistrySupplier<E> register(ResourceLocation id, Supplier<E> supplier) {
public <E extends T> RegistrySupplier<E> register(Identifier id, Supplier<E> supplier) {
Object[] objectArr = new Object[]{null};
Data<T> data = (Data<T>) registry.computeIfAbsent(key(), type -> new Data<>());
data.registerForForge(delegate, id, objectArr, supplier);
@@ -572,12 +572,12 @@ public class RegistrarManagerImpl {
}
@Override
public ResourceLocation getRegistryId() {
public Identifier getRegistryId() {
return delegate.getRegistryName();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return id;
}
@@ -616,7 +616,7 @@ public class RegistrarManagerImpl {
@Override
@Nullable
public ResourceLocation getId(T obj) {
public Identifier getId(T obj) {
return delegate.getKey(obj);
}
@@ -632,7 +632,7 @@ public class RegistrarManagerImpl {
@Override
@Nullable
public T get(ResourceLocation id) {
public T get(Identifier id) {
return delegate.getValue(id);
}
@@ -642,7 +642,7 @@ public class RegistrarManagerImpl {
}
@Override
public boolean contains(ResourceLocation resourceLocation) {
public boolean contains(Identifier resourceLocation) {
return delegate.containsKey(resourceLocation);
}
@@ -652,7 +652,7 @@ public class RegistrarManagerImpl {
}
@Override
public Set<ResourceLocation> getIds() {
public Set<Identifier> getIds() {
return delegate.getKeys();
}
@@ -678,7 +678,7 @@ public class RegistrarManagerImpl {
}
@Override
public void listen(ResourceLocation id, Consumer<T> callback) {
public void listen(Identifier id, Consumer<T> callback) {
if (contains(id)) {
callback.accept(get(id));
} else {
@@ -690,10 +690,10 @@ public class RegistrarManagerImpl {
public static class DelegatedRegistrar<T> implements Registrar<T> {
private final String modId;
private final Supplier<Registrar<T>> delegate;
private final ResourceLocation registryId;
private final Identifier registryId;
private List<Runnable> onRegister = new ArrayList<>();
public DelegatedRegistrar(String modId, Supplier<Registrar<T>> delegate, ResourceLocation registryId) {
public DelegatedRegistrar(String modId, Supplier<Registrar<T>> delegate, Identifier registryId) {
this.modId = modId;
this.delegate = delegate;
this.registryId = registryId;
@@ -713,7 +713,7 @@ public class RegistrarManagerImpl {
}
@Override
public RegistrySupplier<T> delegate(ResourceLocation id) {
public RegistrySupplier<T> delegate(Identifier id) {
if (isReady()) return delegate.get().delegate(id);
return new RegistrySupplierImpl<T>() {
@Nullable
@@ -737,12 +737,12 @@ public class RegistrarManagerImpl {
}
@Override
public ResourceLocation getRegistryId() {
public Identifier getRegistryId() {
return DelegatedRegistrar.this.key().location();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return id;
}
@@ -759,7 +759,7 @@ public class RegistrarManagerImpl {
}
@Override
public <E extends T> RegistrySupplier<E> register(ResourceLocation id, Supplier<E> supplier) {
public <E extends T> RegistrySupplier<E> register(Identifier id, Supplier<E> supplier) {
if (isReady()) return delegate.get().register(id, supplier);
onRegister.add(() -> delegate.get().register(id, supplier));
return (RegistrySupplier<E>) delegate(id);
@@ -767,7 +767,7 @@ public class RegistrarManagerImpl {
@Override
@Nullable
public ResourceLocation getId(T obj) {
public Identifier getId(T obj) {
return !isReady() ? null : delegate.get().getId(obj);
}
@@ -783,7 +783,7 @@ public class RegistrarManagerImpl {
@Override
@Nullable
public T get(ResourceLocation id) {
public T get(Identifier id) {
return !isReady() ? null : delegate.get().get(id);
}
@@ -794,7 +794,7 @@ public class RegistrarManagerImpl {
}
@Override
public boolean contains(ResourceLocation id) {
public boolean contains(Identifier id) {
return isReady() && delegate.get().contains(id);
}
@@ -804,7 +804,7 @@ public class RegistrarManagerImpl {
}
@Override
public Set<ResourceLocation> getIds() {
public Set<Identifier> getIds() {
return isReady() ? delegate.get().getIds() : Collections.emptySet();
}
@@ -825,7 +825,7 @@ public class RegistrarManagerImpl {
}
@Override
public void listen(ResourceLocation id, Consumer<T> callback) {
public void listen(Identifier id, Consumer<T> callback) {
if (isReady()) {
delegate.get().listen(id, callback);
} else {

View File

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

View File

@@ -22,16 +22,14 @@ package dev.architectury.core.fluid.forge.imitator;
import com.google.common.base.MoreObjects;
import dev.architectury.core.fluid.ArchitecturyFluidAttributes;
import dev.architectury.fluid.forge.ArchitecturyFluidAttributesClient;
import dev.architectury.hooks.client.forge.ClientExtensionsRegistryImpl;
import dev.architectury.hooks.fluid.forge.FluidStackHooksForge;
import dev.architectury.platform.Platform;
import dev.architectury.utils.Env;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.Util;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@@ -41,18 +39,11 @@ import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
import net.neoforged.neoforge.common.SoundAction;
import net.neoforged.neoforge.fluids.FluidStack;
import net.neoforged.neoforge.fluids.FluidType;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Map;
import static net.minecraft.sounds.SoundEvents.BUCKET_EMPTY;
import static net.minecraft.sounds.SoundEvents.BUCKET_FILL;

View File

@@ -23,7 +23,7 @@ import dev.architectury.core.fluid.ArchitecturyFluidAttributes;
import dev.architectury.hooks.client.forge.ClientExtensionsRegistryImpl;
import dev.architectury.hooks.fluid.forge.FluidStackHooksForge;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.material.FluidState;
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
@@ -64,34 +64,34 @@ public class ArchitecturyFluidAttributesClient {
}
@Override
public ResourceLocation getStillTexture() {
public Identifier getStillTexture() {
return attributes.getSourceTexture();
}
@Override
public ResourceLocation getFlowingTexture() {
public Identifier getFlowingTexture() {
return attributes.getFlowingTexture();
}
@Override
@Nullable
public ResourceLocation getOverlayTexture() {
public Identifier getOverlayTexture() {
return attributes.getOverlayTexture();
}
@Override
public ResourceLocation getStillTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
public Identifier getStillTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
return attributes.getSourceTexture(state, getter, pos);
}
@Override
public ResourceLocation getFlowingTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
public Identifier getFlowingTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
return attributes.getFlowingTexture(state, getter, pos);
}
@Override
@Nullable
public ResourceLocation getOverlayTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
public Identifier getOverlayTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
return attributes.getOverlayTexture(state, getter, pos);
}
@@ -106,18 +106,18 @@ public class ArchitecturyFluidAttributesClient {
}
@Override
public ResourceLocation getStillTexture(FluidStack stack) {
public Identifier getStillTexture(FluidStack stack) {
return attributes.getSourceTexture(convertSafe(stack));
}
@Override
public ResourceLocation getFlowingTexture(FluidStack stack) {
public Identifier getFlowingTexture(FluidStack stack) {
return attributes.getFlowingTexture(convertSafe(stack));
}
@Override
@Nullable
public ResourceLocation getOverlayTexture(FluidStack stack) {
public Identifier getOverlayTexture(FluidStack stack) {
return attributes.getOverlayTexture(convertSafe(stack));
}
};

View File

@@ -26,7 +26,7 @@ import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.Material;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
@@ -38,42 +38,42 @@ public class ClientFluidStackHooksImpl {
@Nullable
public static TextureAtlasSprite getStillTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) {
if (state.getType() == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(state).getStillTexture(state, level, pos);
Identifier texture = IClientFluidTypeExtensions.of(state).getStillTexture(state, level, pos);
return Minecraft.getInstance().getAtlasManager().get(new Material(TextureAtlas.LOCATION_BLOCKS, texture));
}
@Nullable
public static TextureAtlasSprite getStillTexture(FluidStack stack) {
if (stack.getFluid() == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(stack.getFluid()).getStillTexture(FluidStackHooksForge.toForge(stack));
Identifier texture = IClientFluidTypeExtensions.of(stack.getFluid()).getStillTexture(FluidStackHooksForge.toForge(stack));
return Minecraft.getInstance().getAtlasManager().get(new Material(TextureAtlas.LOCATION_BLOCKS, texture));
}
@Nullable
public static TextureAtlasSprite getStillTexture(Fluid fluid) {
if (fluid == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(fluid).getStillTexture();
Identifier texture = IClientFluidTypeExtensions.of(fluid).getStillTexture();
return Minecraft.getInstance().getAtlasManager().get(new Material(TextureAtlas.LOCATION_BLOCKS, texture));
}
@Nullable
public static TextureAtlasSprite getFlowingTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) {
if (state.getType() == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(state).getFlowingTexture(state, level, pos);
Identifier texture = IClientFluidTypeExtensions.of(state).getFlowingTexture(state, level, pos);
return Minecraft.getInstance().getAtlasManager().get(new Material(TextureAtlas.LOCATION_BLOCKS, texture));
}
@Nullable
public static TextureAtlasSprite getFlowingTexture(FluidStack stack) {
if (stack.getFluid() == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(stack.getFluid()).getFlowingTexture(FluidStackHooksForge.toForge(stack));
Identifier texture = IClientFluidTypeExtensions.of(stack.getFluid()).getFlowingTexture(FluidStackHooksForge.toForge(stack));
return Minecraft.getInstance().getAtlasManager().get(new Material(TextureAtlas.LOCATION_BLOCKS, texture));
}
@Nullable
public static TextureAtlasSprite getFlowingTexture(Fluid fluid) {
if (fluid == Fluids.EMPTY) return null;
ResourceLocation texture = IClientFluidTypeExtensions.of(fluid).getFlowingTexture();
Identifier texture = IClientFluidTypeExtensions.of(fluid).getFlowingTexture();
return Minecraft.getInstance().getAtlasManager().get(new Material(TextureAtlas.LOCATION_BLOCKS, texture));
}

View File

@@ -37,7 +37,7 @@ import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.level.ServerEntity;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
@@ -118,11 +118,11 @@ public class NetworkManagerImpl {
};
}
public static boolean canServerReceive(ResourceLocation id) {
public static boolean canServerReceive(Identifier id) {
return ClientNetworkManagerImpl.canServerReceive(id);
}
public static boolean canPlayerReceive(ServerPlayer player, ResourceLocation id) {
public static boolean canPlayerReceive(ServerPlayer player, Identifier id) {
return player.connection.hasChannel(id);
}

View File

@@ -26,7 +26,7 @@ import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.player.Player;
public class ClientNetworkManagerImpl {
@@ -48,7 +48,7 @@ public class ClientNetworkManagerImpl {
return RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
}
public static boolean canServerReceive(ResourceLocation id) {
public static boolean canServerReceive(Identifier id) {
if (Minecraft.getInstance().getConnection() != null) {
return Minecraft.getInstance().getConnection().hasChannel(id);
} else {

View File

@@ -19,7 +19,7 @@
package dev.architectury.registry.client.forge;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.packs.resources.PreparableReloadListener;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
@@ -32,10 +32,10 @@ import java.util.Map;
@EventBusSubscriber(modid = "architectury", value = Dist.CLIENT)
public class ClientReloadListenerRegistryImpl {
private static Map<ResourceLocation, PreparableReloadListener> clientDataReloadListeners = new HashMap<>();
private static Map<ResourceLocation, Collection<ResourceLocation>> clientDataReloadListenerDependencies = new HashMap<>();
private static Map<Identifier, PreparableReloadListener> clientDataReloadListeners = new HashMap<>();
private static Map<Identifier, Collection<Identifier>> clientDataReloadListenerDependencies = new HashMap<>();
public static void register(PreparableReloadListener listener, ResourceLocation listenerId, Collection<ResourceLocation> dependencies) {
public static void register(PreparableReloadListener listener, Identifier listenerId, Collection<Identifier> dependencies) {
clientDataReloadListeners.put(listenerId, listener);
clientDataReloadListenerDependencies.put(listenerId, dependencies);
}

View File

@@ -20,7 +20,6 @@
package dev.architectury.registry.client.rendering.forge;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
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;

View File

@@ -29,11 +29,10 @@ import dev.architectury.registry.registries.DeferredSupplier;
import dev.architectury.utils.ArchitecturyConstants;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.common.CreativeModeTabRegistry;
import net.neoforged.neoforge.common.util.MutableHashedLinkedMap;
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -92,18 +91,18 @@ public class CreativeTabRegistryImpl {
@ApiStatus.Experimental
public static DeferredSupplier<CreativeModeTab> ofBuiltin(CreativeModeTab tab) {
ResourceLocation key = BuiltInRegistries.CREATIVE_MODE_TAB.getKey(tab);
Identifier key = BuiltInRegistries.CREATIVE_MODE_TAB.getKey(tab);
if (key == null) {
throw new IllegalArgumentException("Builtin tab %s is not registered!".formatted(tab));
}
return new DeferredSupplier<>() {
@Override
public ResourceLocation getRegistryId() {
return Registries.CREATIVE_MODE_TAB.location();
public Identifier getRegistryId() {
return Registries.CREATIVE_MODE_TAB.identifier();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return BuiltInRegistries.CREATIVE_MODE_TAB.getKey(tab);
}
@@ -120,18 +119,18 @@ public class CreativeTabRegistryImpl {
}
@ApiStatus.Experimental
public static DeferredSupplier<CreativeModeTab> defer(ResourceLocation name) {
public static DeferredSupplier<CreativeModeTab> defer(Identifier name) {
return new DeferredSupplier<>() {
@Nullable
private CreativeModeTab tab;
@Override
public ResourceLocation getRegistryId() {
return Registries.CREATIVE_MODE_TAB.location();
public Identifier getRegistryId() {
return Registries.CREATIVE_MODE_TAB.identifier();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return name;
}

View File

@@ -20,7 +20,7 @@
package dev.architectury.registry.forge;
import dev.architectury.registry.client.forge.ClientReloadListenerRegistryImpl;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.resources.PreparableReloadListener;
import net.neoforged.neoforge.common.NeoForge;
@@ -31,14 +31,14 @@ import java.util.HashMap;
import java.util.Map;
public class ReloadListenerRegistryImpl {
private static Map<ResourceLocation, PreparableReloadListener> serverDataReloadListeners = new HashMap<>();
private static Map<ResourceLocation, Collection<ResourceLocation>> serverDataReloadListenerDependencies = new HashMap<>();
private static Map<Identifier, PreparableReloadListener> serverDataReloadListeners = new HashMap<>();
private static Map<Identifier, Collection<Identifier>> serverDataReloadListenerDependencies = new HashMap<>();
static {
NeoForge.EVENT_BUS.addListener(ReloadListenerRegistryImpl::addServerReloadListeners);
}
public static void register(PackType type, PreparableReloadListener listener, ResourceLocation listenerId, Collection<ResourceLocation> dependencies) {
public static void register(PackType type, PreparableReloadListener listener, Identifier listenerId, Collection<Identifier> dependencies) {
if (type == PackType.SERVER_DATA) {
serverDataReloadListeners.put(listenerId, listener);
serverDataReloadListenerDependencies.put(listenerId, dependencies);

View File

@@ -29,16 +29,16 @@ import dev.architectury.utils.GameInstance;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.sounds.Music;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.tags.TagKey;
import net.minecraft.util.random.WeightedList;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.biome.*;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeSpecialEffects;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
@@ -68,7 +68,7 @@ public class BiomeModificationsImpl {
EventBusesHooks.whenAvailable(ArchitecturyConstants.MOD_ID, bus -> {
bus.<RegisterEvent>addListener(event -> {
event.register(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, registry -> {
registry.register(ResourceLocation.fromNamespaceAndPath(ArchitecturyConstants.MOD_ID, "none_biome_mod_codec"),
registry.register(Identifier.fromNamespaceAndPath(ArchitecturyConstants.MOD_ID, "none_biome_mod_codec"),
noneBiomeModCodec = MapCodec.unit(BiomeModifierImpl.INSTANCE));
});
});
@@ -130,8 +130,8 @@ public class BiomeModificationsImpl {
BiomeProperties properties = new BiomeWrapped(event);
@Override
public Optional<ResourceLocation> getKey() {
return biomeResourceKey.map(ResourceKey::location);
public Optional<Identifier> getKey() {
return biomeResourceKey.map(ResourceKey::identifier);
}
@Override
@@ -338,35 +338,21 @@ public class BiomeModificationsImpl {
this.builder = builder;
}
@Override
public int getFogColor() {
if (builder instanceof BiomeSpecialEffectsBuilder b) return b.getFogColor();
return builder.fogColor.orElse(-1);
}
@Override
public int getWaterColor() {
if (builder instanceof BiomeSpecialEffectsBuilder b) return b.getWaterFogColor();
return builder.waterColor.orElse(-1);
}
@Override
public int getWaterFogColor() {
if (builder instanceof BiomeSpecialEffectsBuilder b) return b.getWaterFogColor();
return builder.waterFogColor.orElse(-1);
}
@Override
public int getSkyColor() {
if (builder instanceof BiomeSpecialEffectsBuilder b) return b.getSkyColor();
return builder.skyColor.orElse(-1);
}
@Override
public OptionalInt getFoliageColorOverride() {
return builder.foliageColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
}
@Override
public OptionalInt getDryFoliageColorOverride() {
return builder.dryFoliageColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
}
@Override
public OptionalInt getGrassColorOverride() {
return builder.grassColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
@@ -377,64 +363,27 @@ public class BiomeModificationsImpl {
return builder.grassColorModifier;
}
@Override
public Optional<AmbientParticleSettings> getAmbientParticle() {
return builder.ambientParticle;
}
@Override
public Optional<Holder<SoundEvent>> getAmbientLoopSound() {
return builder.ambientLoopSoundEvent;
}
@Override
public Optional<AmbientMoodSettings> getAmbientMoodSound() {
return builder.ambientMoodSettings;
}
@Override
public Optional<AmbientAdditionsSettings> getAmbientAdditionsSound() {
return builder.ambientAdditionsSettings;
}
@Override
public Optional<WeightedList<Music>> getBackgroundMusic() {
return builder.backgroundMusic;
}
@Override
public Mutable setFogColor(int color) {
builder.fogColor(color);
return this;
}
@Override
public Mutable setWaterColor(int color) {
builder.waterColor(color);
return this;
}
@Override
public Mutable setWaterFogColor(int color) {
builder.waterFogColor(color);
return this;
}
@Override
public Mutable setSkyColor(int color) {
builder.skyColor(color);
return this;
}
@Override
public Mutable setFoliageColorOverride(@Nullable Integer colorOverride) {
builder.foliageColorOverride = Optional.ofNullable(colorOverride);
return this;
}
@Override
public Mutable setDryFoliageColorOverride(@Nullable Integer colorOverride) {
builder.dryFoliageColorOverride = Optional.ofNullable(colorOverride);
return this;
}
@Override
public Mutable setGrassColorOverride(@Nullable Integer colorOverride) {
builder.foliageColorOverride = Optional.ofNullable(colorOverride);
builder.grassColorOverride = Optional.ofNullable(colorOverride);
return this;
}
@@ -443,36 +392,6 @@ public class BiomeModificationsImpl {
builder.grassColorModifier(modifier);
return this;
}
@Override
public Mutable setAmbientParticle(@Nullable AmbientParticleSettings settings) {
builder.ambientParticle = Optional.ofNullable(settings);
return this;
}
@Override
public Mutable setAmbientLoopSound(@Nullable Holder<SoundEvent> sound) {
builder.ambientLoopSoundEvent = Optional.ofNullable(sound);
return this;
}
@Override
public Mutable setAmbientMoodSound(@Nullable AmbientMoodSettings settings) {
builder.ambientMoodSettings = Optional.ofNullable(settings);
return this;
}
@Override
public Mutable setAmbientAdditionsSound(@Nullable AmbientAdditionsSettings settings) {
builder.ambientAdditionsSettings = Optional.ofNullable(settings);
return this;
}
@Override
public Mutable setBackgroundMusic(@Nullable WeightedList<Music> music) {
builder.backgroundMusic = Optional.ofNullable(music);
return this;
}
}
private static class MutableGenerationSettingsBuilderWrapped extends GenerationSettingsBuilderWrapped implements GenerationProperties.Mutable {

View File

@@ -24,8 +24,8 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minecraft.core.NonNullList;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.entity.npc.VillagerTrades;
import net.minecraft.world.entity.npc.villager.VillagerProfession;
import net.minecraft.world.entity.npc.villager.VillagerTrades;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.village.VillagerTradesEvent;
import net.neoforged.neoforge.event.village.WandererTradesEvent;

View File

@@ -36,7 +36,7 @@ import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.neoforged.bus.api.EventPriority;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.neoforge.registries.NewRegistryEvent;
@@ -57,7 +57,7 @@ public class RegistrarManagerImpl {
private static final Logger LOGGER = LogManager.getLogger(RegistrarManagerImpl.class);
private static final Multimap<RegistryEntryId<?>, Consumer<?>> LISTENERS = HashMultimap.create();
private static void listen(ResourceKey<?> resourceKey, ResourceLocation id, Consumer<?> listener) {
private static void listen(ResourceKey<?> resourceKey, Identifier id, Consumer<?> listener) {
LISTENERS.put(new RegistryEntryId<>(resourceKey, id), listener);
}
@@ -67,9 +67,9 @@ public class RegistrarManagerImpl {
public static class Data<T> {
private boolean registered = false;
private final Map<ResourceLocation, Supplier<? extends T>> objects = new LinkedHashMap<>();
private final Map<Identifier, Supplier<? extends T>> objects = new LinkedHashMap<>();
public void register(Registry<T> registry, ResourceLocation location, Mutable<T> object, Supplier<? extends T> reference) {
public void register(Registry<T> registry, Identifier location, Mutable<T> object, Supplier<? extends T> reference) {
if (!registered) {
objects.put(location, () -> {
T value = reference.get();
@@ -91,10 +91,10 @@ public class RegistrarManagerImpl {
}
}
public record RegistryEntryId<T>(ResourceKey<T> registryKey, ResourceLocation id) {
public record RegistryEntryId<T>(ResourceKey<T> registryKey, Identifier id) {
@Override
public String toString() {
return "Registry Entry [%s / %s]".formatted(registryKey.location(), id);
return "Registry Entry [%s / %s]".formatted(registryKey.identifier(), id);
}
}
@@ -114,7 +114,7 @@ public class RegistrarManagerImpl {
@Override
public <T> Registrar<T> get(ResourceKey<Registry<T>> registryKey) {
Registry<T> registry = (Registry<T>) BuiltInRegistries.REGISTRY.getValue(registryKey.location());
Registry<T> registry = (Registry<T>) BuiltInRegistries.REGISTRY.getValue(registryKey.identifier());
if (registry != null) {
return get(registry);
}
@@ -135,7 +135,7 @@ public class RegistrarManagerImpl {
}
@Override
public <T> RegistrarBuilder<T> builder(Class<T> type, ResourceLocation registryId) {
public <T> RegistrarBuilder<T> builder(Class<T> type, Identifier registryId) {
return new RegistryBuilderWrapper<>(this, new RegistryBuilder<>(ResourceKey.createRegistryKey(registryId)));
}
@@ -154,8 +154,8 @@ public class RegistrarManagerImpl {
event.register(resourceKey, registry -> {
data.registered = true;
for (Map.Entry<ResourceLocation, Supplier<? extends T>> entry : data.objects.entrySet()) {
ResourceLocation location = entry.getKey();
for (Map.Entry<Identifier, Supplier<? extends T>> entry : data.objects.entrySet()) {
Identifier location = entry.getKey();
T value = entry.getValue().get();
registry.register(location, value);
@@ -170,7 +170,7 @@ public class RegistrarManagerImpl {
Registrar<?> archRegistry = get(event.getRegistry());
for (Map.Entry<ResourceKey<Registry<?>>, Consumer<Registrar<?>>> entry : listeners.entries()) {
if (entry.getKey().location().equals(resourceKey.location())) {
if (entry.getKey().identifier().equals(resourceKey.identifier())) {
entry.getValue().accept(archRegistry);
}
}
@@ -261,20 +261,20 @@ public class RegistrarManagerImpl {
}
@Override
public RegistrySupplier<T> delegate(ResourceLocation id) {
public RegistrySupplier<T> delegate(Identifier id) {
Supplier<T> value = Suppliers.memoize(() -> get(id));
return asSupplier(id, this, () -> contains(id), value);
}
@Override
public <E extends T> RegistrySupplier<E> register(ResourceLocation id, Supplier<E> supplier) {
public <E extends T> RegistrySupplier<E> register(Identifier id, Supplier<E> supplier) {
Data<T> data = (Data<T>) registry.computeIfAbsent(key(), type -> new Data<>());
Mutable<T> object = new MutableObject<>();
data.register(delegate, id, object, supplier);
return asSupplier(id, (Registrar<E>) this, () -> object.getValue() != null, object::getValue);
}
private <E extends T> RegistrySupplier<E> asSupplier(ResourceLocation id, Registrar<E> registrar, BooleanSupplier isPresent, Supplier<T> object) {
private <E extends T> RegistrySupplier<E> asSupplier(Identifier id, Registrar<E> registrar, BooleanSupplier isPresent, Supplier<T> object) {
return new RegistrySupplierImpl<E>() {
@Nullable
Holder<E> holder = null;
@@ -302,12 +302,12 @@ public class RegistrarManagerImpl {
}
@Override
public ResourceLocation getRegistryId() {
return delegate.key().location();
public Identifier getRegistryId() {
return delegate.key().identifier();
}
@Override
public ResourceLocation getId() {
public Identifier getId() {
return id;
}
@@ -346,7 +346,7 @@ public class RegistrarManagerImpl {
@Override
@Nullable
public ResourceLocation getId(T obj) {
public Identifier getId(T obj) {
return delegate.getKey(obj);
}
@@ -362,7 +362,7 @@ public class RegistrarManagerImpl {
@Override
@Nullable
public T get(ResourceLocation id) {
public T get(Identifier id) {
return delegate.getValue(id);
}
@@ -372,7 +372,7 @@ public class RegistrarManagerImpl {
}
@Override
public boolean contains(ResourceLocation resourceLocation) {
public boolean contains(Identifier resourceLocation) {
return delegate.keySet().contains(resourceLocation);
}
@@ -382,7 +382,7 @@ public class RegistrarManagerImpl {
}
@Override
public Set<ResourceLocation> getIds() {
public Set<Identifier> getIds() {
return delegate.keySet();
}
@@ -408,7 +408,7 @@ public class RegistrarManagerImpl {
}
@Override
public void listen(ResourceLocation id, Consumer<T> callback) {
public void listen(Identifier id, Consumer<T> callback) {
if (contains(id)) {
callback.accept(get(id));
} else {

View File

@@ -48,7 +48,7 @@ public class TestMod {
public static void initialize() {
DebugEvents.initialize();
TestRegistries.initialize();
TestGameRules.init();
TestGameRules.GAME_RULE.register();
TestTags.initialize();
TestTrades.init();
TestParticles.initialize();

View File

@@ -30,14 +30,12 @@ import dev.architectury.test.registry.TestRegistries;
import dev.architectury.test.registry.client.TestKeybinds;
import dev.architectury.test.registry.objects.ItemWithTooltip;
import dev.architectury.test.registry.objects.MyClientTooltipComponent;
import net.minecraft.client.gui.components.FocusableTextWidget;
import net.minecraft.client.renderer.entity.CowRenderer;
import static dev.architectury.test.TestMod.SINK;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import static dev.architectury.test.TestMod.SINK;
public class TestModClient {
public static void initializeClient() {
ClientLifecycleEvent.CLIENT_STARTED.register((client) -> SINK.accept("Client started!"));

View File

@@ -22,12 +22,11 @@ package dev.architectury.test.debug.client;
import com.google.common.collect.Lists;
import dev.architectury.event.events.client.ClientGuiEvent;
import dev.architectury.test.debug.ConsoleMessageSink;
import net.minecraft.Util;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
import net.minecraft.util.Util;
import java.util.Collections;
import java.util.List;

View File

@@ -28,20 +28,20 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerEntity;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.animal.Cow;
import net.minecraft.world.entity.animal.cow.Cow;
import net.minecraft.world.level.Level;
import java.util.function.Supplier;
public class TestEntity extends Cow {
public static final Supplier<EntityType<TestEntity>> TYPE = Suppliers.memoize(() -> EntityType.Builder.of(TestEntity::new, MobCategory.MISC).sized(0.98F, 0.7F).clientTrackingRange(8).build(ResourceKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "test_entity"))));
public static final Supplier<EntityType<TestEntity>> TYPE_2 = Suppliers.memoize(() -> EntityType.Builder.of(TestEntity::new, MobCategory.MISC).sized(0.98F, 0.7F).clientTrackingRange(8).build(ResourceKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "test_entity_2"))));
public static final Supplier<EntityType<TestEntity>> TYPE = Suppliers.memoize(() -> EntityType.Builder.of(TestEntity::new, MobCategory.MISC).sized(0.98F, 0.7F).clientTrackingRange(8).build(ResourceKey.create(Registries.ENTITY_TYPE, Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "test_entity"))));
public static final Supplier<EntityType<TestEntity>> TYPE_2 = Suppliers.memoize(() -> EntityType.Builder.of(TestEntity::new, MobCategory.MISC).sized(0.98F, 0.7F).clientTrackingRange(8).build(ResourceKey.create(Registries.ENTITY_TYPE, Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "test_entity_2"))));
public TestEntity(EntityType<? extends Cow> entityType, Level level) {
super(entityType, level);
@@ -61,7 +61,7 @@ public class TestEntity extends Cow {
compoundTag.putString("DeathCauser", player.getStringUUID());
RegistryFriendlyByteBuf buf = new RegistryFriendlyByteBuf(Unpooled.buffer(), this.registryAccess());
buf.writeNbt(compoundTag);
NetworkManager.sendToPlayer(player, ResourceLocation.fromNamespaceAndPath("architectury_test", "sync_data"), buf);
NetworkManager.sendToPlayer(player, Identifier.fromNamespaceAndPath("architectury_test", "sync_data"), buf);
}
}
}

View File

@@ -59,7 +59,7 @@ public class ClientDebugEvents {
return CompoundEventResult.pass();
});
ClientLifecycleEvent.CLIENT_LEVEL_LOAD.register(world -> {
TestMod.SINK.accept("Client world loaded: " + world.dimension().location().toString());
TestMod.SINK.accept("Client world loaded: " + world.dimension().identifier().toString());
});
ClientPlayerEvent.CLIENT_PLAYER_JOIN.register(player -> {
TestMod.SINK.accept(player.getScoreboardName() + " joined (client)");

View File

@@ -92,7 +92,7 @@ public class DebugEvents {
});
EntityEvent.ADD.register((entity, level) -> {
if (entity instanceof Player) {
TestMod.SINK.accept(entity.getScoreboardName() + " was added to " + level.dimension().location().toString() + logSide(level));
TestMod.SINK.accept(entity.getScoreboardName() + " was added to " + level.dimension().identifier().toString() + logSide(level));
}
return EventResult.pass();
});
@@ -110,7 +110,7 @@ public class DebugEvents {
sb.append(toShortString(new Vec3(x, y, z)));
if (level instanceof Level) {
sb.append(" in world ");
sb.append(((Level) level).dimension().location());
sb.append(((Level) level).dimension().identifier());
}
sb.append(" from cause ");
sb.append(type.name());
@@ -128,7 +128,7 @@ public class DebugEvents {
return EventResult.pass();
}));
ExplosionEvent.DETONATE.register((world, explosion, affectedEntities) -> {
TestMod.SINK.accept(world.dimension().location() + " explodes at " + toShortString(explosion.center()) + logSide(world));
TestMod.SINK.accept(world.dimension().identifier() + " explodes at " + toShortString(explosion.center()) + logSide(world));
});
InteractionEvent.LEFT_CLICK_BLOCK.register((player, hand, pos, face) -> {
TestMod.SINK.accept(player.getScoreboardName() + " left clicks " + toShortString(pos) + logSide(player.level()));
@@ -169,13 +169,13 @@ public class DebugEvents {
TestMod.SINK.accept("Server stopped");
});
LifecycleEvent.SERVER_LEVEL_LOAD.register(instance -> {
TestMod.SINK.accept("Server world loaded: " + instance.dimension().location());
TestMod.SINK.accept("Server world loaded: " + instance.dimension().identifier());
});
LifecycleEvent.SERVER_LEVEL_UNLOAD.register(instance -> {
TestMod.SINK.accept("Server world unloaded: " + instance.dimension().location());
TestMod.SINK.accept("Server world unloaded: " + instance.dimension().identifier());
});
LifecycleEvent.SERVER_LEVEL_SAVE.register(instance -> {
TestMod.SINK.accept("Server world saved: " + instance.dimension().location());
TestMod.SINK.accept("Server world saved: " + instance.dimension().identifier());
});
PlayerEvent.PLAYER_JOIN.register(player -> {
TestMod.SINK.accept(player.getScoreboardName() + " joined" + logSide(player.level()));
@@ -214,10 +214,10 @@ public class DebugEvents {
TestMod.SINK.accept(player.getScoreboardName() + " closes " + toSimpleName(menu) + logSide(player.level()));
});
PlayerEvent.CHANGE_DIMENSION.register((player, oldLevel, newLevel) -> {
TestMod.SINK.accept(player.getScoreboardName() + " switched from " + oldLevel.location() + " to " + newLevel.location() + logSide(player.level()));
TestMod.SINK.accept(player.getScoreboardName() + " switched from " + oldLevel.identifier() + " to " + newLevel.identifier() + logSide(player.level()));
});
PlayerEvent.FILL_BUCKET.register(((player, level, stack, target) -> {
TestMod.SINK.accept("%s used a bucket (%s) in %s%s while looking at %s", player.getScoreboardName(), stack, level.dimension().location(), logSide(level), target == null ? "nothing" : target.getLocation());
TestMod.SINK.accept("%s used a bucket (%s) in %s%s while looking at %s", player.getScoreboardName(), stack, level.dimension().identifier(), logSide(level), target == null ? "nothing" : target.getLocation());
return InteractionResult.PASS;
}));
LightningEvent.STRIKE.register((bolt, level, pos, toStrike) -> {

View File

@@ -19,18 +19,51 @@
package dev.architectury.test.gamerule;
import net.minecraft.world.level.GameRules;
import com.mojang.brigadier.arguments.BoolArgumentType;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.serialization.Codec;
import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.DeferredSupplier;
import dev.architectury.test.TestMod;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.level.gamerules.GameRule;
import net.minecraft.world.level.gamerules.GameRuleCategory;
import net.minecraft.world.level.gamerules.GameRuleType;
import net.minecraft.world.level.gamerules.GameRuleTypeVisitor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class TestGameRules {
private static final Logger LOGGER = LogManager.getLogger();
public static final GameRules.Key<GameRules.BooleanValue> SIMPLE_BOOL = GameRules.register("simpleBool", GameRules.Category.MISC, GameRules.BooleanValue.create(true));
public static final GameRules.Key<GameRules.IntegerValue> SIMPLE_INT = GameRules.register("simpleInt", GameRules.Category.MISC, GameRules.IntegerValue.create(10));
public static final GameRules.Key<GameRules.BooleanValue> CALLBACK_BOOL = GameRules.register("callbackBool", GameRules.Category.MISC, GameRules.BooleanValue.create(true, (server, value) -> LOGGER.info("changed to {}", value.get())));
public static final GameRules.Key<GameRules.IntegerValue> CALLBACK_INT = GameRules.register("callbackInt", GameRules.Category.MISC, GameRules.IntegerValue.create(10, (server, value) -> LOGGER.info("changed to {}", value.get())));
public static final DeferredRegister<GameRule<?>> GAME_RULE = DeferredRegister.create(TestMod.MOD_ID, Registries.GAME_RULE);
public static final DeferredSupplier<GameRule<Boolean>> SIMPLE_BOOL = GAME_RULE.register("simple_bool", () -> new GameRule<>(
GameRuleCategory.MISC,
GameRuleType.BOOL,
BoolArgumentType.bool(),
GameRuleTypeVisitor::visitBoolean,
Codec.BOOL,
gameRuleValue -> gameRuleValue ? 1 : 0,
false,
FeatureFlagSet.of()
));
public static final DeferredSupplier<GameRule<Integer>> SIMPLE_INT = GAME_RULE.register(
"simple_int",
() -> new GameRule<>(
GameRuleCategory.MISC,
GameRuleType.INT,
IntegerArgumentType.integer(0, 5),
GameRuleTypeVisitor::visitInteger,
Codec.intRange(0, 5),
gameRuleValue -> gameRuleValue,
3,
FeatureFlagSet.of()
)
);
public static void init() {
}
}

View File

@@ -25,10 +25,10 @@ import net.minecraft.network.chat.Component;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
public record ButtonClickedMessage(int buttonId) implements CustomPacketPayload {
public static final Type<ButtonClickedMessage> TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath("architectury", "button_clicked"));
public static final Type<ButtonClickedMessage> TYPE = new Type<>(Identifier.fromNamespaceAndPath("architectury", "button_clicked"));
public static final StreamCodec<RegistryFriendlyByteBuf, ButtonClickedMessage> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.VAR_INT,
ButtonClickedMessage::buttonId,

View File

@@ -26,10 +26,10 @@ import net.minecraft.network.chat.Component;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
public record SyncDataMessage(CompoundTag serverData) implements CustomPacketPayload {
public static final Type<SyncDataMessage> TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath("architectury", "sync_data"));
public static final Type<SyncDataMessage> TYPE = new Type<>(Identifier.fromNamespaceAndPath("architectury", "sync_data"));
public static final StreamCodec<RegistryFriendlyByteBuf, SyncDataMessage> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.COMPOUND_TAG,
SyncDataMessage::serverData,

View File

@@ -28,17 +28,17 @@ import io.netty.buffer.Unpooled;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import org.apache.commons.lang3.StringUtils;
import java.util.Collections;
import java.util.List;
public interface TestModNet {
ResourceLocation BIG_DATA = ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "big_data");
ResourceLocation SERVER_TO_CLIENT_TEST = ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "s2c_test");
CustomPacketPayload.Type<ServerToClientTestPayload> SERVER_TO_CLIENT_TEST_PAYLOAD = new CustomPacketPayload.Type<>(ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "s2c_test_payload"));
CustomPacketPayload.Type<BigDataPayload> BIG_DATA_PAYLOAD = new CustomPacketPayload.Type<>(ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "big_data_payload"));
Identifier BIG_DATA = Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "big_data");
Identifier SERVER_TO_CLIENT_TEST = Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "s2c_test");
CustomPacketPayload.Type<ServerToClientTestPayload> SERVER_TO_CLIENT_TEST_PAYLOAD = new CustomPacketPayload.Type<>(Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "s2c_test_payload"));
CustomPacketPayload.Type<BigDataPayload> BIG_DATA_PAYLOAD = new CustomPacketPayload.Type<>(Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "big_data_payload"));
String BIG_STRING = StringUtils.repeat('a', 100000);
static void initialize() {

View File

@@ -37,8 +37,8 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.effect.MobEffectInstance;
@@ -78,7 +78,7 @@ public class TestRegistries {
}
}
public static final Registrar<TestInt> INTS = RegistrarManager.get(TestMod.MOD_ID).<TestInt>builder(ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "ints"))
public static final Registrar<TestInt> INTS = RegistrarManager.get(TestMod.MOD_ID).<TestInt>builder(Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "ints"))
.syncToClients()
.build();
public static final DeferredRegister<CreativeModeTab> TABS = DeferredRegister.create(TestMod.MOD_ID, Registries.CREATIVE_MODE_TAB);
@@ -96,14 +96,14 @@ public class TestRegistries {
public static final ArchitecturyFluidAttributes TEST_FLUID_ATTRIBUTES = SimpleArchitecturyFluidAttributes.ofSupplier(() -> TestRegistries.TEST_FLUID_FLOWING, () -> TestRegistries.TEST_FLUID)
.convertToSource(true)
.flowingTexture(ResourceLocation.withDefaultNamespace("block/water_flow"))
.sourceTexture(ResourceLocation.withDefaultNamespace("block/water_still"))
.flowingTexture(Identifier.withDefaultNamespace("block/water_flow"))
.sourceTexture(Identifier.withDefaultNamespace("block/water_still"))
.blockSupplier(() -> TestRegistries.TEST_FLUID_BLOCK)
.bucketItemSupplier(() -> TestRegistries.TEST_FLUID_BUCKET)
.color(0xFF0000);
public static final RegistrySupplier<TestInt> TEST_INT = INTS.register(ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "test_int"), () -> new TestInt(1));
public static final RegistrySupplier<TestInt> TEST_INT_2 = INTS.register(ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "test_int_2"), () -> new TestInt(2));
public static final RegistrySupplier<TestInt> TEST_INT = INTS.register(Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "test_int"), () -> new TestInt(1));
public static final RegistrySupplier<TestInt> TEST_INT_2 = INTS.register(Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "test_int_2"), () -> new TestInt(2));
public static final RegistrySupplier<MobEffect> TEST_EFFECT = MOB_EFFECTS.register("test_effect", () ->
new MobEffect(MobEffectCategory.NEUTRAL, 0x123456) {
@@ -228,6 +228,6 @@ public class TestRegistries {
}
private static <T> ResourceKey<T> id(ResourceKey<Registry<T>> key, String string) {
return ResourceKey.create(key, ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, string));
return ResourceKey.create(key, Identifier.fromNamespaceAndPath(TestMod.MOD_ID, string));
}
}

View File

@@ -25,12 +25,12 @@ import dev.architectury.registry.client.keymappings.KeyMappingRegistry;
import dev.architectury.test.TestMod;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import org.lwjgl.glfw.GLFW;
public class TestKeybinds {
public static void initialize() {
var category = KeyMapping.Category.register(ResourceLocation.fromNamespaceAndPath("architectury", "architectury-test"));
var category = KeyMapping.Category.register(Identifier.fromNamespaceAndPath("architectury", "architectury-test"));
var mapping = new KeyMapping("key.architectury-test.test", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_O, category);
KeyMappingRegistry.register(mapping);
ClientTickEvent.CLIENT_POST.register(instance -> {

View File

@@ -19,11 +19,6 @@
package dev.architectury.test.registry.objects;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;

View File

@@ -24,16 +24,16 @@ import dev.architectury.event.events.common.BlockEvent;
import dev.architectury.test.TestMod;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.TagKey;
public class TestTags {
public static void initialize() {
// This will not be present, but it should return an empty tag
var heartParticles = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "heart_particles"));
var heartParticles = TagKey.create(Registries.BLOCK, Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "heart_particles"));
// This will act like a normal tag, we have emerald block here
var heartParticles2 = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "heart_particles2"));
var heartParticles2 = TagKey.create(Registries.BLOCK, Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "heart_particles2"));
BlockEvent.BREAK.register((world, pos, state, player, xp) -> {
if (player != null && !world.isClientSide() && (state.is(heartParticles) || state.is(heartParticles2))) {

View File

@@ -22,7 +22,7 @@ package dev.architectury.test.trade;
import dev.architectury.registry.level.entity.trade.SimpleTrade;
import dev.architectury.registry.level.entity.trade.TradeRegistry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.entity.npc.VillagerTrades;
import net.minecraft.world.entity.npc.villager.VillagerTrades;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.trading.ItemCost;

View File

@@ -23,8 +23,8 @@ import dev.architectury.event.events.common.LifecycleEvent;
import dev.architectury.registry.level.biome.BiomeModifications;
import dev.architectury.test.TestMod;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BiomeTags;
import net.minecraft.world.level.levelgen.GenerationStep;
@@ -35,7 +35,7 @@ public class TestWorldGeneration {
if (ctx.hasTag(BiomeTags.IS_FOREST)) {
mutable.getGenerationProperties().addFeature(GenerationStep.Decoration.TOP_LAYER_MODIFICATION,
ResourceKey.create(Registries.PLACED_FEATURE,
ResourceLocation.fromNamespaceAndPath(TestMod.MOD_ID, "diamond_blocks")));
Identifier.fromNamespaceAndPath(TestMod.MOD_ID, "diamond_blocks")));
}
});
});