Update for NeoForge 1.21.4

This commit is contained in:
shedaniel
2024-12-04 02:24:57 +08:00
parent 431462bd7a
commit ccd67863c1
24 changed files with 38 additions and 305 deletions

View File

@@ -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

View File

@@ -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<? extends EntityType<?>> entity, Supplier<? extends Fluid> fluid, Supplier<? extends SoundEvent> sound, Properties properties) {
super(entity.get(), fluid.get(), sound.get(), properties);
}
}

View File

@@ -24,8 +24,6 @@ import dev.architectury.platform.hooks.EventBusesHooks;
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.Objects;
import java.util.function.Supplier;
public class ColorHandlerRegistryImpl {
private static final List<Pair<ItemColor, Supplier<? extends ItemLike>[]>> ITEM_COLORS = Lists.newArrayList();
private static final List<Pair<BlockColor, Supplier<? extends Block>[]>> BLOCK_COLORS = Lists.newArrayList();
static {
@@ -45,13 +42,6 @@ public class ColorHandlerRegistryImpl {
});
}
@SubscribeEvent
public static void onItemColorEvent(RegisterColorHandlersEvent.Item event) {
for (Pair<ItemColor, Supplier<? extends ItemLike>[]> pair : ITEM_COLORS) {
event.register(pair.getLeft(), unpackItems(pair.getRight()));
}
}
@SubscribeEvent
public static void onBlockColorEvent(RegisterColorHandlersEvent.Block event) {
for (Pair<BlockColor, Supplier<? extends Block>[]> pair : BLOCK_COLORS) {
@@ -59,16 +49,6 @@ public class ColorHandlerRegistryImpl {
}
}
@SafeVarargs
public static void registerItemColors(ItemColor itemColor, Supplier<? extends ItemLike>... 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<? extends Block>... blocks) {
Objects.requireNonNull(blockColor, "color is null!");
@@ -79,14 +59,6 @@ public class ColorHandlerRegistryImpl {
}
}
private static ItemLike[] unpackItems(Supplier<? extends ItemLike>[] 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<? extends Block>[] blocks) {
Block[] array = new Block[blocks.length];
for (int i = 0; i < blocks.length; i++) {

View File

@@ -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;
}
}

View File

@@ -35,6 +35,7 @@ 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.SimpleWeightedRandomList;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.biome.*;
@@ -397,7 +398,7 @@ public class BiomeModificationsImpl {
}
@Override
public Optional<Music> getBackgroundMusic() {
public Optional<SimpleWeightedRandomList<Music>> getBackgroundMusic() {
return builder.backgroundMusic;
}
@@ -468,7 +469,7 @@ public class BiomeModificationsImpl {
}
@Override
public Mutable setBackgroundMusic(@Nullable Music music) {
public Mutable setBackgroundMusic(@Nullable SimpleWeightedRandomList<Music> music) {
builder.backgroundMusic = Optional.ofNullable(music);
return this;
}

View File

@@ -17,7 +17,7 @@ license = "LGPL-3"
[[dependencies.architectury]]
modId = "minecraft"
type = "required"
versionRange = "[1.21,)"
versionRange = "[1.21.4,)"
ordering = "NONE"
side = "BOTH"