mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
SPIGOT-2548: Don't special case spawn locations of falling blocks
By: md_5 <git@md-5.net>
This commit is contained in:
parent
4e6c8a8362
commit
0237142cbd
1 changed files with 2 additions and 13 deletions
|
@ -857,11 +857,7 @@ public class CraftWorld implements World {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
Validate.isTrue(material.isBlock(), "Material must be a block");
|
Validate.isTrue(material.isBlock(), "Material must be a block");
|
||||||
|
|
||||||
double x = location.getBlockX() + 0.5;
|
EntityFallingBlock entity = new EntityFallingBlock(world, location.getX(), location.getY(), location.getZ(), CraftMagicNumbers.getBlock(material).fromLegacyData(data));
|
||||||
double y = location.getBlockY() + 0.5;
|
|
||||||
double z = location.getBlockZ() + 0.5;
|
|
||||||
|
|
||||||
EntityFallingBlock entity = new EntityFallingBlock(world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data));
|
|
||||||
entity.ticksLived = 1;
|
entity.ticksLived = 1;
|
||||||
|
|
||||||
world.addEntity(entity, SpawnReason.CUSTOM);
|
world.addEntity(entity, SpawnReason.CUSTOM);
|
||||||
|
@ -890,14 +886,7 @@ public class CraftWorld implements World {
|
||||||
if (Boat.class.isAssignableFrom(clazz)) {
|
if (Boat.class.isAssignableFrom(clazz)) {
|
||||||
entity = new EntityBoat(world, x, y, z);
|
entity = new EntityBoat(world, x, y, z);
|
||||||
} else if (FallingBlock.class.isAssignableFrom(clazz)) {
|
} else if (FallingBlock.class.isAssignableFrom(clazz)) {
|
||||||
x = location.getBlockX();
|
entity = new EntityFallingBlock(world, x, y, z, world.getType(new BlockPosition(x, y, z)));
|
||||||
y = location.getBlockY();
|
|
||||||
z = location.getBlockZ();
|
|
||||||
IBlockData blockData = world.getType(new BlockPosition(x, y, z));
|
|
||||||
int type = CraftMagicNumbers.getId(blockData.getBlock());
|
|
||||||
int data = blockData.getBlock().toLegacyData(blockData);
|
|
||||||
|
|
||||||
entity = new EntityFallingBlock(world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data));
|
|
||||||
} else if (Projectile.class.isAssignableFrom(clazz)) {
|
} else if (Projectile.class.isAssignableFrom(clazz)) {
|
||||||
if (Snowball.class.isAssignableFrom(clazz)) {
|
if (Snowball.class.isAssignableFrom(clazz)) {
|
||||||
entity = new EntitySnowball(world, x, y, z);
|
entity = new EntitySnowball(world, x, y, z);
|
||||||
|
|
Loading…
Reference in a new issue