SPIGOT-4900: Rearchitect multiworld support for better compat with new villager AI

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-05-12 11:15:48 +10:00
parent 8b207fdf78
commit b407bebd8d
22 changed files with 208 additions and 227 deletions

View File

@@ -12,24 +12,6 @@
public class ItemWorldMap extends ItemWorldMapBase {
public ItemWorldMap(Item.Info item_info) {
@@ -15,7 +20,7 @@
public static ItemStack createFilledMapView(World world, int i, int j, byte b0, boolean flag, boolean flag1) {
ItemStack itemstack = new ItemStack(Items.FILLED_MAP);
- a(itemstack, world, i, j, b0, flag, flag1, world.worldProvider.getDimensionManager());
+ a(itemstack, world, i, j, b0, flag, flag1, ((WorldServer) world).dimension); // CraftBukkit - fixes Bukkit multiworld maps
return itemstack;
}
@@ -29,7 +34,7 @@
WorldMap worldmap = a(itemstack, world);
if (worldmap == null && !world.isClientSide) {
- worldmap = a(itemstack, world, world.getWorldData().b(), world.getWorldData().d(), 3, false, false, world.worldProvider.getDimensionManager());
+ worldmap = a(itemstack, world, world.getWorldData().b(), world.getWorldData().d(), 3, false, false, ((WorldServer) world).dimension); // CraftBukkit - fixes Bukkit multiworld maps
}
return worldmap;
@@ -38,7 +43,7 @@
public static int e(ItemStack itemstack) {
NBTTagCompound nbttagcompound = itemstack.getTag();
@@ -51,23 +33,3 @@
return worldmap;
}
@@ -56,7 +66,8 @@
}
public void a(World world, Entity entity, WorldMap worldmap) {
- if (world.worldProvider.getDimensionManager() == worldmap.map && entity instanceof EntityHuman) {
+ // CraftBukkit - world.worldProvider -> ((WorldServer) world)
+ if (((WorldServer) world).dimension == worldmap.map && entity instanceof EntityHuman) {
int i = 1 << worldmap.scale;
int j = worldmap.centerX;
int k = worldmap.centerZ;
@@ -208,7 +219,8 @@
WorldMap worldmap = getSavedMap(itemstack, world);
if (worldmap != null) {
- if (world.worldProvider.getDimensionManager() == worldmap.map) {
+ // CraftBukkit - world.worldProvider -> ((WorldServer) world)
+ if (((WorldServer) world).dimension == worldmap.map) {
int i = 1 << worldmap.scale;
int j = worldmap.centerX;
int k = worldmap.centerZ;