From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrPowerGamerBR Date: Wed, 12 Jun 2024 11:53:09 -0300 Subject: [PATCH] SPARKLYPOWER Add custom blocks diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java index 223259e7a09ada681b6181c898f6857888594f85..ad5ad428b72f696a68a9ed1436bede7135c534e5 100644 --- a/src/main/java/net/minecraft/world/level/block/Blocks.java +++ b/src/main/java/net/minecraft/world/level/block/Blocks.java @@ -41,9 +41,9 @@ import net.minecraft.world.level.material.PushReaction; public class Blocks { private static final BlockBehaviour.StatePredicate NOT_CLOSED_SHULKER = (state, world, pos) -> !( - world.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity - ) - || shulkerBoxBlockEntity.isClosed(); + world.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity + ) + || shulkerBoxBlockEntity.isClosed(); public static final Block AIR = register("air", new AirBlock(BlockBehaviour.Properties.of().replaceable().noCollission().noLootTable().air())); public static final Block STONE = register( "stone", @@ -7623,6 +7623,48 @@ public class Blocks { .explosionResistance(1200.0F) ) ); + // SparklyPaper start - SparklyPower Survival custom blocks + // Blocks' strength should be synced with the replaced block on the client side! + public static final Block SPARKLYPOWER_RAINBOW_WOOL = register( + "sparklypower_rainbow_wool", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_RED).strength(0.5F).sound(SoundType.GRASS)) + ); + public static final Block SPARKLYPOWER_RAINBOW_CONCRETE = register( + "sparklypower_rainbow_concrete", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_RED).strength(0.5F).sound(SoundType.GRASS)) + ); + public static final Block SPARKLYPOWER_RAINBOW_TERRACOTTA = register( + "sparklypower_rainbow_terracotta", new Block(BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_RED).strength(0.5F).sound(SoundType.GRASS)) + ); + public static final Block SPARKLYPOWER_ASPHALT_SERVER = register( + "sparklypower_asphalt_server", new Block( + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) + ) + ); + public static final Block SPARKLYPOWER_ASPHALT_SERVER_SLAB = register( + "sparklypower_asphalt_server_slab", + new SlabBlock( + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) + ) + ); + public static final Block SPARKLYPOWER_ASPHALT_PLAYER = register( + "sparklypower_asphalt_player", new Block( + BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_BLACK) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() + .strength(1.5F, 6.0F) + ) + ); + public static final Block SPARKLYPOWER_ASPHALT_PLAYER_SLAB = register( + "sparklypower_asphalt_player_slab", + new SlabBlock( + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.0F, 6.0F) + ) + ); + // SparklyPaper end private static ToIntFunction litBlockEmission(int litLevel) { return state -> state.getValue(BlockStateProperties.LIT) ? litLevel : 0; diff --git a/src/test/java/org/bukkit/craftbukkit/legacy/LegacyTest.java b/src/test/java/org/bukkit/craftbukkit/legacy/LegacyTest.java index ef3c97ea99ddf20e9219999927ae80a31dffa7a5..f2f73dd240a703e19e502178f901c61de269ff1b 100644 --- a/src/test/java/org/bukkit/craftbukkit/legacy/LegacyTest.java +++ b/src/test/java/org/bukkit/craftbukkit/legacy/LegacyTest.java @@ -125,7 +125,9 @@ public class LegacyTest extends AbstractTestingBase { Material.FLOW_ARMOR_TRIM_SMITHING_TEMPLATE, Material.BOLT_ARMOR_TRIM_SMITHING_TEMPLATE, Material.FLOW_POTTERY_SHERD, Material.GUSTER_POTTERY_SHERD, Material.SCRAPE_POTTERY_SHERD, Material.BREEZE_ROD, Material.OMINOUS_TRIAL_KEY, Material.OMINOUS_BOTTLE, // 1.21 Material.MUSIC_DISC_CREATOR, Material.MUSIC_DISC_CREATOR_MUSIC_BOX, Material.MUSIC_DISC_PRECIPICE, - // + // SparklyPaper start - custom blocks + Material.SPARKLYPOWER_RAINBOW_WOOL, Material.SPARKLYPOWER_RAINBOW_CONCRETE, Material.SPARKLYPOWER_RAINBOW_TERRACOTTA, Material.SPARKLYPOWER_ASPHALT_SERVER, Material.SPARKLYPOWER_ASPHALT_SERVER_SLAB, Material.SPARKLYPOWER_ASPHALT_PLAYER, Material.SPARKLYPOWER_ASPHALT_PLAYER_SLAB, + // SparklyPaper end Material.LEGACY_AIR, Material.LEGACY_DEAD_BUSH, Material.LEGACY_BURNING_FURNACE, Material.LEGACY_WALL_SIGN, Material.LEGACY_REDSTONE_TORCH_OFF, Material.LEGACY_SKULL, Material.LEGACY_REDSTONE_COMPARATOR_ON, Material.LEGACY_WALL_BANNER, Material.LEGACY_MONSTER_EGG)); private final Set INVERSION_FAILS = new HashSet<>(Arrays.asList(Material.LEGACY_DOUBLE_STEP, Material.LEGACY_GLOWING_REDSTONE_ORE, Material.LEGACY_DIODE_BLOCK_ON, Material.LEGACY_REDSTONE_LAMP_ON, Material.LEGACY_WOOD_DOUBLE_STEP, diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java index 4e9612600822bc1b52b8528dff2783d43385ec73..315dfaf65994fd071c5434a78a8a8d91ea508cc8 100644 --- a/src/test/java/org/bukkit/support/AbstractTestingBase.java +++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java @@ -79,6 +79,6 @@ public abstract class AbstractTestingBase { } } INVALIDATED_MATERIALS = builder.build(); - assertEquals(610, INVALIDATED_MATERIALS.size(), "Expected 610 invalidated materials (got " + INVALIDATED_MATERIALS.size() + ")"); + assertEquals(617, INVALIDATED_MATERIALS.size(), "Expected 610 invalidated materials (got " + INVALIDATED_MATERIALS.size() + ")"); // SparklyPaper - custom blocks (this always needs to be the amount of non-legacy materials in the enum) } }