Remap CraftBukkit to Mojang+Yarn Mappings

By: Initial Source <noreply+automated@papermc.io>
This commit is contained in:
CraftBukkit/Spigot
2024-12-11 22:26:55 +01:00
parent a265d64138
commit 30e4583dbe
1780 changed files with 44628 additions and 41274 deletions

View File

@@ -0,0 +1,75 @@
--- a/net/minecraft/world/level/material/FlowingFluid.java
+++ b/net/minecraft/world/level/material/FlowingFluid.java
@@ -31,6 +31,14 @@
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
+// CraftBukkit start
+import org.bukkit.block.BlockFace;
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.block.BlockFromToEvent;
+import org.bukkit.event.block.FluidLevelChangeEvent;
+// CraftBukkit end
public abstract class FlowingFluid extends Fluid {
@@ -135,6 +143,15 @@
Fluid fluidtype = fluid2.getType();
if (fluid1.canBeReplacedWith(world, blockposition1, fluidtype, Direction.DOWN) && FlowingFluid.canHoldSpecificFluid(world, blockposition1, iblockdata1, fluidtype)) {
+ // CraftBukkit start
+ org.bukkit.block.Block source = CraftBlock.at(world, fluidPos);
+ BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
this.spreadTo(world, blockposition1, iblockdata1, Direction.DOWN, fluid2);
if (this.sourceNeighborCount(world, fluidPos) >= 3) {
this.spreadToSides(world, fluidPos, fluidState, blockState);
@@ -167,7 +184,16 @@
Direction enumdirection = (Direction) entry.getKey();
FluidState fluid1 = (FluidState) entry.getValue();
BlockPos blockposition1 = pos.relative(enumdirection);
+
+ // CraftBukkit start
+ org.bukkit.block.Block source = CraftBlock.at(world, pos);
+ BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection));
+ world.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ continue;
+ }
+ // CraftBukkit end
this.spreadTo(world, blockposition1, world.getBlockState(blockposition1), enumdirection, fluid1);
}
@@ -444,10 +470,24 @@
if (fluid1.isEmpty()) {
fluidState = fluid1;
blockState = Blocks.AIR.defaultBlockState();
+ // CraftBukkit start
+ FluidLevelChangeEvent event = CraftEventFactory.callFluidLevelChangeEvent(world, pos, blockState);
+ if (event.isCancelled()) {
+ return;
+ }
+ blockState = ((CraftBlockData) event.getNewData()).getState();
+ // CraftBukkit end
world.setBlock(pos, blockState, 3);
} else if (!fluid1.equals(fluidState)) {
fluidState = fluid1;
blockState = fluid1.createLegacyBlock();
+ // CraftBukkit start
+ FluidLevelChangeEvent event = CraftEventFactory.callFluidLevelChangeEvent(world, pos, blockState);
+ if (event.isCancelled()) {
+ return;
+ }
+ blockState = ((CraftBlockData) event.getNewData()).getState();
+ // CraftBukkit end
world.setBlock(pos, blockState, 3);
world.scheduleTick(pos, fluid1.getType(), i);
}

View File

@@ -1,75 +0,0 @@
--- a/net/minecraft/world/level/material/FluidTypeFlowing.java
+++ b/net/minecraft/world/level/material/FluidTypeFlowing.java
@@ -32,6 +32,15 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
+// CraftBukkit start
+import org.bukkit.block.BlockFace;
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.block.BlockFromToEvent;
+import org.bukkit.event.block.FluidLevelChangeEvent;
+// CraftBukkit end
+
public abstract class FluidTypeFlowing extends FluidType {
public static final BlockStateBoolean FALLING = BlockProperties.FALLING;
@@ -135,6 +144,15 @@
FluidType fluidtype = fluid2.getType();
if (fluid1.canBeReplacedWith(worldserver, blockposition1, fluidtype, EnumDirection.DOWN) && canHoldSpecificFluid(worldserver, blockposition1, iblockdata1, fluidtype)) {
+ // CraftBukkit start
+ org.bukkit.block.Block source = CraftBlock.at(worldserver, blockposition);
+ BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
this.spreadTo(worldserver, blockposition1, iblockdata1, EnumDirection.DOWN, fluid2);
if (this.sourceNeighborCount(worldserver, blockposition) >= 3) {
this.spreadToSides(worldserver, blockposition, fluid, iblockdata);
@@ -168,6 +186,15 @@
Fluid fluid1 = (Fluid) entry.getValue();
BlockPosition blockposition1 = blockposition.relative(enumdirection);
+ // CraftBukkit start
+ org.bukkit.block.Block source = CraftBlock.at(worldserver, blockposition);
+ BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection));
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ continue;
+ }
+ // CraftBukkit end
this.spreadTo(worldserver, blockposition1, worldserver.getBlockState(blockposition1), enumdirection, fluid1);
}
@@ -444,10 +471,24 @@
if (fluid1.isEmpty()) {
fluid = fluid1;
iblockdata = Blocks.AIR.defaultBlockState();
+ // CraftBukkit start
+ FluidLevelChangeEvent event = CraftEventFactory.callFluidLevelChangeEvent(worldserver, blockposition, iblockdata);
+ if (event.isCancelled()) {
+ return;
+ }
+ iblockdata = ((CraftBlockData) event.getNewData()).getState();
+ // CraftBukkit end
worldserver.setBlock(blockposition, iblockdata, 3);
} else if (!fluid1.equals(fluid)) {
fluid = fluid1;
iblockdata = fluid1.createLegacyBlock();
+ // CraftBukkit start
+ FluidLevelChangeEvent event = CraftEventFactory.callFluidLevelChangeEvent(worldserver, blockposition, iblockdata);
+ if (event.isCancelled()) {
+ return;
+ }
+ iblockdata = ((CraftBlockData) event.getNewData()).getState();
+ // CraftBukkit end
worldserver.setBlock(blockposition, iblockdata, 3);
worldserver.scheduleTick(blockposition, fluid1.getType(), i);
}

View File

@@ -1,44 +0,0 @@
--- a/net/minecraft/world/level/material/FluidTypeLava.java
+++ b/net/minecraft/world/level/material/FluidTypeLava.java
@@ -85,6 +85,13 @@
if (iblockdata.isAir()) {
if (this.hasFlammableNeighbours(worldserver, blockposition1)) {
+ // CraftBukkit start - Prevent lava putting something on fire
+ if (worldserver.getBlockState(blockposition1).getBlock() != Blocks.FIRE) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(worldserver, blockposition1, blockposition).isCancelled()) {
+ continue;
+ }
+ }
+ // CraftBukkit end
worldserver.setBlockAndUpdate(blockposition1, BlockFireAbstract.getState(worldserver, blockposition1));
return;
}
@@ -101,6 +108,14 @@
}
if (worldserver.isEmptyBlock(blockposition2.above()) && this.isFlammable(worldserver, blockposition2)) {
+ // CraftBukkit start - Prevent lava putting something on fire
+ BlockPosition up = blockposition2.above();
+ if (worldserver.getBlockState(up).getBlock() != Blocks.FIRE) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(worldserver, up, blockposition).isCancelled()) {
+ continue;
+ }
+ }
+ // CraftBukkit end
worldserver.setBlockAndUpdate(blockposition2.above(), BlockFireAbstract.getState(worldserver, blockposition2));
}
}
@@ -196,7 +211,11 @@
if (this.is(TagsFluid.LAVA) && fluid1.is(TagsFluid.WATER)) {
if (iblockdata.getBlock() instanceof BlockFluids) {
- generatoraccess.setBlock(blockposition, Blocks.STONE.defaultBlockState(), 3);
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(generatoraccess.getMinecraftWorld(), blockposition, Blocks.STONE.defaultBlockState(), 3)) {
+ return;
+ }
+ // CraftBukkit end
}
this.fizz(generatoraccess, blockposition);

View File

@@ -0,0 +1,44 @@
--- a/net/minecraft/world/level/material/LavaFluid.java
+++ b/net/minecraft/world/level/material/LavaFluid.java
@@ -85,6 +85,13 @@
if (iblockdata.isAir()) {
if (this.hasFlammableNeighbours(world, blockposition1)) {
+ // CraftBukkit start - Prevent lava putting something on fire
+ if (world.getBlockState(blockposition1).getBlock() != Blocks.FIRE) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition1, pos).isCancelled()) {
+ continue;
+ }
+ }
+ // CraftBukkit end
world.setBlockAndUpdate(blockposition1, BaseFireBlock.getState(world, blockposition1));
return;
}
@@ -101,6 +108,14 @@
}
if (world.isEmptyBlock(blockposition2.above()) && this.isFlammable(world, blockposition2)) {
+ // CraftBukkit start - Prevent lava putting something on fire
+ BlockPos up = blockposition2.above();
+ if (world.getBlockState(up).getBlock() != Blocks.FIRE) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, up, pos).isCancelled()) {
+ continue;
+ }
+ }
+ // CraftBukkit end
world.setBlockAndUpdate(blockposition2.above(), BaseFireBlock.getState(world, blockposition2));
}
}
@@ -196,7 +211,11 @@
if (this.is(FluidTags.LAVA) && fluid1.is(FluidTags.WATER)) {
if (state.getBlock() instanceof LiquidBlock) {
- world.setBlock(pos, Blocks.STONE.defaultBlockState(), 3);
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world.getMinecraftWorld(), pos, Blocks.STONE.defaultBlockState(), 3)) {
+ return;
+ }
+ // CraftBukkit end
}
this.fizz(world, pos);