geforkt von Mirrors/Paper
SPIGOT-3286: Call BlockFormEvent for Concrete Powder -> Concrete
Dieser Commit ist enthalten in:
Ursprung
921ba53556
Commit
701b06494d
22
nms-patches/BlockConcretePowder.patch
Normale Datei
22
nms-patches/BlockConcretePowder.patch
Normale Datei
@ -0,0 +1,22 @@
|
||||
--- a/net/minecraft/server/BlockConcretePowder.java
|
||||
+++ b/net/minecraft/server/BlockConcretePowder.java
|
||||
@@ -11,8 +11,8 @@
|
||||
}
|
||||
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {
|
||||
- if (iblockdata1.getMaterial().isLiquid()) {
|
||||
- world.setTypeAndData(blockposition, Blocks.dR.getBlockData().set(BlockCloth.COLOR, iblockdata.get(BlockConcretePowder.a)), 3);
|
||||
+ if (iblockdata1.getMaterial().isLiquid() && world.getType(blockposition).getBlock() != Blocks.dR) { // CraftBukkit - don't double concrete
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.dR.getBlockData().set(BlockCloth.COLOR, iblockdata.get(BlockConcretePowder.a)), null); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,7 @@
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
- world.setTypeAndData(blockposition, Blocks.dR.getBlockData().set(BlockCloth.COLOR, iblockdata.get(BlockConcretePowder.a)), 3);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.dR.getBlockData().set(BlockCloth.COLOR, iblockdata.get(BlockConcretePowder.a)), null); // CraftBukkit
|
||||
}
|
||||
|
||||
return flag;
|
@ -33,7 +33,7 @@
|
||||
- world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData());
|
||||
- this.fizz(world, blockposition.down());
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition.down(), Blocks.STONE, null)) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition.down(), Blocks.STONE.getBlockData(), null)) {
|
||||
+ this.fizz(world, blockposition.down());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -7,7 +7,7 @@
|
||||
- world.setTypeUpdate(blockposition, Blocks.OBSIDIAN.getBlockData());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.OBSIDIAN, null)) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.OBSIDIAN.getBlockData(), null)) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@ -18,7 +18,7 @@
|
||||
- world.setTypeUpdate(blockposition, Blocks.COBBLESTONE.getBlockData());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.COBBLESTONE, null)) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.COBBLESTONE.getBlockData(), null)) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -16,7 +16,7 @@
|
||||
- world.setTypeUpdate(blockposition_mutableblockposition1, Blocks.FROSTED_ICE.getBlockData());
|
||||
- world.a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
|
||||
+ // CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition_mutableblockposition1, Blocks.FROSTED_ICE, entityliving)) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition_mutableblockposition1, Blocks.FROSTED_ICE.getBlockData(), entityliving)) {
|
||||
+ world.a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
|
||||
+ }
|
||||
+ // CraftBukkit End
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
if (this.world.getType(blockposition).getMaterial() == Material.AIR && this.world.getBiome(blockposition).a(blockposition) < 0.8F && Blocks.SNOW_LAYER.canPlace(this.world, blockposition)) {
|
||||
- this.world.setTypeUpdate(blockposition, Blocks.SNOW_LAYER.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.world, blockposition, Blocks.SNOW_LAYER, this); // CraftBukkit
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.world, blockposition, Blocks.SNOW_LAYER.getBlockData(), this); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,12 +284,12 @@
|
||||
|
||||
if (this.v(blockposition1)) {
|
||||
- this.setTypeUpdate(blockposition1, Blocks.ICE.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE, null); // CraftBukkit
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.getBlockData(), null); // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag && this.f(blockposition, true)) {
|
||||
- this.setTypeUpdate(blockposition, Blocks.SNOW_LAYER.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW_LAYER, null); // CraftBukkit
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW_LAYER.getBlockData(), null); // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag && this.getBiome(blockposition1).d()) {
|
||||
|
@ -1041,9 +1041,10 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
public static boolean handleBlockFormEvent(World world, BlockPosition pos, net.minecraft.server.Block block, @Nullable Entity entity) {
|
||||
public static boolean handleBlockFormEvent(World world, BlockPosition pos, IBlockData block, @Nullable Entity entity) {
|
||||
BlockState blockState = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()).getState();
|
||||
blockState.setType(CraftMagicNumbers.getMaterial(block));
|
||||
blockState.setType(CraftMagicNumbers.getMaterial(block.getBlock()));
|
||||
blockState.setRawData((byte) block.getBlock().toLegacyData(block));
|
||||
|
||||
BlockFormEvent event = (entity == null) ? new BlockFormEvent(blockState.getBlock(), blockState) : new EntityBlockFormEvent(entity.getBukkitEntity(), blockState.getBlock(), blockState);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren