#1181: Consolidate Location conversion code
By: Doc <nachito94@msn.com>
This commit is contained in:
@@ -97,7 +97,7 @@
|
||||
+
|
||||
+ List<org.bukkit.block.Block> blockList = new ObjectArrayList<>();
|
||||
+ for (int i1 = this.toBlow.size() - 1; i1 >= 0; i1--) {
|
||||
+ BlockPosition cpos = (BlockPosition) this.toBlow.get(i1);
|
||||
+ BlockPosition cpos = this.toBlow.get(i1);
|
||||
+ org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ());
|
||||
+ if (!bblock.getType().isAir()) {
|
||||
+ blockList.add(bblock);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
@@ -31,7 +31,7 @@
|
||||
+ // CraftBukkit start - Fire PlayerTeleportEvent
|
||||
+ if (entity1 instanceof EntityPlayer) {
|
||||
+ org.bukkit.craftbukkit.entity.CraftPlayer player = (CraftPlayer) entity1.getBukkitEntity();
|
||||
+ org.bukkit.Location location = new Location(world.getWorld(), (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D);
|
||||
+ org.bukkit.Location location = CraftLocation.toBukkit(blockposition1, world.getWorld()).add(0.5D, 0.5D, 0.5D);
|
||||
+ location.setPitch(player.getLocation().getPitch());
|
||||
+ location.setYaw(player.getLocation().getYaw());
|
||||
+
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.List;
|
||||
+import java.util.UUID;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.block.Lectern;
|
||||
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.entity.HumanEntity;
|
||||
+import org.bukkit.inventory.InventoryHolder;
|
||||
+// CraftBukkit end
|
||||
@@ -59,7 +59,7 @@
|
||||
+ @Override
|
||||
+ public Location getLocation() {
|
||||
+ if (level == null) return null;
|
||||
+ return new Location(level.getWorld(), worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
|
||||
+ return CraftLocation.toBukkit(worldPosition, level.getWorld());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.event.world.GenericGameEvent;
|
||||
+// CraftBukkit end
|
||||
@@ -20,7 +20,7 @@
|
||||
int i = gameevent.getNotificationRadius();
|
||||
BlockPosition blockposition = BlockPosition.containing(vec3d);
|
||||
+ // CraftBukkit start
|
||||
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(gameevent))), new Location(level.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
|
||||
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(gameevent))), CraftLocation.toBukkit(blockposition, level.getWorld()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
|
||||
Reference in New Issue
Block a user