SPIGOT-4900: Rearchitect multiworld support for better compat with new villager AI
Dieser Commit ist enthalten in:
Ursprung
8879c31485
Commit
8ad02cd9c7
@ -11,19 +11,21 @@
|
||||
public class BlockEnderPortal extends BlockTileEntity {
|
||||
|
||||
protected static final VoxelShape a = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D);
|
||||
@@ -21,6 +26,15 @@
|
||||
@@ -21,7 +26,16 @@
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!world.isClientSide && !entity.isPassenger() && !entity.isVehicle() && entity.canPortal() && VoxelShapes.c(VoxelShapes.a(entity.getBoundingBox().d((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
||||
- entity.a(world.worldProvider.getDimensionManager() == DimensionManager.THE_END ? DimensionManager.OVERWORLD : DimensionManager.THE_END);
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (entity instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) entity).a(world.worldProvider.getDimensionManager() == DimensionManager.THE_END ? DimensionManager.OVERWORLD : DimensionManager.THE_END, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ ((EntityPlayer) entity).a(world.worldProvider.getDimensionManager().getType() == DimensionManager.THE_END ? DimensionManager.OVERWORLD : DimensionManager.THE_END, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ return;
|
||||
+ }
|
||||
+ entity.a(world.worldProvider.getDimensionManager().getType() == DimensionManager.THE_END ? DimensionManager.OVERWORLD : DimensionManager.THE_END);
|
||||
+ // CraftBukkit end
|
||||
entity.a(world.worldProvider.getDimensionManager() == DimensionManager.THE_END ? DimensionManager.OVERWORLD : DimensionManager.THE_END);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -137,16 +137,20 @@
|
||||
if (random.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) {
|
||||
int l = Math.min(j + random.nextInt(5) / 4, 15);
|
||||
|
||||
@@ -243,7 +287,7 @@
|
||||
@@ -241,9 +285,10 @@
|
||||
@Override
|
||||
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
||||
if (iblockdata1.getBlock() != iblockdata.getBlock()) {
|
||||
if (world.worldProvider.getDimensionManager() != DimensionManager.OVERWORLD && world.worldProvider.getDimensionManager() != DimensionManager.NETHER || !((BlockPortal) Blocks.NETHER_PORTAL).a((GeneratorAccess) world, blockposition)) {
|
||||
- if (world.worldProvider.getDimensionManager() != DimensionManager.OVERWORLD && world.worldProvider.getDimensionManager() != DimensionManager.NETHER || !((BlockPortal) Blocks.NETHER_PORTAL).a((GeneratorAccess) world, blockposition)) {
|
||||
+ // CraftBukkit - getType()
|
||||
+ if (world.worldProvider.getDimensionManager().getType() != DimensionManager.OVERWORLD && world.worldProvider.getDimensionManager().getType() != DimensionManager.NETHER || !((BlockPortal) Blocks.NETHER_PORTAL).a((GeneratorAccess) world, blockposition)) {
|
||||
if (!iblockdata.canPlace(world, blockposition)) {
|
||||
- world.a(blockposition, false);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
|
||||
} else {
|
||||
world.getBlockTickList().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10));
|
||||
}
|
||||
@@ -395,4 +439,12 @@
|
||||
@@ -395,4 +440,12 @@
|
||||
blockfire.a(Blocks.COMPOSTER, 5, 20);
|
||||
blockfire.a(Blocks.SWEET_BERRY_BUSH, 60, 100);
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
--- a/net/minecraft/server/CommandForceload.java
|
||||
+++ b/net/minecraft/server/CommandForceload.java
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
private static int a(CommandListenerWrapper commandlistenerwrapper, BlockPosition2D blockposition2d) throws CommandSyntaxException {
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition2d.a >> 4, blockposition2d.b >> 4);
|
||||
- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().getWorldProvider().getDimensionManager();
|
||||
+ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
|
||||
boolean flag = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager).getForceLoadedChunks().contains(chunkcoordintpair.pair());
|
||||
|
||||
if (flag) {
|
||||
@@ -59,7 +59,7 @@
|
||||
}
|
||||
|
||||
private static int a(CommandListenerWrapper commandlistenerwrapper) {
|
||||
- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().getWorldProvider().getDimensionManager();
|
||||
+ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
|
||||
LongSet longset = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager).getForceLoadedChunks();
|
||||
int i = longset.size();
|
||||
|
||||
@@ -79,11 +79,11 @@
|
||||
}
|
||||
|
||||
private static int b(CommandListenerWrapper commandlistenerwrapper) {
|
||||
- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().getWorldProvider().getDimensionManager();
|
||||
+ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
|
||||
WorldServer worldserver = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager);
|
||||
LongSet longset = worldserver.getForceLoadedChunks();
|
||||
|
||||
- longset.forEach((i) -> {
|
||||
+ longset.forEach((java.util.function.LongConsumer) (i) -> { // CraftBukkit - decompile error
|
||||
worldserver.setForceLoaded(ChunkCoordIntPair.getX(i), ChunkCoordIntPair.getZ(i), false);
|
||||
});
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.forceload.removed.all", new Object[] { dimensionmanager}), true);
|
||||
@@ -106,7 +106,7 @@
|
||||
if (i2 > 256L) {
|
||||
throw CommandForceload.a.create(256, i2);
|
||||
} else {
|
||||
- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().getWorldProvider().getDimensionManager();
|
||||
+ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
|
||||
WorldServer worldserver = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager);
|
||||
ChunkCoordIntPair chunkcoordintpair = null;
|
||||
int j2 = 0;
|
@ -1,11 +1,60 @@
|
||||
--- a/net/minecraft/server/DimensionManager.java
|
||||
+++ b/net/minecraft/server/DimensionManager.java
|
||||
@@ -54,7 +54,7 @@
|
||||
@@ -8,25 +8,29 @@
|
||||
|
||||
public class DimensionManager implements MinecraftSerializable {
|
||||
|
||||
- public static final DimensionManager OVERWORLD = a("overworld", new DimensionManager(1, "", "", WorldProviderNormal::new, true));
|
||||
- public static final DimensionManager NETHER = a("the_nether", new DimensionManager(0, "_nether", "DIM-1", WorldProviderHell::new, false));
|
||||
- public static final DimensionManager THE_END = a("the_end", new DimensionManager(2, "_end", "DIM1", WorldProviderTheEnd::new, false));
|
||||
+ // CraftBukkit start
|
||||
+ public static final DimensionManager OVERWORLD = a("overworld", new DimensionManager(1, "", "", WorldProviderNormal::new, true, null));
|
||||
+ public static final DimensionManager NETHER = a("the_nether", new DimensionManager(0, "_nether", "DIM-1", WorldProviderHell::new, false, null));
|
||||
+ public static final DimensionManager THE_END = a("the_end", new DimensionManager(2, "_end", "DIM1", WorldProviderTheEnd::new, false, null));
|
||||
+ // CraftBukkit end
|
||||
private final int d;
|
||||
private final String e;
|
||||
private final String f;
|
||||
- private final BiFunction<World, DimensionManager, ? extends WorldProvider> g;
|
||||
+ public final BiFunction<World, DimensionManager, ? extends WorldProvider> g;
|
||||
private final boolean h;
|
||||
|
||||
- private static DimensionManager a(String s, DimensionManager dimensionmanager) {
|
||||
+ public static DimensionManager a(String s, DimensionManager dimensionmanager) {
|
||||
return (DimensionManager) IRegistry.a(IRegistry.DIMENSION_TYPE, dimensionmanager.d, s, dimensionmanager);
|
||||
}
|
||||
|
||||
- public DimensionManager(int i, String s, String s1, BiFunction<World, DimensionManager, ? extends WorldProvider> bifunction, boolean flag) {
|
||||
+ // CraftBukkit - add type
|
||||
+ public DimensionManager(int i, String s, String s1, BiFunction<World, DimensionManager, ? extends WorldProvider> bifunction, boolean flag, DimensionManager type) {
|
||||
this.d = i;
|
||||
this.e = s;
|
||||
this.f = s1;
|
||||
this.g = bifunction;
|
||||
this.h = flag;
|
||||
+ this.type = type; // CraftBukkit
|
||||
}
|
||||
|
||||
public static DimensionManager a(Dynamic<?> dynamic) {
|
||||
@@ -54,7 +58,7 @@
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
- return a(this).toString();
|
||||
+ return this.e + "(" + a(this) + ")"; // CraftBukkit
|
||||
+ return this.e + "(" + a(getType()) + ")"; // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -80,4 +84,12 @@
|
||||
public <T> T a(DynamicOps<T> dynamicops) {
|
||||
return dynamicops.createString(IRegistry.DIMENSION_TYPE.getKey(this).toString());
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ private final DimensionManager type;
|
||||
+
|
||||
+ public DimensionManager getType() {
|
||||
+ return (type == null) ? this : type;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -508,9 +508,9 @@
|
||||
- this.a(this.world.worldProvider.getDimensionManager() == DimensionManager.NETHER ? DimensionManager.OVERWORLD : DimensionManager.NETHER);
|
||||
+ // CraftBukkit start
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this).a(this.world.worldProvider.getDimensionManager() == DimensionManager.NETHER ? DimensionManager.OVERWORLD : DimensionManager.NETHER, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL);
|
||||
+ ((EntityPlayer) this).a(this.world.worldProvider.getDimensionManager().getType() == DimensionManager.NETHER ? DimensionManager.OVERWORLD : DimensionManager.NETHER, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL);
|
||||
+ } else {
|
||||
+ this.a(this.world.worldProvider.getDimensionManager() == DimensionManager.NETHER ? DimensionManager.OVERWORLD : DimensionManager.NETHER);
|
||||
+ this.a(this.world.worldProvider.getDimensionManager().getType() == DimensionManager.NETHER ? DimensionManager.OVERWORLD : DimensionManager.NETHER);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world.getMethodProfiler().exit();
|
||||
|
@ -162,7 +162,7 @@
|
||||
+ this.world = world;
|
||||
+ this.setPosition(position.getX(), position.getY(), position.getZ());
|
||||
+ }
|
||||
+ this.dimension = ((WorldServer) this.world).dimension;
|
||||
+ this.dimension = ((WorldServer) this.world).getWorldProvider().getDimensionManager();
|
||||
+ this.playerInteractManager.a((WorldServer) world);
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
@ -409,13 +409,13 @@
|
||||
+ f1 = exit.getYaw();
|
||||
+ f = exit.getPitch();
|
||||
+ this.worldChangeInvuln = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
|
||||
+ dimensionmanager = worldserver1.dimension;
|
||||
+ dimensionmanager = worldserver1.getWorldProvider().getDimensionManager();
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ this.dimension = dimensionmanager;
|
||||
+
|
||||
+ this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.worldProvider.getDimensionManager(), this.world.getWorldData().getType(), this.playerInteractManager.getGameMode()));
|
||||
+ this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.worldProvider.getDimensionManager().getType(), this.world.getWorldData().getType(), this.playerInteractManager.getGameMode()));
|
||||
+ this.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(this.world.getDifficulty(), this.world.getWorldData().isDifficultyLocked()));
|
||||
+ PlayerList playerlist = this.server.getPlayerList();
|
||||
+
|
||||
@ -427,7 +427,14 @@
|
||||
this.setPositionRotation(d0, d1, d2, f1, f);
|
||||
worldserver.getMethodProfiler().exit();
|
||||
worldserver.getMethodProfiler().enter("placing");
|
||||
@@ -572,6 +814,7 @@
|
||||
@@ -566,12 +808,13 @@
|
||||
d0 = MathHelper.a(d0, d4, d6);
|
||||
d2 = MathHelper.a(d2, d5, d7);
|
||||
this.setPositionRotation(d0, d1, d2, f1, f);
|
||||
- if (dimensionmanager == DimensionManager.THE_END) {
|
||||
+ if (dimensionmanager.getType() == DimensionManager.THE_END) { // CraftBukkit - getType()
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.locY) - 1;
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
boolean flag = true;
|
||||
boolean flag1 = false;
|
||||
|
@ -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;
|
||||
|
@ -246,7 +246,7 @@
|
||||
+ this.initWorld(world, worlddata, worldsettings);
|
||||
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld()));
|
||||
+
|
||||
+ this.worldServer.put(world.dimension, world);
|
||||
+ this.worldServer.put(world.getWorldProvider().getDimensionManager(), world);
|
||||
+ this.getPlayerList().setPlayerFileData(world);
|
||||
+
|
||||
+ if (worlddata.getCustomBossEvents() != null) {
|
||||
@ -351,7 +351,7 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
- MinecraftServer.LOGGER.info("Preparing start region for dimension " + DimensionManager.a(worldserver.worldProvider.getDimensionManager()));
|
||||
+ MinecraftServer.LOGGER.info("Preparing start region for dimension '{}'/{}", worldserver.getWorldData().getName(), DimensionManager.a(worldserver.worldProvider.getDimensionManager())); // CraftBukkit
|
||||
+ MinecraftServer.LOGGER.info("Preparing start region for dimension '{}'/{}", worldserver.getWorldData().getName(), DimensionManager.a(worldserver.worldProvider.getDimensionManager().getType())); // CraftBukkit
|
||||
BlockPosition blockposition = worldserver.getSpawn();
|
||||
|
||||
worldloadlistener.a(new ChunkCoordIntPair(blockposition));
|
||||
|
@ -87,7 +87,7 @@
|
||||
|
||||
entityplayer.spawnIn(worldserver);
|
||||
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
|
||||
@@ -75,13 +114,15 @@
|
||||
@@ -75,13 +114,16 @@
|
||||
s1 = networkmanager.getSocketAddress().toString();
|
||||
}
|
||||
|
||||
@ -99,12 +99,14 @@
|
||||
this.a(entityplayer, (EntityPlayer) null, worldserver);
|
||||
PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, entityplayer);
|
||||
|
||||
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager(), this.getMaxPlayers(), worlddata.getType(), this.s, worldserver.getGameRules().getBoolean("reducedDebugInfo")));
|
||||
- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager(), this.getMaxPlayers(), worlddata.getType(), this.s, worldserver.getGameRules().getBoolean("reducedDebugInfo")));
|
||||
+ // CraftBukkit - getType()
|
||||
+ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), this.s, worldserver.getGameRules().getBoolean("reducedDebugInfo")));
|
||||
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
||||
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
|
||||
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
|
||||
@@ -100,19 +141,61 @@
|
||||
@@ -100,19 +142,61 @@
|
||||
} else {
|
||||
chatmessage = new ChatMessage("multiplayer.player.joined.renamed", new Object[] { entityplayer.getScoreboardDisplayName(), s});
|
||||
}
|
||||
@ -171,7 +173,7 @@
|
||||
this.a(entityplayer, worldserver);
|
||||
if (!this.server.getResourcePack().isEmpty()) {
|
||||
entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash());
|
||||
@@ -128,8 +211,11 @@
|
||||
@@ -128,8 +212,11 @@
|
||||
|
||||
if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) {
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
|
||||
@ -185,7 +187,7 @@
|
||||
});
|
||||
|
||||
if (entity != null) {
|
||||
@@ -165,6 +251,8 @@
|
||||
@@ -165,6 +252,8 @@
|
||||
}
|
||||
|
||||
entityplayer.syncInventory();
|
||||
@ -194,7 +196,7 @@
|
||||
}
|
||||
|
||||
public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
|
||||
@@ -197,31 +285,32 @@
|
||||
@@ -197,31 +286,32 @@
|
||||
}
|
||||
|
||||
public void setPlayerFileData(WorldServer worldserver) {
|
||||
@ -232,7 +234,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -249,14 +338,15 @@
|
||||
@@ -249,14 +339,15 @@
|
||||
}
|
||||
|
||||
protected void savePlayerFile(EntityPlayer entityplayer) {
|
||||
@ -250,7 +252,7 @@
|
||||
|
||||
if (advancementdataplayer != null) {
|
||||
advancementdataplayer.c();
|
||||
@@ -264,10 +354,21 @@
|
||||
@@ -264,10 +355,21 @@
|
||||
|
||||
}
|
||||
|
||||
@ -273,7 +275,7 @@
|
||||
this.savePlayerFile(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getRootVehicle();
|
||||
@@ -298,18 +399,66 @@
|
||||
@@ -298,18 +400,66 @@
|
||||
|
||||
if (entityplayer1 == entityplayer) {
|
||||
this.j.remove(uuid);
|
||||
@ -346,7 +348,7 @@
|
||||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile);
|
||||
|
||||
chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[] { gameprofilebanentry.getReason()});
|
||||
@@ -317,10 +466,12 @@
|
||||
@@ -317,10 +467,12 @@
|
||||
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[] { PlayerList.g.format(gameprofilebanentry.getExpires())}));
|
||||
}
|
||||
|
||||
@ -362,7 +364,7 @@
|
||||
IpBanEntry ipbanentry = this.l.get(socketaddress);
|
||||
|
||||
chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[] { ipbanentry.getReason()});
|
||||
@@ -328,13 +479,25 @@
|
||||
@@ -328,13 +480,25 @@
|
||||
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[] { PlayerList.g.format(ipbanentry.getExpires())}));
|
||||
}
|
||||
|
||||
@ -391,7 +393,7 @@
|
||||
UUID uuid = EntityHuman.a(gameprofile);
|
||||
List<EntityPlayer> list = Lists.newArrayList();
|
||||
|
||||
@@ -369,14 +532,24 @@
|
||||
@@ -369,14 +533,24 @@
|
||||
}
|
||||
|
||||
return new EntityPlayer(this.server, this.server.getWorldServer(DimensionManager.OVERWORLD), gameprofile, (PlayerInteractManager) object);
|
||||
@ -416,7 +418,7 @@
|
||||
entityplayer.dimension = dimensionmanager;
|
||||
Object object;
|
||||
|
||||
@@ -387,6 +560,11 @@
|
||||
@@ -387,6 +561,11 @@
|
||||
}
|
||||
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object);
|
||||
@ -428,7 +430,7 @@
|
||||
|
||||
entityplayer1.playerConnection = entityplayer.playerConnection;
|
||||
entityplayer1.copyFrom(entityplayer, flag);
|
||||
@@ -400,42 +578,100 @@
|
||||
@@ -400,42 +579,100 @@
|
||||
entityplayer1.addScoreboardTag(s);
|
||||
}
|
||||
|
||||
@ -497,7 +499,7 @@
|
||||
+ WorldData worlddata = worldserver.getWorldData();
|
||||
|
||||
- entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(entityplayer1.dimension, worlddata.getType(), entityplayer1.playerInteractManager.getGameMode()));
|
||||
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.worldProvider.getDimensionManager(), worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode()));
|
||||
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.worldProvider.getDimensionManager().getType(), worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode()));
|
||||
+ entityplayer1.spawnIn(worldserver);
|
||||
+ entityplayer1.dead = false;
|
||||
+ entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
|
||||
@ -547,7 +549,7 @@
|
||||
return entityplayer1;
|
||||
}
|
||||
|
||||
@@ -448,7 +684,18 @@
|
||||
@@ -448,7 +685,18 @@
|
||||
|
||||
public void tick() {
|
||||
if (++this.v > 600) {
|
||||
@ -567,7 +569,7 @@
|
||||
this.v = 0;
|
||||
}
|
||||
|
||||
@@ -461,6 +708,25 @@
|
||||
@@ -461,6 +709,25 @@
|
||||
|
||||
}
|
||||
|
||||
@ -593,7 +595,7 @@
|
||||
public void a(Packet<?> packet, DimensionManager dimensionmanager) {
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
@@ -561,6 +827,7 @@
|
||||
@@ -561,6 +828,7 @@
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
@ -601,7 +603,7 @@
|
||||
this.server.getCommandDispatcher().a(entityplayer);
|
||||
}
|
||||
|
||||
@@ -593,6 +860,12 @@
|
||||
@@ -593,6 +861,12 @@
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
|
||||
@ -614,7 +616,7 @@
|
||||
if (entityplayer != entityhuman && entityplayer.dimension == dimensionmanager) {
|
||||
double d4 = d0 - entityplayer.locX;
|
||||
double d5 = d1 - entityplayer.locY;
|
||||
@@ -632,7 +905,7 @@
|
||||
@@ -632,7 +906,7 @@
|
||||
public void reloadWhitelist() {}
|
||||
|
||||
public void a(EntityPlayer entityplayer, WorldServer worldserver) {
|
||||
@ -623,7 +625,7 @@
|
||||
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE));
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
|
||||
@@ -640,17 +913,26 @@
|
||||
@@ -640,17 +914,26 @@
|
||||
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition));
|
||||
if (worldserver.isRaining()) {
|
||||
@ -654,7 +656,7 @@
|
||||
}
|
||||
|
||||
public int getPlayerCount() {
|
||||
@@ -707,26 +989,39 @@
|
||||
@@ -707,26 +990,39 @@
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
@ -699,7 +701,7 @@
|
||||
|
||||
if (serverstatisticmanager == null) {
|
||||
File file = new File(this.server.getWorldServer(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "stats");
|
||||
@@ -741,7 +1036,7 @@
|
||||
@@ -741,7 +1037,7 @@
|
||||
}
|
||||
|
||||
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
|
||||
@ -708,7 +710,7 @@
|
||||
}
|
||||
|
||||
return serverstatisticmanager;
|
||||
@@ -749,14 +1044,14 @@
|
||||
@@ -749,14 +1045,14 @@
|
||||
|
||||
public AdvancementDataPlayer f(EntityPlayer entityplayer) {
|
||||
UUID uuid = entityplayer.getUniqueID();
|
||||
@ -725,7 +727,7 @@
|
||||
}
|
||||
|
||||
advancementdataplayer.a(entityplayer);
|
||||
@@ -792,13 +1087,20 @@
|
||||
@@ -792,13 +1088,20 @@
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
|
@ -23,7 +23,7 @@
|
||||
public abstract class World implements IIBlockAccess, GeneratorAccess, AutoCloseable {
|
||||
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -41,14 +57,87 @@
|
||||
@@ -41,7 +57,51 @@
|
||||
protected boolean tickingTileEntities;
|
||||
private final WorldBorder worldBorder;
|
||||
|
||||
@ -75,9 +75,8 @@
|
||||
+ // CraftBukkit end
|
||||
this.methodProfiler = gameprofilerfiller;
|
||||
this.worldData = worlddata;
|
||||
- this.worldProvider = dimensionmanager.getWorldProvider(this);
|
||||
+ this.worldProvider = DimensionManager.a(env.getId()).getWorldProvider(this); // CraftBukkit
|
||||
this.chunkProvider = (IChunkProvider) bifunction.apply(this, this.worldProvider);
|
||||
this.worldProvider = dimensionmanager.getWorldProvider(this);
|
||||
@@ -49,6 +109,35 @@
|
||||
this.isClientSide = flag;
|
||||
this.worldBorder = this.worldProvider.getWorldBorder();
|
||||
this.c = Thread.currentThread();
|
||||
|
@ -55,9 +55,9 @@
|
||||
+ if (world == null) {
|
||||
+ /* All Maps which do not have their valid world loaded are set to a dimension which hopefully won't be reached.
|
||||
+ This is to prevent them being corrupted with the wrong map data. */
|
||||
+ this.map = new DimensionManager(127, null, null, null, false);
|
||||
+ this.map = new DimensionManager(127, null, null, null, false, DimensionManager.OVERWORLD);
|
||||
+ } else {
|
||||
+ this.map = world.getHandle().dimension;
|
||||
+ this.map = world.getHandle().getWorldProvider().getDimensionManager();
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
@ -77,7 +77,7 @@
|
||||
+ if (this.uniqueId == null) {
|
||||
+ for (org.bukkit.World world : server.getWorlds()) {
|
||||
+ CraftWorld cWorld = (CraftWorld) world;
|
||||
+ if (cWorld.getHandle().dimension == this.map) {
|
||||
+ if (cWorld.getHandle().getWorldProvider().getDimensionManager() == this.map) {
|
||||
+ this.uniqueId = cWorld.getUID();
|
||||
+ break;
|
||||
+ }
|
||||
|
9
nms-patches/WorldProvider.patch
Normale Datei
9
nms-patches/WorldProvider.patch
Normale Datei
@ -0,0 +1,9 @@
|
||||
--- a/net/minecraft/server/WorldProvider.java
|
||||
+++ b/net/minecraft/server/WorldProvider.java
|
||||
@@ -76,5 +76,5 @@
|
||||
|
||||
public abstract boolean canRespawn();
|
||||
|
||||
- public abstract DimensionManager getDimensionManager();
|
||||
+ public DimensionManager getDimensionManager() { return this.f; } // CraftBukkit
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/WorldProviderHell.java
|
||||
+++ b/net/minecraft/server/WorldProviderHell.java
|
||||
@@ -63,12 +63,12 @@
|
||||
@@ -63,18 +63,22 @@
|
||||
return new WorldBorder() {
|
||||
@Override
|
||||
public double getCenterX() {
|
||||
@ -15,3 +15,13 @@
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
@Override
|
||||
public DimensionManager getDimensionManager() {
|
||||
return DimensionManager.NETHER;
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
17
nms-patches/WorldProviderNormal.patch
Normale Datei
17
nms-patches/WorldProviderNormal.patch
Normale Datei
@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/server/WorldProviderNormal.java
|
||||
+++ b/net/minecraft/server/WorldProviderNormal.java
|
||||
@@ -13,10 +13,14 @@
|
||||
super(world, dimensionmanager);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
@Override
|
||||
public DimensionManager getDimensionManager() {
|
||||
return DimensionManager.OVERWORLD;
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
||||
@Override
|
||||
public ChunkGenerator<? extends GeneratorSettingsDefault> getChunkGenerator() {
|
17
nms-patches/WorldProviderTheEnd.patch
Normale Datei
17
nms-patches/WorldProviderTheEnd.patch
Normale Datei
@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/server/WorldProviderTheEnd.java
|
||||
+++ b/net/minecraft/server/WorldProviderTheEnd.java
|
||||
@@ -60,10 +60,14 @@
|
||||
return this.a(new ChunkCoordIntPair(i >> 4, j >> 4), flag);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
@Override
|
||||
public DimensionManager getDimensionManager() {
|
||||
return DimensionManager.THE_END;
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
||||
@Override
|
||||
public void k() {
|
@ -22,13 +22,12 @@
|
||||
public class WorldServer extends World {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -56,12 +71,31 @@
|
||||
@@ -56,12 +71,29 @@
|
||||
@Nullable
|
||||
private final MobSpawnerTrader mobSpawnerTrader;
|
||||
|
||||
- public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener) {
|
||||
+ // CraftBukkit start
|
||||
+ public final DimensionManager dimension;
|
||||
+ private int tickPosition;
|
||||
+
|
||||
+ // Add env and gen to constructor
|
||||
@ -50,22 +49,23 @@
|
||||
- }, gameprofilerfiller, false);
|
||||
+ // CraftBukkit end
|
||||
+ }, gameprofilerfiller, false, gen, env);
|
||||
+ this.dimension = dimensionmanager;
|
||||
+ this.pvpMode = minecraftserver.getPVP();
|
||||
+ worlddata.world = this;
|
||||
+ // CraftBukkit end
|
||||
this.nextTickListBlock = new TickListServer<>(this, (block) -> {
|
||||
return block == null || block.getBlockData().isAir();
|
||||
}, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b);
|
||||
@@ -85,6 +119,7 @@
|
||||
@@ -84,7 +116,8 @@
|
||||
this.getWorldData().setGameType(minecraftserver.getGamemode());
|
||||
}
|
||||
|
||||
this.mobSpawnerTrader = this.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD ? new MobSpawnerTrader(this) : null;
|
||||
- this.mobSpawnerTrader = this.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD ? new MobSpawnerTrader(this) : null;
|
||||
+ this.mobSpawnerTrader = this.worldProvider.getDimensionManager().getType() == DimensionManager.OVERWORLD ? new MobSpawnerTrader(this) : null; // CraftBukkit - getType()
|
||||
+ this.getServer().addWorld(this.getWorld()); // CraftBukkit
|
||||
}
|
||||
|
||||
public void doTick(BooleanSupplier booleansupplier) {
|
||||
@@ -161,6 +196,7 @@
|
||||
@@ -161,6 +194,7 @@
|
||||
this.m = MathHelper.a(this.m, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@
|
||||
if (this.l != this.m) {
|
||||
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.m)), this.worldProvider.getDimensionManager());
|
||||
}
|
||||
@@ -179,13 +215,34 @@
|
||||
@@ -179,13 +213,34 @@
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.m));
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.o));
|
||||
}
|
||||
@ -109,7 +109,7 @@
|
||||
})) {
|
||||
this.D = false;
|
||||
if (this.getGameRules().getBoolean("doDaylightCycle")) {
|
||||
@@ -226,7 +283,7 @@
|
||||
@@ -226,7 +281,7 @@
|
||||
this.ae();
|
||||
this.ticking = false;
|
||||
gameprofilerfiller.exitEnter("entities");
|
||||
@ -118,7 +118,7 @@
|
||||
|
||||
if (flag3) {
|
||||
this.resetEmptyTime();
|
||||
@@ -240,6 +297,11 @@
|
||||
@@ -240,6 +295,11 @@
|
||||
|
||||
for (i = 0; i < this.globalEntityList.size(); ++i) {
|
||||
entity = (Entity) this.globalEntityList.get(i);
|
||||
@ -130,7 +130,7 @@
|
||||
this.a((entity1) -> {
|
||||
++entity1.ticksLived;
|
||||
entity1.tick();
|
||||
@@ -258,6 +320,7 @@
|
||||
@@ -258,6 +318,7 @@
|
||||
Entity entity1 = (Entity) entry.getValue();
|
||||
Entity entity2 = entity1.getVehicle();
|
||||
|
||||
@ -138,7 +138,7 @@
|
||||
if (!this.server.getSpawnAnimals() && (entity1 instanceof EntityAnimal || entity1 instanceof EntityWaterAnimal)) {
|
||||
entity1.die();
|
||||
}
|
||||
@@ -265,6 +328,7 @@
|
||||
@@ -265,6 +326,7 @@
|
||||
if (!this.server.getSpawnNPCs() && entity1 instanceof NPC) {
|
||||
entity1.die();
|
||||
}
|
||||
@ -146,7 +146,7 @@
|
||||
|
||||
if (entity2 != null) {
|
||||
if (!entity2.dead && entity2.w(entity1)) {
|
||||
@@ -325,10 +389,10 @@
|
||||
@@ -325,10 +387,10 @@
|
||||
entityhorseskeleton.r(true);
|
||||
entityhorseskeleton.setAgeRaw(0);
|
||||
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
@ -159,7 +159,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,11 +403,11 @@
|
||||
@@ -339,11 +401,11 @@
|
||||
BiomeBase biomebase = this.getBiome(blockposition);
|
||||
|
||||
if (biomebase.a((IWorldReader) this, blockposition1)) {
|
||||
@ -173,7 +173,7 @@
|
||||
}
|
||||
|
||||
if (flag && this.getBiome(blockposition1).b() == BiomeBase.Precipitation.RAIN) {
|
||||
@@ -390,7 +454,7 @@
|
||||
@@ -390,7 +452,7 @@
|
||||
protected BlockPosition a(BlockPosition blockposition) {
|
||||
BlockPosition blockposition1 = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, blockposition);
|
||||
AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockposition1, new BlockPosition(blockposition1.getX(), this.getHeight(), blockposition1.getZ()))).g(3.0D);
|
||||
@ -182,7 +182,7 @@
|
||||
return entityliving != null && entityliving.isAlive() && this.f(entityliving.getChunkCoordinates());
|
||||
});
|
||||
|
||||
@@ -419,7 +483,7 @@
|
||||
@@ -419,7 +481,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@ -191,7 +191,7 @@
|
||||
++i;
|
||||
} else if (entityplayer.isSleeping()) {
|
||||
++j;
|
||||
@@ -437,10 +501,22 @@
|
||||
@@ -437,10 +499,22 @@
|
||||
}
|
||||
|
||||
private void clearWeather() {
|
||||
@ -216,7 +216,7 @@
|
||||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -478,6 +554,7 @@
|
||||
@@ -478,6 +552,7 @@
|
||||
return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType()).toString();
|
||||
});
|
||||
entity.tick();
|
||||
@ -224,7 +224,7 @@
|
||||
this.getMethodProfiler().exit();
|
||||
}
|
||||
|
||||
@@ -563,6 +640,22 @@
|
||||
@@ -563,6 +638,22 @@
|
||||
BlockPosition blockposition = worldchunkmanager.a(0, 0, 256, list, random);
|
||||
ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
|
||||
|
||||
@ -247,7 +247,7 @@
|
||||
if (blockposition == null) {
|
||||
WorldServer.LOGGER.warn("Unable to find spawn biome");
|
||||
}
|
||||
@@ -638,6 +731,7 @@
|
||||
@@ -638,6 +729,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkProvider();
|
||||
|
||||
if (!flag1) {
|
||||
@ -255,7 +255,7 @@
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0]));
|
||||
}
|
||||
@@ -716,8 +810,16 @@
|
||||
@@ -716,8 +808,16 @@
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
Entity entity = (Entity) objectiterator.next();
|
||||
@ -273,7 +273,7 @@
|
||||
EnumCreatureType enumcreaturetype = entity.getEntityType().d();
|
||||
|
||||
if (enumcreaturetype != EnumCreatureType.MISC) {
|
||||
@@ -733,11 +835,24 @@
|
||||
@@ -733,11 +833,24 @@
|
||||
|
||||
@Override
|
||||
public boolean addEntity(Entity entity) {
|
||||
@ -300,7 +300,7 @@
|
||||
}
|
||||
|
||||
public void addEntityTeleport(Entity entity) {
|
||||
@@ -787,13 +902,18 @@
|
||||
@@ -787,13 +900,18 @@
|
||||
this.registerEntity(entityplayer);
|
||||
}
|
||||
|
||||
@ -321,7 +321,7 @@
|
||||
IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX / 16.0D), MathHelper.floor(entity.locZ / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer);
|
||||
|
||||
if (!(ichunkaccess instanceof Chunk)) {
|
||||
@@ -821,7 +941,7 @@
|
||||
@@ -821,7 +939,7 @@
|
||||
if (entity1 == null) {
|
||||
return false;
|
||||
} else {
|
||||
@ -330,7 +330,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -876,6 +996,7 @@
|
||||
@@ -876,6 +994,7 @@
|
||||
this.I.remove(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@
|
||||
}
|
||||
|
||||
private void registerEntity(Entity entity) {
|
||||
@@ -899,6 +1020,7 @@
|
||||
@@ -899,6 +1018,7 @@
|
||||
if (entity instanceof EntityInsentient) {
|
||||
this.I.add(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
@ -346,7 +346,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -929,6 +1051,18 @@
|
||||
@@ -929,6 +1049,18 @@
|
||||
}
|
||||
|
||||
public void strikeLightning(EntityLightning entitylightning) {
|
||||
@ -365,7 +365,7 @@
|
||||
this.globalEntityList.add(entitylightning);
|
||||
this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning));
|
||||
}
|
||||
@@ -937,6 +1071,12 @@
|
||||
@@ -937,6 +1069,12 @@
|
||||
public void a(int i, BlockPosition blockposition, int j) {
|
||||
Iterator iterator = this.server.getPlayerList().getPlayers().iterator();
|
||||
|
||||
@ -378,7 +378,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -945,6 +1085,12 @@
|
||||
@@ -945,6 +1083,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.locY;
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.locZ;
|
||||
|
||||
@ -391,34 +391,7 @@
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -955,12 +1101,14 @@
|
||||
|
||||
@Override
|
||||
public void a(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1) {
|
||||
- this.server.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1));
|
||||
+ // CraftBukkit - this.dimension
|
||||
+ this.server.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.dimension, new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(@Nullable EntityHuman entityhuman, Entity entity, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1) {
|
||||
- this.server.getPlayerList().sendPacketNearby(entityhuman, entity.locX, entity.locY, entity.locZ, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutEntitySound(soundeffect, soundcategory, entity, f, f1));
|
||||
+ // CraftBukkit - this.dimension
|
||||
+ this.server.getPlayerList().sendPacketNearby(entityhuman, entity.locX, entity.locY, entity.locZ, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.dimension, new PacketPlayOutEntitySound(soundeffect, soundcategory, entity, f, f1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -970,7 +1118,8 @@
|
||||
|
||||
@Override
|
||||
public void a(@Nullable EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {
|
||||
- this.server.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutWorldEvent(i, blockposition, j, false));
|
||||
+ // CraftBukkit - this.dimension
|
||||
+ this.server.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.dimension, new PacketPlayOutWorldEvent(i, blockposition, j, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1005,6 +1154,14 @@
|
||||
@@ -1005,6 +1149,14 @@
|
||||
|
||||
@Override
|
||||
public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
|
||||
@ -433,7 +406,7 @@
|
||||
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, explosion_effect);
|
||||
|
||||
if (damagesource != null) {
|
||||
@@ -1013,6 +1170,8 @@
|
||||
@@ -1013,6 +1165,8 @@
|
||||
|
||||
explosion.a();
|
||||
explosion.a(false);
|
||||
@ -442,17 +415,7 @@
|
||||
if (explosion_effect == Explosion.Effect.NONE) {
|
||||
explosion.clearBlocks();
|
||||
}
|
||||
@@ -1040,7 +1199,8 @@
|
||||
BlockActionData blockactiondata = (BlockActionData) this.J.removeFirst();
|
||||
|
||||
if (this.a(blockactiondata)) {
|
||||
- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.b(), blockactiondata.c(), blockactiondata.d()));
|
||||
+ // CraftBukkit - this.worldProvider.dimension -> this.dimension
|
||||
+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, dimension, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.b(), blockactiondata.c(), blockactiondata.d()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1083,13 +1243,20 @@
|
||||
@@ -1083,13 +1237,20 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
@ -475,7 +438,7 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1172,7 +1339,13 @@
|
||||
@@ -1172,7 +1333,13 @@
|
||||
@Override
|
||||
public WorldMap a(String s) {
|
||||
return (WorldMap) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().b(() -> {
|
||||
|
@ -897,7 +897,7 @@ public final class CraftServer implements Server {
|
||||
boolean used = false;
|
||||
do {
|
||||
for (WorldServer server : console.getWorlds()) {
|
||||
used = server.dimension.getDimensionID() == dimension;
|
||||
used = server.getWorldProvider().getDimensionManager().getDimensionID() == dimension;
|
||||
if (used) {
|
||||
dimension++;
|
||||
break;
|
||||
@ -923,7 +923,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
DimensionManager actualDimension = DimensionManager.a(creator.environment().getId());
|
||||
DimensionManager internalDimension = new DimensionManager(dimension, name, name, (w, manager) -> actualDimension.getWorldProvider(w), actualDimension.hasSkyLight());
|
||||
DimensionManager internalDimension = DimensionManager.a(name, new DimensionManager(dimension, name, name, (w, manager) -> actualDimension.g.apply(w, manager), actualDimension.hasSkyLight(), actualDimension));
|
||||
WorldServer internal = (WorldServer) new WorldServer(console, console.executorService, sdm, worlddata, internalDimension, console.getMethodProfiler(), getServer().worldLoadListenerFactory.create(11), creator.environment(), generator);
|
||||
|
||||
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
|
||||
@ -934,7 +934,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
internal.worldData.setDifficulty(EnumDifficulty.EASY);
|
||||
internal.setSpawnFlags(true, true);
|
||||
console.worldServer.put(internal.dimension, internal);
|
||||
console.worldServer.put(internal.getWorldProvider().getDimensionManager(), internal);
|
||||
|
||||
pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
|
||||
|
||||
@ -957,11 +957,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
WorldServer handle = ((CraftWorld) world).getHandle();
|
||||
|
||||
if (!(console.worldServer.containsKey(handle.dimension))) {
|
||||
if (!(console.worldServer.containsKey(handle.getWorldProvider().getDimensionManager()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handle.dimension == DimensionManager.OVERWORLD) {
|
||||
if (handle.getWorldProvider().getDimensionManager() == DimensionManager.OVERWORLD) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -986,7 +986,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));
|
||||
console.worldServer.remove(handle.dimension);
|
||||
console.worldServer.remove(handle.getWorldProvider().getDimensionManager());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -737,23 +737,6 @@ public class CraftWorld implements World {
|
||||
return environment;
|
||||
}
|
||||
|
||||
public void setEnvironment(Environment env) {
|
||||
if (environment != env) {
|
||||
environment = env;
|
||||
switch (env) {
|
||||
case NORMAL:
|
||||
world.worldProvider = new WorldProviderNormal(world, world.dimension);
|
||||
break;
|
||||
case NETHER:
|
||||
world.worldProvider = new WorldProviderHell(world, world.dimension);
|
||||
break;
|
||||
case THE_END:
|
||||
world.worldProvider = new WorldProviderTheEnd(world, world.dimension);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlockAt(Location location) {
|
||||
return getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
@ -1866,7 +1849,7 @@ public class CraftWorld implements World {
|
||||
double z = loc.getZ();
|
||||
|
||||
PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(new MinecraftKey(sound), SoundCategory.valueOf(category.name()), new Vec3D(x, y, z), volume, pitch);
|
||||
world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.dimension, packet);
|
||||
world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.getWorldProvider().getDimensionManager(), packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -465,7 +465,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
|
||||
// Let the server handle cross world teleports
|
||||
if (!location.getWorld().equals(getWorld())) {
|
||||
entity.teleportTo(((CraftWorld) location.getWorld()).getHandle().dimension, new BlockPosition(location.getX(), location.getY(), location.getZ()));
|
||||
entity.teleportTo(((CraftWorld) location.getWorld()).getHandle().getWorldProvider().getDimensionManager(), new BlockPosition(location.getX(), location.getY(), location.getZ()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -651,7 +651,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
if (fromWorld == toWorld) {
|
||||
entity.playerConnection.teleport(to);
|
||||
} else {
|
||||
server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true);
|
||||
server.getHandle().moveToWorld(entity, toWorld.getWorldProvider().getDimensionManager(), true, to, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ public class CraftEventFactory {
|
||||
WorldServer worldServer = world.getHandle();
|
||||
int spawnSize = Bukkit.getServer().getSpawnRadius();
|
||||
|
||||
if (world.getHandle().dimension != DimensionManager.OVERWORLD) return true;
|
||||
if (world.getHandle().getWorldProvider().getDimensionManager() != DimensionManager.OVERWORLD) return true;
|
||||
if (spawnSize <= 0) return true;
|
||||
if (((CraftServer) Bukkit.getServer()).getHandle().getOPs().isEmpty()) return true;
|
||||
if (player.isOp()) return true;
|
||||
|
@ -69,7 +69,7 @@ public final class CraftMapView implements MapView {
|
||||
|
||||
@Override
|
||||
public void setWorld(World world) {
|
||||
worldMap.map = ((CraftWorld) world).getHandle().dimension;
|
||||
worldMap.map = ((CraftWorld) world).getHandle().getWorldProvider().getDimensionManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren