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

@@ -25,11 +25,13 @@ import net.minecraft.world.level.block.Blocks;
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);

View File

@@ -127,10 +127,10 @@ public class TestRegistries {
.setId(id(Registries.ITEM, "test_edible")));
});
public static final RegistrySupplier<Item> 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<Item> 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<Item> TEST_FLUID_BUCKET = ITEMS.register("test_fluid_bucket", () -> {

View File

@@ -22,7 +22,6 @@ package dev.architectury.test.tags;
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 class TestTags {
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();