Skip to content

Commit

Permalink
Update for NeoForge 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Dec 3, 2024
1 parent 431462b commit ccd6786
Show file tree
Hide file tree
Showing 24 changed files with 38 additions and 305 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '**.properties'
- '**/src/**'
branches:
- "1.21.2"
- "1.21.4"
types: [ opened, synchronize, reopened ]
jobs:
validate-gradle:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- '**/src/**'
- '.github/**'
branches:
- "1.21.2"
- "1.21.4"
workflow_dispatch:
inputs:
norelease:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -63,13 +64,13 @@ public ItemStack execute(BlockSource source, ItemStack stack) {
};
}

public ArchitecturySpawnEggItem(RegistrySupplier<? extends EntityType<? extends Mob>> entityType, int backgroundColor, int highlightColor, Properties properties) {
this(entityType, backgroundColor, highlightColor, properties, createDispenseItemBehavior());
public ArchitecturySpawnEggItem(RegistrySupplier<? extends EntityType<? extends Mob>> entityType, Properties properties) {
this(entityType, properties, createDispenseItemBehavior());
}

public ArchitecturySpawnEggItem(RegistrySupplier<? extends EntityType<? extends Mob>> entityType, int backgroundColor, int highlightColor, Properties properties,
public ArchitecturySpawnEggItem(RegistrySupplier<? extends EntityType<? extends Mob>> 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 -> {
Expand All @@ -85,8 +86,8 @@ public ArchitecturySpawnEggItem(RegistrySupplier<? extends EntityType<? extends
}

@Override
public EntityType<?> 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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> music) {
effects.backgroundMusic = Optional.ofNullable(music);
return this;
}
Expand Down Expand Up @@ -332,7 +333,7 @@ public Optional<AmbientAdditionsSettings> getAmbientAdditionsSound() {
}

@Override
public Optional<Music> getBackgroundMusic() {
public Optional<SimpleWeightedRandomList<Music>> getBackgroundMusic() {
return effects.backgroundMusic;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -54,7 +55,7 @@ public interface EffectsProperties {

Optional<AmbientAdditionsSettings> getAmbientAdditionsSound();

Optional<Music> getBackgroundMusic();
Optional<SimpleWeightedRandomList<Music>> getBackgroundMusic();

interface Mutable extends EffectsProperties {
EffectsProperties.Mutable setFogColor(int color);
Expand All @@ -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> music);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -35,15 +33,6 @@ public final class ColorHandlerRegistry {
private ColorHandlerRegistry() {
}

public static void registerItemColors(ItemColor color, ItemLike... items) {
Supplier<ItemLike>[] 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<Block>[] array = new Supplier[blocks.length];
for (var i = 0; i < blocks.length; i++) {
Expand All @@ -53,12 +42,6 @@ public static void registerBlockColors(BlockColor color, Block... blocks) {
registerBlockColors(color, array);
}

@SafeVarargs
@ExpectPlatform
public static void registerItemColors(ItemColor color, Supplier<? extends ItemLike>... items) {
throw new AssertionError();
}

@SafeVarargs
@ExpectPlatform
public static void registerBlockColors(BlockColor color, Supplier<? extends Block>... blocks) {
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends ItemLike>... items) {
Objects.requireNonNull(itemColor, "color is null!");
ColorProviderRegistry.ITEM.register(itemColor, unpackItems(items));
}

@SafeVarargs
public static void registerBlockColors(BlockColor blockColor, Supplier<? extends Block>... blocks) {
Objects.requireNonNull(blockColor, "color is null!");
ColorProviderRegistry.BLOCK.register(blockColor, unpackBlocks(blocks));
}

private static ItemLike[] unpackItems(Supplier<? extends ItemLike>[] 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<? extends Block>[] blocks) {
var array = new Block[blocks.length];
for (var i = 0; i < blocks.length; i++) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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> music) {
context.setMusic(Optional.ofNullable(music));
return this;
}
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
Loading

0 comments on commit ccd6786

Please sign in to comment.