diff --git a/.github/workflows/1.21.2_pr.yml b/.github/workflows/1.21.4_pr.yml similarity index 99% rename from .github/workflows/1.21.2_pr.yml rename to .github/workflows/1.21.4_pr.yml index 942996d2b..2efbdd629 100644 --- a/.github/workflows/1.21.2_pr.yml +++ b/.github/workflows/1.21.4_pr.yml @@ -7,7 +7,7 @@ on: - '**.properties' - '**/src/**' branches: - - "1.21.2" + - "1.21.4" types: [ opened, synchronize, reopened ] jobs: validate-gradle: diff --git a/.github/workflows/1.21.2_push.yml b/.github/workflows/1.21.4_push.yml similarity index 99% rename from .github/workflows/1.21.2_push.yml rename to .github/workflows/1.21.4_push.yml index a3fdb1327..347922011 100644 --- a/.github/workflows/1.21.2_push.yml +++ b/.github/workflows/1.21.4_push.yml @@ -8,7 +8,7 @@ on: - '**/src/**' - '.github/**' branches: - - "1.21.2" + - "1.21.4" workflow_dispatch: inputs: norelease: diff --git a/common/src/main/java/dev/architectury/core/item/ArchitecturyMobBucketItem.java b/common/src/main/java/dev/architectury/core/item/ArchitecturyMobBucketItem.java deleted file mode 100644 index 41eb000f2..000000000 --- a/common/src/main/java/dev/architectury/core/item/ArchitecturyMobBucketItem.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.core.item; - -import dev.architectury.platform.Platform; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.item.MobBucketItem; -import net.minecraft.world.level.material.Fluid; - -import java.util.function.Supplier; - -public class ArchitecturyMobBucketItem extends MobBucketItem { - public ArchitecturyMobBucketItem(Supplier> entity, Supplier fluid, Supplier sound, Properties properties) { - super(checkPlatform(entity).get(), fluid.get(), sound.get(), properties); - } - - private static T checkPlatform(T obj) { - if (Platform.isForgeLike()) { - throw new IllegalStateException("This class should've been replaced on Forge!"); - } - - return obj; - } -} diff --git a/common/src/main/java/dev/architectury/core/item/ArchitecturySpawnEggItem.java b/common/src/main/java/dev/architectury/core/item/ArchitecturySpawnEggItem.java index d3b137f8a..278665a12 100644 --- a/common/src/main/java/dev/architectury/core/item/ArchitecturySpawnEggItem.java +++ b/common/src/main/java/dev/architectury/core/item/ArchitecturySpawnEggItem.java @@ -21,6 +21,7 @@ import dev.architectury.registry.registries.RegistrySupplier; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.core.dispenser.BlockSource; import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; import net.minecraft.core.dispenser.DispenseItemBehavior; @@ -47,7 +48,7 @@ protected static DispenseItemBehavior createDispenseItemBehavior() { @Override public ItemStack execute(BlockSource source, ItemStack stack) { Direction direction = source.state().getValue(DispenserBlock.FACING); - EntityType entityType = ((SpawnEggItem) stack.getItem()).getType(stack); + EntityType entityType = ((SpawnEggItem) stack.getItem()).getType(source.level().registryAccess(), stack); try { entityType.spawn(source.level(), stack, null, source.pos().relative(direction), EntitySpawnReason.DISPENSER, direction != Direction.UP, false); @@ -63,13 +64,13 @@ public ItemStack execute(BlockSource source, ItemStack stack) { }; } - public ArchitecturySpawnEggItem(RegistrySupplier> entityType, int backgroundColor, int highlightColor, Properties properties) { - this(entityType, backgroundColor, highlightColor, properties, createDispenseItemBehavior()); + public ArchitecturySpawnEggItem(RegistrySupplier> entityType, Properties properties) { + this(entityType, properties, createDispenseItemBehavior()); } - public ArchitecturySpawnEggItem(RegistrySupplier> entityType, int backgroundColor, int highlightColor, Properties properties, + public ArchitecturySpawnEggItem(RegistrySupplier> entityType, Properties properties, @Nullable DispenseItemBehavior dispenseItemBehavior) { - super(null, backgroundColor, highlightColor, properties); + super(null, properties); this.entityType = Objects.requireNonNull(entityType, "entityType"); SpawnEggItem.BY_ID.remove(null); entityType.listen(type -> { @@ -85,8 +86,8 @@ public ArchitecturySpawnEggItem(RegistrySupplier getType(ItemStack itemStack) { - EntityType type = super.getType(itemStack); + public EntityType getType(HolderLookup.Provider provider, ItemStack itemStack) { + EntityType type = super.getType(provider, itemStack); return type == null ? entityType.get() : type; } } diff --git a/common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java b/common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java index 952e04572..5884ab7f6 100644 --- a/common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java +++ b/common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java @@ -23,6 +23,7 @@ import net.minecraft.core.Holder; import net.minecraft.sounds.Music; import net.minecraft.sounds.SoundEvent; +import net.minecraft.util.random.SimpleWeightedRandomList; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.level.biome.*; @@ -271,7 +272,7 @@ public EffectsProperties.Mutable setAmbientAdditionsSound(@Nullable AmbientAddit } @Override - public EffectsProperties.Mutable setBackgroundMusic(@Nullable Music music) { + public EffectsProperties.Mutable setBackgroundMusic(@Nullable SimpleWeightedRandomList music) { effects.backgroundMusic = Optional.ofNullable(music); return this; } @@ -332,7 +333,7 @@ public Optional getAmbientAdditionsSound() { } @Override - public Optional getBackgroundMusic() { + public Optional> getBackgroundMusic() { return effects.backgroundMusic; } } diff --git a/common/src/main/java/dev/architectury/hooks/level/biome/EffectsProperties.java b/common/src/main/java/dev/architectury/hooks/level/biome/EffectsProperties.java index e49a4c534..d32d125e5 100644 --- a/common/src/main/java/dev/architectury/hooks/level/biome/EffectsProperties.java +++ b/common/src/main/java/dev/architectury/hooks/level/biome/EffectsProperties.java @@ -22,6 +22,7 @@ import net.minecraft.core.Holder; import net.minecraft.sounds.Music; import net.minecraft.sounds.SoundEvent; +import net.minecraft.util.random.SimpleWeightedRandomList; import net.minecraft.world.level.biome.AmbientAdditionsSettings; import net.minecraft.world.level.biome.AmbientMoodSettings; import net.minecraft.world.level.biome.AmbientParticleSettings; @@ -54,7 +55,7 @@ public interface EffectsProperties { Optional getAmbientAdditionsSound(); - Optional getBackgroundMusic(); + Optional> getBackgroundMusic(); interface Mutable extends EffectsProperties { EffectsProperties.Mutable setFogColor(int color); @@ -79,6 +80,6 @@ interface Mutable extends EffectsProperties { EffectsProperties.Mutable setAmbientAdditionsSound(@Nullable AmbientAdditionsSettings settings); - EffectsProperties.Mutable setBackgroundMusic(@Nullable Music music); + EffectsProperties.Mutable setBackgroundMusic(@Nullable SimpleWeightedRandomList music); } } diff --git a/common/src/main/java/dev/architectury/registry/client/rendering/ColorHandlerRegistry.java b/common/src/main/java/dev/architectury/registry/client/rendering/ColorHandlerRegistry.java index 0f5719077..4704bcdc8 100644 --- a/common/src/main/java/dev/architectury/registry/client/rendering/ColorHandlerRegistry.java +++ b/common/src/main/java/dev/architectury/registry/client/rendering/ColorHandlerRegistry.java @@ -23,8 +23,6 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.color.block.BlockColor; -import net.minecraft.client.color.item.ItemColor; -import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; import java.util.Objects; @@ -35,15 +33,6 @@ public final class ColorHandlerRegistry { private ColorHandlerRegistry() { } - public static void registerItemColors(ItemColor color, ItemLike... items) { - Supplier[] array = new Supplier[items.length]; - for (var i = 0; i < items.length; i++) { - var item = Objects.requireNonNull(items[i], "items[i] is null!"); - array[i] = () -> item; - } - registerItemColors(color, array); - } - public static void registerBlockColors(BlockColor color, Block... blocks) { Supplier[] array = new Supplier[blocks.length]; for (var i = 0; i < blocks.length; i++) { @@ -53,12 +42,6 @@ public static void registerBlockColors(BlockColor color, Block... blocks) { registerBlockColors(color, array); } - @SafeVarargs - @ExpectPlatform - public static void registerItemColors(ItemColor color, Supplier... items) { - throw new AssertionError(); - } - @SafeVarargs @ExpectPlatform public static void registerBlockColors(BlockColor color, Supplier... blocks) { diff --git a/common/src/main/java/dev/architectury/registry/item/ItemPropertiesRegistry.java b/common/src/main/java/dev/architectury/registry/item/ItemPropertiesRegistry.java deleted file mode 100644 index 4c295d04d..000000000 --- a/common/src/main/java/dev/architectury/registry/item/ItemPropertiesRegistry.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.registry.item; - -import dev.architectury.injectables.annotations.ExpectPlatform; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.ItemLike; - -/** - * Registry for registering item properties used for model predicates. - * - * @see net.minecraft.client.renderer.item.ItemProperties - */ -@Environment(EnvType.CLIENT) -public final class ItemPropertiesRegistry { - private ItemPropertiesRegistry() { - } - - /** - * Registers a generic item property function for all items. - * - * @param propertyId the id of the property - * @param function the function to be registered - * @return the function registered - */ - @ExpectPlatform - public static ClampedItemPropertyFunction registerGeneric(ResourceLocation propertyId, ClampedItemPropertyFunction function) { - throw new AssertionError(); - } - - /** - * Registers a generic item property function for a specific item. - * - * @param item the item to be registered for - * @param propertyId the id of the property - * @param function the function to be registered - * @return the function registered - */ - @ExpectPlatform - public static ClampedItemPropertyFunction register(ItemLike item, ResourceLocation propertyId, ClampedItemPropertyFunction function) { - throw new AssertionError(); - } -} diff --git a/fabric/build.gradle b/fabric/build.gradle index f8e4d2b92..26d719cf1 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -128,7 +128,7 @@ unifiedPublishing { curseforge { token = CURSE_API_KEY id = rootProject.curseforge_id - gameVersions.addAll "Java 21", "1.21.2-Snapshot", project.minecraft_version + gameVersions.addAll "Java 21", "1.21.4-Snapshot", project.minecraft_version } } diff --git a/fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/ColorHandlerRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/ColorHandlerRegistryImpl.java index dcae7bb8c..998e9e67b 100644 --- a/fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/ColorHandlerRegistryImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/ColorHandlerRegistryImpl.java @@ -21,34 +21,18 @@ import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.minecraft.client.color.block.BlockColor; -import net.minecraft.client.color.item.ItemColor; -import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; import java.util.Objects; import java.util.function.Supplier; public class ColorHandlerRegistryImpl { - @SafeVarargs - public static void registerItemColors(ItemColor itemColor, Supplier... items) { - Objects.requireNonNull(itemColor, "color is null!"); - ColorProviderRegistry.ITEM.register(itemColor, unpackItems(items)); - } - @SafeVarargs public static void registerBlockColors(BlockColor blockColor, Supplier... blocks) { Objects.requireNonNull(blockColor, "color is null!"); ColorProviderRegistry.BLOCK.register(blockColor, unpackBlocks(blocks)); } - private static ItemLike[] unpackItems(Supplier[] items) { - var array = new ItemLike[items.length]; - for (var i = 0; i < items.length; i++) { - array[i] = Objects.requireNonNull(items[i].get()); - } - return array; - } - private static Block[] unpackBlocks(Supplier[] blocks) { var array = new Block[blocks.length]; for (var i = 0; i < blocks.length; i++) { diff --git a/fabric/src/main/java/dev/architectury/registry/item/fabric/ItemPropertiesRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/item/fabric/ItemPropertiesRegistryImpl.java deleted file mode 100644 index f6da4672a..000000000 --- a/fabric/src/main/java/dev/architectury/registry/item/fabric/ItemPropertiesRegistryImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.registry.item.fabric; - -import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry; -import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.ItemLike; - -public class ItemPropertiesRegistryImpl { - public static ClampedItemPropertyFunction registerGeneric(ResourceLocation propertyId, ClampedItemPropertyFunction function) { - FabricModelPredicateProviderRegistry.register(propertyId, function); - return function; - } - - public static ClampedItemPropertyFunction register(ItemLike item, ResourceLocation propertyId, ClampedItemPropertyFunction function) { - FabricModelPredicateProviderRegistry.register(item.asItem(), propertyId, function); - return function; - } -} diff --git a/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java b/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java index 57ffd0f2e..b6838dee3 100644 --- a/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java @@ -34,6 +34,7 @@ import net.minecraft.sounds.Music; import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.TagKey; +import net.minecraft.util.random.SimpleWeightedRandomList; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.level.biome.*; @@ -324,7 +325,7 @@ public EffectsProperties.Mutable setAmbientAdditionsSound(@Nullable AmbientAddit } @Override - public EffectsProperties.Mutable setBackgroundMusic(@Nullable Music music) { + public EffectsProperties.Mutable setBackgroundMusic(@Nullable SimpleWeightedRandomList music) { context.setMusic(Optional.ofNullable(music)); return this; } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index fef95b282..bab3e182f 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -34,7 +34,7 @@ }, "icon": "icon.png", "depends": { - "minecraft": "~1.21.2-", + "minecraft": "~1.21.4-", "fabricloader": ">=0.15.11", "fabric-api": ">=0.100.0" }, diff --git a/gradle.properties b/gradle.properties index 65f72a14f..b697c0937 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,23 +3,23 @@ org.gradle.daemon=false platforms=fabric,neoforge -minecraft_version=1.21.2 -supported_version=1.21.2 +minecraft_version=1.21.4 +supported_version=1.21.4 artifact_type=release archives_base_name=architectury archives_base_name_snapshot=architectury-snapshot -base_version=14.0 +base_version=15.0 maven_group=dev.architectury version_suffix= -fabric_loader_version=0.16.7 -fabric_api_version=0.106.1+1.21.2 +fabric_loader_version=0.16.9 +fabric_api_version=0.110.5+1.21.4 mod_menu_version=11.0.1 forge_version=51.0.0 -neoforge_version=21.2.0-beta +neoforge_version=21.4.0-beta # Set to empty if not snapshots neoforge_pr= diff --git a/neoforge/build.gradle b/neoforge/build.gradle index ca9eb00de..b80ca6aab 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -50,7 +50,6 @@ shadowJar { exclude 'dev/architectury/core/fluid/ArchitecturyFlowingFluid$Source.class' exclude 'dev/architectury/core/fluid/ArchitecturyFlowingFluid$Flowing.class' exclude 'dev/architectury/core/item/ArchitecturyBucketItem.class' - exclude 'dev/architectury/core/item/ArchitecturyMobBucketItem.class' relocate "dev.architectury.core.block.forge.imitator", "dev.architectury.core.block" relocate "dev.architectury.core.fluid.forge.imitator", "dev.architectury.core.fluid" relocate "dev.architectury.core.item.forge.imitator", "dev.architectury.core.item" @@ -122,7 +121,7 @@ unifiedPublishing { displayName = "[NeoForge $rootProject.supported_version] v$project.version" releaseType = "$rootProject.artifact_type" changelog = releaseChangelog() - gameVersions = ["1.21.2"] + gameVersions = ["1.21.4"] gameLoaders = ["neoforge"] mainPublication renameJarForPublication diff --git a/neoforge/src/main/java/dev/architectury/core/item/forge/imitator/ArchitecturyMobBucketItem.java b/neoforge/src/main/java/dev/architectury/core/item/forge/imitator/ArchitecturyMobBucketItem.java deleted file mode 100644 index 5afc47b36..000000000 --- a/neoforge/src/main/java/dev/architectury/core/item/forge/imitator/ArchitecturyMobBucketItem.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.core.item.forge.imitator; - -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.item.MobBucketItem; -import net.minecraft.world.level.material.Fluid; - -import java.util.function.Supplier; - -public class ArchitecturyMobBucketItem extends MobBucketItem { - public ArchitecturyMobBucketItem(Supplier> entity, Supplier fluid, Supplier sound, Properties properties) { - super(entity.get(), fluid.get(), sound.get(), properties); - } -} diff --git a/neoforge/src/main/java/dev/architectury/registry/client/rendering/forge/ColorHandlerRegistryImpl.java b/neoforge/src/main/java/dev/architectury/registry/client/rendering/forge/ColorHandlerRegistryImpl.java index 4b0f87e5e..528b6125e 100644 --- a/neoforge/src/main/java/dev/architectury/registry/client/rendering/forge/ColorHandlerRegistryImpl.java +++ b/neoforge/src/main/java/dev/architectury/registry/client/rendering/forge/ColorHandlerRegistryImpl.java @@ -24,8 +24,6 @@ import dev.architectury.utils.ArchitecturyConstants; import net.minecraft.client.Minecraft; import net.minecraft.client.color.block.BlockColor; -import net.minecraft.client.color.item.ItemColor; -import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; @@ -36,7 +34,6 @@ import java.util.function.Supplier; public class ColorHandlerRegistryImpl { - private static final List[]>> ITEM_COLORS = Lists.newArrayList(); private static final List[]>> BLOCK_COLORS = Lists.newArrayList(); static { @@ -45,13 +42,6 @@ public class ColorHandlerRegistryImpl { }); } - @SubscribeEvent - public static void onItemColorEvent(RegisterColorHandlersEvent.Item event) { - for (Pair[]> pair : ITEM_COLORS) { - event.register(pair.getLeft(), unpackItems(pair.getRight())); - } - } - @SubscribeEvent public static void onBlockColorEvent(RegisterColorHandlersEvent.Block event) { for (Pair[]> pair : BLOCK_COLORS) { @@ -59,16 +49,6 @@ public static void onBlockColorEvent(RegisterColorHandlersEvent.Block event) { } } - @SafeVarargs - public static void registerItemColors(ItemColor itemColor, Supplier... items) { - Objects.requireNonNull(itemColor, "color is null!"); - if (Minecraft.getInstance().getItemColors() == null) { - ITEM_COLORS.add(Pair.of(itemColor, items)); - } else { - Minecraft.getInstance().getItemColors().register(itemColor, unpackItems(items)); - } - } - @SafeVarargs public static void registerBlockColors(BlockColor blockColor, Supplier... blocks) { Objects.requireNonNull(blockColor, "color is null!"); @@ -79,14 +59,6 @@ public static void registerBlockColors(BlockColor blockColor, Supplier[] items) { - ItemLike[] array = new ItemLike[items.length]; - for (int i = 0; i < items.length; i++) { - array[i] = Objects.requireNonNull(items[i].get()); - } - return array; - } - private static Block[] unpackBlocks(Supplier[] blocks) { Block[] array = new Block[blocks.length]; for (int i = 0; i < blocks.length; i++) { diff --git a/neoforge/src/main/java/dev/architectury/registry/item/forge/ItemPropertiesRegistryImpl.java b/neoforge/src/main/java/dev/architectury/registry/item/forge/ItemPropertiesRegistryImpl.java deleted file mode 100644 index 1f656c486..000000000 --- a/neoforge/src/main/java/dev/architectury/registry/item/forge/ItemPropertiesRegistryImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -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.world.level.ItemLike; - -public class ItemPropertiesRegistryImpl { - public static ClampedItemPropertyFunction registerGeneric(ResourceLocation propertyId, ClampedItemPropertyFunction function) { - ItemProperties.registerGeneric(propertyId, function); - return function; - } - - public static ClampedItemPropertyFunction register(ItemLike item, ResourceLocation propertyId, ClampedItemPropertyFunction function) { - ItemProperties.register(item.asItem(), propertyId, function); - return function; - } -} diff --git a/neoforge/src/main/java/dev/architectury/registry/level/biome/forge/BiomeModificationsImpl.java b/neoforge/src/main/java/dev/architectury/registry/level/biome/forge/BiomeModificationsImpl.java index 1b2a8661f..1687169d8 100644 --- a/neoforge/src/main/java/dev/architectury/registry/level/biome/forge/BiomeModificationsImpl.java +++ b/neoforge/src/main/java/dev/architectury/registry/level/biome/forge/BiomeModificationsImpl.java @@ -35,6 +35,7 @@ import net.minecraft.sounds.Music; import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.TagKey; +import net.minecraft.util.random.SimpleWeightedRandomList; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.level.biome.*; @@ -397,7 +398,7 @@ public Optional getAmbientAdditionsSound() { } @Override - public Optional getBackgroundMusic() { + public Optional> getBackgroundMusic() { return builder.backgroundMusic; } @@ -468,7 +469,7 @@ public Mutable setAmbientAdditionsSound(@Nullable AmbientAdditionsSettings setti } @Override - public Mutable setBackgroundMusic(@Nullable Music music) { + public Mutable setBackgroundMusic(@Nullable SimpleWeightedRandomList music) { builder.backgroundMusic = Optional.ofNullable(music); return this; } diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml index 2610755a7..cbe39dba8 100644 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -17,7 +17,7 @@ license = "LGPL-3" [[dependencies.architectury]] modId = "minecraft" type = "required" -versionRange = "[1.21,)" +versionRange = "[1.21.4,)" ordering = "NONE" side = "BOTH" diff --git a/settings.gradle b/settings.gradle index 2d3f37cbf..4626627ed 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,6 @@ pluginManagement { repositories { + mavenLocal() maven { url "https://maven.fabricmc.net/" } maven { url "https://maven.architectury.dev/" } maven { url "https://files.minecraftforge.net/maven/" } diff --git a/testmod-common/src/main/java/dev/architectury/test/loot/TestLoot.java b/testmod-common/src/main/java/dev/architectury/test/loot/TestLoot.java index 0259dd72e..4b4ea2df8 100644 --- a/testmod-common/src/main/java/dev/architectury/test/loot/TestLoot.java +++ b/testmod-common/src/main/java/dev/architectury/test/loot/TestLoot.java @@ -25,11 +25,13 @@ import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.entries.LootItem; +import java.util.Optional; + public class TestLoot { public static void init() { LootEvent.MODIFY_LOOT_TABLE.register((key, context, builtin) -> { // Check that the loot table is dirt and built-in - if (builtin && Blocks.DIRT.getLootTable().equals(key)) { + if (builtin && Blocks.DIRT.getLootTable().equals(Optional.ofNullable(key))) { // Create a loot pool with a single item entry of Items.DIAMOND LootPool.Builder pool = LootPool.lootPool().add(LootItem.lootTableItem(Items.DIAMOND)); context.addPool(pool); diff --git a/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java b/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java index f4f860d28..30360b3d8 100644 --- a/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java +++ b/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java @@ -127,10 +127,10 @@ public TestInt(int value) { .setId(id(Registries.ITEM, "test_edible"))); }); public static final RegistrySupplier TEST_SPAWN_EGG = ITEMS.register("test_spawn_egg", () -> - new ArchitecturySpawnEggItem(TestRegistries.TEST_ENTITY, 0xFF000000, 0xFFFFFFFF, + new ArchitecturySpawnEggItem(TestRegistries.TEST_ENTITY, new Item.Properties().arch$tab(TestRegistries.TEST_TAB).setId(id(Registries.ITEM, "test_spawn_egg")))); public static final RegistrySupplier TEST_SPAWN_EGG_2 = ITEMS.register("test_spawn_egg_2", () -> - new ArchitecturySpawnEggItem(TestRegistries.TEST_ENTITY_2, 0xFFFFFFFF, 0xFF000000, + new ArchitecturySpawnEggItem(TestRegistries.TEST_ENTITY_2, new Item.Properties().arch$tab(TestRegistries.TEST_TAB).setId(id(Registries.ITEM, "test_spawn_egg_2")))); public static final RegistrySupplier TEST_FLUID_BUCKET = ITEMS.register("test_fluid_bucket", () -> { diff --git a/testmod-common/src/main/java/dev/architectury/test/tags/TestTags.java b/testmod-common/src/main/java/dev/architectury/test/tags/TestTags.java index 2b9144781..cf6263ef2 100644 --- a/testmod-common/src/main/java/dev/architectury/test/tags/TestTags.java +++ b/testmod-common/src/main/java/dev/architectury/test/tags/TestTags.java @@ -22,7 +22,6 @@ import dev.architectury.event.EventResult; import dev.architectury.event.events.common.BlockEvent; import dev.architectury.test.TestMod; -import net.minecraft.core.Registry; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; @@ -38,7 +37,7 @@ public static void initialize() { BlockEvent.BREAK.register((world, pos, state, player, xp) -> { if (player != null && !world.isClientSide() && (state.is(heartParticles) || state.is(heartParticles2))) { - ((ServerLevel) world).sendParticles(player, ParticleTypes.HEART, false, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 10, 0.0, 0.0, 0.0, 0.0); + ((ServerLevel) world).sendParticles(player, ParticleTypes.HEART, false, false, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 10, 0.0, 0.0, 0.0, 0.0); } return EventResult.pass();