#1181: Consolidate Location conversion code

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2023-04-19 19:59:19 +10:00
parent 2ffb1d2479
commit b99d3df2d8
43 changed files with 424 additions and 316 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSapling.java
+++ b/net/minecraft/world/level/block/BlockSapling.java
@@ -15,12 +15,20 @@
@@ -15,12 +15,21 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -8,6 +8,7 @@
+import org.bukkit.Location;
+import org.bukkit.TreeType;
+import org.bukkit.block.BlockState;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.event.world.StructureGrowEvent;
+// CraftBukkit end
+
@@ -21,7 +22,7 @@
protected BlockSapling(WorldGenTreeProvider worldgentreeprovider, BlockBase.Info blockbase_info) {
super(blockbase_info);
@@ -45,7 +53,32 @@
@@ -45,7 +54,32 @@
if ((Integer) iblockdata.getValue(BlockSapling.STAGE) == 0) {
worldserver.setBlock(blockposition, (IBlockData) iblockdata.cycle(BlockSapling.STAGE), 4);
} else {
@@ -36,7 +37,7 @@
+ if (worldserver.capturedBlockStates.size() > 0) {
+ TreeType treeType = BlockSapling.treeType;
+ BlockSapling.treeType = null;
+ Location location = new Location(worldserver.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ Location location = CraftLocation.toBukkit(blockposition, worldserver.getWorld());
+ java.util.List<BlockState> blocks = new java.util.ArrayList<>(worldserver.capturedBlockStates.values());
+ worldserver.capturedBlockStates.clear();
+ StructureGrowEvent event = null;