13
0
geforkt von Mirrors/Paper

SPIGOT-7060: SCULK and SCULK_VEIN BlockSpreadEvents do not reference the correct source

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2022-06-14 21:21:46 +10:00
Ursprung 8a00d6f5d1
Commit 0d983f9b9a
2 geänderte Dateien mit 17 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -7,7 +7,7 @@
- generatoraccess.setBlock(blockposition2, iblockdata, 3);
- generatoraccess.playSound((EntityHuman) null, blockposition1, iblockdata.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, 1.0F, 1.0F);
+ // CraftBukkit start - Call BlockSpreadEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, blockposition1, blockposition2, iblockdata, 3)) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, blockposition, blockposition2, iblockdata, 3)) {
+ generatoraccess.playSound((EntityHuman) null, blockposition1, iblockdata.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, 1.0F, 1.0F);
+ }
+ // CraftBukkit end

Datei anzeigen

@ -1,12 +1,26 @@
--- a/net/minecraft/world/level/block/SculkVeinBlock.java
+++ b/net/minecraft/world/level/block/SculkVeinBlock.java
@@ -121,7 +121,11 @@
@@ -103,10 +103,11 @@
@Override
public int attemptUseCharge(SculkSpreader.a sculkspreader_a, GeneratorAccess generatoraccess, BlockPosition blockposition, RandomSource randomsource, SculkSpreader sculkspreader, boolean flag) {
- return flag && this.attemptPlaceSculk(sculkspreader, generatoraccess, sculkspreader_a.getPos(), randomsource) ? sculkspreader_a.getCharge() - 1 : (randomsource.nextInt(sculkspreader.chargeDecayRate()) == 0 ? MathHelper.floor((float) sculkspreader_a.getCharge() * 0.5F) : sculkspreader_a.getCharge());
+ // CraftBukkit - add source block
+ return flag && this.attemptPlaceSculk(sculkspreader, generatoraccess, sculkspreader_a.getPos(), randomsource, blockposition) ? sculkspreader_a.getCharge() - 1 : (randomsource.nextInt(sculkspreader.chargeDecayRate()) == 0 ? MathHelper.floor((float) sculkspreader_a.getCharge() * 0.5F) : sculkspreader_a.getCharge());
}
- private boolean attemptPlaceSculk(SculkSpreader sculkspreader, GeneratorAccess generatoraccess, BlockPosition blockposition, RandomSource randomsource) {
+ private boolean attemptPlaceSculk(SculkSpreader sculkspreader, GeneratorAccess generatoraccess, BlockPosition blockposition, RandomSource randomsource, BlockPosition sourceBlock) { // CraftBukkit
IBlockData iblockdata = generatoraccess.getBlockState(blockposition);
TagKey<Block> tagkey = sculkspreader.replaceableBlocks();
Iterator iterator = EnumDirection.allShuffled(randomsource).iterator();
@@ -121,7 +122,11 @@
if (iblockdata1.is(tagkey)) {
IBlockData iblockdata2 = Blocks.SCULK.defaultBlockState();
- generatoraccess.setBlock(blockposition1, iblockdata2, 3);
+ // CraftBukkit start - Call BlockSpreadEvent
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, blockposition, blockposition1, iblockdata2, 3)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, sourceBlock, blockposition1, iblockdata2, 3)) {
+ return false;
+ }
+ // CraftBukkit end