9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-19 15:09:27 +00:00
Files
SparklyPaperMC/patches/server/0023-SPARKLYPOWER-Add-custom-blocks.patch
2024-06-17 23:22:18 -03:00

100 lines
6.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrPowerGamerBR <git@mrpowergamerbr.com>
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<BlockState> 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<Material> 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 1b1d51a68c0abe7d8f0aa1172064192c71ae645e..5d694ef3ff1bc1e193ff321a09eb86a6239c4bb5 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
@@ -74,6 +74,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)
}
}