mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 15:42:19 -07:00
Update to Minecraft 1.13-pre7
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/WorldServer.java
|
||||
+++ b/net/minecraft/server/WorldServer.java
|
||||
@@ -20,14 +20,26 @@
|
||||
@@ -20,6 +20,18 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -19,22 +19,13 @@
|
||||
public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
private final MinecraftServer server;
|
||||
public EntityTracker tracker;
|
||||
private final PlayerChunkMap manager;
|
||||
- private final Set<NextTickListEntry> nextTickListHash = Sets.newHashSet();
|
||||
- private final TreeSet<NextTickListEntry> nextTickList = new TreeSet();
|
||||
+ // private final Set<NextTickListEntry> nextTickListHash = Sets.newHashSet();
|
||||
+ private final HashTreeSet<NextTickListEntry> nextTickList = new HashTreeSet<NextTickListEntry>(); // CraftBukkit - HashTreeSet
|
||||
private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap();
|
||||
public boolean savingDisabled;
|
||||
@@ -38,28 +50,36 @@
|
||||
ObjectLinkedOpenHashSet<BlockActionData> d;
|
||||
private boolean Q;
|
||||
@@ -39,14 +51,22 @@
|
||||
private int V;
|
||||
private final List<NextTickListEntry> W = Lists.newArrayList();
|
||||
|
||||
- public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, WorldData worlddata, int i, MethodProfiler methodprofiler) {
|
||||
- super(idatamanager, worlddata, DimensionManager.a(i).d(), methodprofiler, false);
|
||||
- Predicate predicate = (block) -> {
|
||||
+ // CraftBukkit start
|
||||
+ public final int dimension;
|
||||
+
|
||||
@@ -45,52 +36,60 @@
|
||||
+ this.pvpMode = minecraftserver.getPVP();
|
||||
+ worlddata.world = this;
|
||||
+ // CraftBukkit end
|
||||
+ Predicate<Block> predicate = (block) -> { // CraftBukkit - decompile error
|
||||
return block == null || block.getBlockData().isAir();
|
||||
};
|
||||
RegistryBlocks registryblocks = Block.REGISTRY;
|
||||
|
||||
Block.REGISTRY.getClass();
|
||||
Function function = registryblocks::b;
|
||||
- RegistryBlocks registryblocks1 = Block.REGISTRY;
|
||||
+ RegistryBlocks<MinecraftKey, Block> registryblocks1 = Block.REGISTRY; // CraftBukkit - decompile error
|
||||
|
||||
Block.REGISTRY.getClass();
|
||||
- this.nextTickListBlock = new TickListServer(this, predicate, function, registryblocks1::get, this::b);
|
||||
- predicate = (fluidtype) -> {
|
||||
+ this.nextTickListBlock = new TickListServer<>(this, predicate, function, registryblocks1::get, this::b); // CraftBukkit - decompile error
|
||||
+ Predicate<FluidType> predicate2 = (fluidtype) -> {
|
||||
return fluidtype == null || fluidtype == FluidTypes.a;
|
||||
};
|
||||
registryblocks = FluidType.c;
|
||||
FluidType.c.getClass();
|
||||
function = registryblocks::b;
|
||||
- registryblocks1 = FluidType.c;
|
||||
+ RegistryBlocks<MinecraftKey, FluidType> registryblocks2 = FluidType.c; // CraftBukkit - decompile error
|
||||
FluidType.c.getClass();
|
||||
- this.nextTickListFluid = new TickListServer(this, predicate, function, registryblocks1::get, this::a);
|
||||
+ this.nextTickListFluid = new TickListServer<>(this, predicate2, function, registryblocks2::get, this::a); // CraftBukkit - decompile error
|
||||
this.siegeManager = new VillageSiege(this);
|
||||
this.d = new ObjectLinkedOpenHashSet();
|
||||
this.server = minecraftserver;
|
||||
this.tracker = new EntityTracker(this);
|
||||
@@ -67,7 +87,7 @@
|
||||
this.manager = new PlayerChunkMap(this);
|
||||
this.worldProvider.a((World) this);
|
||||
this.chunkProvider = this.n();
|
||||
this.chunkProvider = this.q();
|
||||
- this.portalTravelAgent = new PortalTravelAgent(this);
|
||||
+ this.portalTravelAgent = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
|
||||
this.J();
|
||||
this.K();
|
||||
this.getWorldBorder().a(minecraftserver.aE());
|
||||
@@ -65,6 +85,7 @@
|
||||
this.O();
|
||||
this.P();
|
||||
this.getWorldBorder().a(minecraftserver.aw());
|
||||
@@ -86,6 +106,7 @@
|
||||
this.villages.a((World) this);
|
||||
}
|
||||
|
||||
+ if (getServer().getScoreboardManager() == null) { // CraftBukkit
|
||||
this.scoreboard = new ScoreboardServer(this.server);
|
||||
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) this.worldMaps.get(PersistentScoreboard.class, "scoreboard");
|
||||
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) this.worldMaps.get(PersistentScoreboard::new, "scoreboard");
|
||||
|
||||
@@ -75,9 +96,24 @@
|
||||
if (persistentscoreboard == null) {
|
||||
@@ -95,6 +116,7 @@
|
||||
|
||||
persistentscoreboard.a(this.scoreboard);
|
||||
((ScoreboardServer) this.scoreboard).a((Runnable) (new RunnableSaveScoreboard(persistentscoreboard)));
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ this.scoreboard = getServer().getScoreboardManager().getMainScoreboard().getHandle();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.B = new LootTableRegistry(new File(new File(this.dataManager.getDirectory(), "data"), "loot_tables"));
|
||||
- this.C = new AdvancementDataWorld(new File(new File(this.dataManager.getDirectory(), "data"), "advancements"));
|
||||
- this.D = new CustomFunctionData(new File(new File(this.dataManager.getDirectory(), "data"), "functions"), this.server);
|
||||
+ // CraftBukkit start
|
||||
+ if (this.dimension != 0) { // SPIGOT-3899 multiple worlds of advancements not supported
|
||||
+ this.C = this.server.getAdvancementData();
|
||||
+ }
|
||||
+ if (this.C == null) {
|
||||
+ this.C = new AdvancementDataWorld(new File(new File(this.dataManager.getDirectory(), "data"), "advancements"));
|
||||
+ }
|
||||
+ if (this.D == null) {
|
||||
+ this.D = new CustomFunctionData(new File(new File(this.dataManager.getDirectory(), "data"), "functions"), this.server);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
persistentscoreboard.a((Scoreboard) this.server.getScoreboard());
|
||||
this.server.getScoreboard().a((Runnable) (new RunnableSaveScoreboard(persistentscoreboard)));
|
||||
+ } // CraftBukkit
|
||||
this.getWorldBorder().setCenter(this.worldData.B(), this.worldData.C());
|
||||
this.getWorldBorder().setDamageAmount(this.worldData.H());
|
||||
this.getWorldBorder().setDamageBuffer(this.worldData.G());
|
||||
@@ -89,9 +125,146 @@
|
||||
@@ -106,9 +128,130 @@
|
||||
this.getWorldBorder().setSize(this.worldData.D());
|
||||
}
|
||||
|
||||
@@ -126,18 +125,14 @@
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
+ } else if (type == Blocks.JUKEBOX) {
|
||||
+ if (!(result instanceof BlockJukeBox.TileEntityRecordPlayer)) {
|
||||
+ if (!(result instanceof TileEntityJukeBox)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
+ } else if (type == Blocks.NOTEBLOCK) {
|
||||
+ if (!(result instanceof TileEntityNote)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
+ } else if (type == Blocks.MOB_SPAWNER) {
|
||||
+ } else if (type == Blocks.SPAWNER) {
|
||||
+ if (!(result instanceof TileEntityMobSpawner)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
+ } else if ((type == Blocks.STANDING_SIGN) || (type == Blocks.WALL_SIGN)) {
|
||||
+ } else if ((type == Blocks.SIGN) || (type == Blocks.WALL_SIGN)) {
|
||||
+ if (!(result instanceof TileEntitySign)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
@@ -165,23 +160,19 @@
|
||||
+ if (!(result instanceof TileEntityEnderPortal)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
+ } else if (type == Blocks.SKULL) {
|
||||
+ } else if (type instanceof BlockSkullAbstract) {
|
||||
+ if (!(result instanceof TileEntitySkull)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
+ } else if (type == Blocks.DAYLIGHT_DETECTOR || type == Blocks.DAYLIGHT_DETECTOR_INVERTED) {
|
||||
+ } else if (type == Blocks.DAYLIGHT_DETECTOR) {
|
||||
+ if (!(result instanceof TileEntityLightDetector)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
+ } else if (type == Blocks.POWERED_COMPARATOR || type == Blocks.UNPOWERED_COMPARATOR) {
|
||||
+ } else if (type == Blocks.COMPARATOR) {
|
||||
+ if (!(result instanceof TileEntityComparator)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
+ } else if (type == Blocks.FLOWER_POT) {
|
||||
+ if (!(result instanceof TileEntityFlowerPot)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
+ } else if (type == Blocks.STANDING_BANNER || type == Blocks.WALL_BANNER) {
|
||||
+ }else if (type instanceof BlockBannerAbstract) {
|
||||
+ if (!(result instanceof TileEntityBanner)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
@@ -201,7 +192,7 @@
|
||||
+ if (!(result instanceof TileEntityStructure)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
+ } else if (type == Blocks.BED) {
|
||||
+ } else if (type instanceof BlockBed) {
|
||||
+ if (!(result instanceof TileEntityBed)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
@@ -212,10 +203,10 @@
|
||||
+
|
||||
+ private TileEntity fixTileEntity(BlockPosition pos, Block type, TileEntity found) {
|
||||
+ this.getServer().getLogger().log(Level.SEVERE, "Block at {0},{1},{2} is {3} but has {4}" + ". "
|
||||
+ + "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.", new Object[]{pos.getX(), pos.getY(), pos.getZ(), org.bukkit.Material.getMaterial(Block.getId(type)).toString(), found});
|
||||
+ + "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.", new Object[]{pos.getX(), pos.getY(), pos.getZ(), type, found});
|
||||
+
|
||||
+ if (type instanceof ITileEntity) {
|
||||
+ TileEntity replacement = ((ITileEntity) type).a(this, type.toLegacyData(this.getType(pos)));
|
||||
+ TileEntity replacement = ((ITileEntity) type).a(this);
|
||||
+ replacement.world = this;
|
||||
+ this.setTileEntity(pos, replacement);
|
||||
+ return replacement;
|
||||
@@ -224,43 +215,37 @@
|
||||
+ return found;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private boolean canSpawn(int x, int z) {
|
||||
+ if (this.generator != null) {
|
||||
+ return this.generator.canSpawn(this.getWorld(), x, z);
|
||||
+ } else {
|
||||
+ return this.worldProvider.canSpawn(x, z);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void doTick() {
|
||||
this.Q = true;
|
||||
super.doTick();
|
||||
if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) {
|
||||
@@ -110,8 +283,11 @@
|
||||
@@ -128,9 +271,12 @@
|
||||
}
|
||||
|
||||
this.methodProfiler.a("mobSpawner");
|
||||
this.methodProfiler.a("spawner");
|
||||
- if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||
- this.spawnerCreature.a(this, this.allowMonsters, this.allowAnimals, this.worldData.getTime() % 400L == 0L);
|
||||
- this.getChunkProviderServer().a(this, this.allowMonsters, this.allowAnimals);
|
||||
+ // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
|
||||
+ long time = this.worldData.getTime();
|
||||
+ if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) {
|
||||
+ this.spawnerCreature.a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L);
|
||||
+ this.getChunkProviderServer().a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.methodProfiler.c("chunkSource");
|
||||
@@ -140,6 +316,8 @@
|
||||
this.portalTravelAgent.a(this.getTime());
|
||||
this.methodProfiler.b();
|
||||
this.aq();
|
||||
@@ -160,6 +306,8 @@
|
||||
this.methodProfiler.e();
|
||||
this.am();
|
||||
this.Q = false;
|
||||
+
|
||||
+ this.getWorld().processChunkGC(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -167,7 +345,7 @@
|
||||
public boolean j_() {
|
||||
@@ -191,7 +339,7 @@
|
||||
|
||||
if (entityhuman.isSpectator()) {
|
||||
++i;
|
||||
@@ -269,14 +254,14 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -195,25 +373,46 @@
|
||||
@@ -223,25 +371,46 @@
|
||||
}
|
||||
|
||||
private void c() {
|
||||
private void ai() {
|
||||
- this.worldData.setWeatherDuration(0);
|
||||
+ // CraftBukkit start
|
||||
this.worldData.setStorm(false);
|
||||
- this.worldData.setThunderDuration(0);
|
||||
+ // CraftBukkit start
|
||||
+ // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
|
||||
+ // Not that everyone ever manages to get the whole server to sleep at the same time....
|
||||
+ if (!this.worldData.hasStorm()) {
|
||||
@@ -294,7 +279,7 @@
|
||||
}
|
||||
|
||||
public boolean everyoneDeeplySleeping() {
|
||||
if (this.Q && !this.isClientSide) {
|
||||
if (this.K && !this.isClientSide) {
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
+ // CraftBukkit - This allows us to assume that some people are in bed but not really, allowing time to pass in spite of AFKers
|
||||
@@ -320,8 +305,8 @@
|
||||
|
||||
return false;
|
||||
} else {
|
||||
@@ -283,7 +482,7 @@
|
||||
entityhorseskeleton.p(true);
|
||||
@@ -315,7 +484,7 @@
|
||||
entityhorseskeleton.s(true);
|
||||
entityhorseskeleton.setAgeRaw(0);
|
||||
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
- this.addEntity(entityhorseskeleton);
|
||||
@@ -329,51 +314,30 @@
|
||||
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), true));
|
||||
} else {
|
||||
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), false));
|
||||
@@ -299,11 +498,11 @@
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
@@ -332,11 +501,11 @@
|
||||
BiomeBase biomebase = this.getBiome(blockposition);
|
||||
|
||||
if (this.v(blockposition1)) {
|
||||
if (biomebase.a((IWorldReader) this, blockposition1)) {
|
||||
- this.setTypeUpdate(blockposition1, Blocks.ICE.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.getBlockData(), null); // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag && this.f(blockposition, true)) {
|
||||
- this.setTypeUpdate(blockposition, Blocks.SNOW_LAYER.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW_LAYER.getBlockData(), null); // CraftBukkit
|
||||
if (flag && biomebase.b(this, blockposition)) {
|
||||
- this.setTypeUpdate(blockposition, Blocks.SNOW.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.getBlockData(), null); // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag && this.getBiome(blockposition1).d()) {
|
||||
@@ -378,7 +577,7 @@
|
||||
public boolean b(BlockPosition blockposition, Block block) {
|
||||
NextTickListEntry nextticklistentry = new NextTickListEntry(blockposition, block);
|
||||
|
||||
- return this.nextTickListHash.contains(nextticklistentry);
|
||||
+ return this.nextTickList.contains(nextticklistentry); // CraftBukkit
|
||||
}
|
||||
|
||||
public void a(BlockPosition blockposition, Block block, int i) {
|
||||
@@ -412,8 +611,8 @@
|
||||
nextticklistentry.a(j);
|
||||
}
|
||||
|
||||
- if (!this.nextTickListHash.contains(nextticklistentry)) {
|
||||
- this.nextTickListHash.add(nextticklistentry);
|
||||
+ // CraftBukkit - use nextTickList
|
||||
+ if (!this.nextTickList.contains(nextticklistentry)) {
|
||||
this.nextTickList.add(nextticklistentry);
|
||||
}
|
||||
}
|
||||
@@ -430,15 +629,15 @@
|
||||
nextticklistentry.a((long) i + this.worldData.getTime());
|
||||
}
|
||||
|
||||
- if (!this.nextTickListHash.contains(nextticklistentry)) {
|
||||
- this.nextTickListHash.add(nextticklistentry);
|
||||
+ // CraftBukkit - use nextTickList
|
||||
+ if (!this.nextTickList.contains(nextticklistentry)) {
|
||||
this.nextTickList.add(nextticklistentry);
|
||||
}
|
||||
if (flag && this.getBiome(blockposition1).c() == BiomeBase.Precipitation.RAIN) {
|
||||
@@ -385,7 +554,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);
|
||||
- List list = this.a(EntityLiving.class, axisalignedbb, (entityliving) -> {
|
||||
+ List list = this.a(EntityLiving.class, axisalignedbb, (Predicate<EntityLiving>) (entityliving) -> { // CraftBukkit - decompile error
|
||||
return entityliving != null && entityliving.isAlive() && this.e(entityliving.getChunkCoordinates());
|
||||
});
|
||||
|
||||
@@ -401,7 +570,7 @@
|
||||
}
|
||||
|
||||
public void tickEntities() {
|
||||
@@ -382,55 +346,15 @@
|
||||
if (this.emptyTime++ >= 300) {
|
||||
return;
|
||||
}
|
||||
@@ -508,11 +707,17 @@
|
||||
} else {
|
||||
int i = this.nextTickList.size();
|
||||
@@ -490,6 +659,7 @@
|
||||
|
||||
- if (i != this.nextTickListHash.size()) {
|
||||
+ if (false) { // CraftBukkit
|
||||
throw new IllegalStateException("TickNextTick list out of synch");
|
||||
} else {
|
||||
if (i > 65536) {
|
||||
- i = 65536;
|
||||
+ // CraftBukkit start - If the server has too much to process over time, try to alleviate that
|
||||
+ if (i > 20 * 65536) {
|
||||
+ i = i / 20;
|
||||
+ } else {
|
||||
+ i = 65536;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.methodProfiler.a("cleaning");
|
||||
@@ -525,8 +730,9 @@
|
||||
break;
|
||||
}
|
||||
|
||||
+ // CraftBukkit - use nextTickList
|
||||
this.nextTickList.remove(nextticklistentry);
|
||||
- this.nextTickListHash.remove(nextticklistentry);
|
||||
+ // this.nextTickListHash.remove(nextticklistentry);
|
||||
this.W.add(nextticklistentry);
|
||||
}
|
||||
|
||||
@@ -596,7 +802,7 @@
|
||||
if (blockposition.getX() >= structureboundingbox.a && blockposition.getX() < structureboundingbox.d && blockposition.getZ() >= structureboundingbox.c && blockposition.getZ() < structureboundingbox.f) {
|
||||
if (flag) {
|
||||
if (i == 0) {
|
||||
- this.nextTickListHash.remove(nextticklistentry);
|
||||
+ // this.nextTickListHash.remove(nextticklistentry); // CraftBukkit - removed
|
||||
}
|
||||
|
||||
iterator.remove();
|
||||
@@ -614,6 +820,7 @@
|
||||
return arraylist;
|
||||
}
|
||||
|
||||
+ /* CraftBukkit start - We prevent spawning in general, so this butchering is not needed
|
||||
public void entityJoinedWorld(Entity entity, boolean flag) {
|
||||
if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
||||
entity.die();
|
||||
@@ -625,6 +832,7 @@
|
||||
@@ -501,6 +671,7 @@
|
||||
|
||||
super.entityJoinedWorld(entity, flag);
|
||||
}
|
||||
@@ -438,11 +362,11 @@
|
||||
|
||||
private boolean getSpawnNPCs() {
|
||||
return this.server.getSpawnNPCs();
|
||||
@@ -637,7 +845,54 @@
|
||||
protected IChunkProvider n() {
|
||||
@@ -513,7 +684,21 @@
|
||||
protected IChunkProvider q() {
|
||||
IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider);
|
||||
|
||||
- return new ChunkProviderServer(this, ichunkloader, this.worldProvider.getChunkGenerator());
|
||||
- return new ChunkProviderServer(this, ichunkloader, this.worldProvider.getChunkGenerator(), this.server);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.craftbukkit.generator.InternalChunkGenerator gen;
|
||||
+
|
||||
@@ -456,47 +380,14 @@
|
||||
+ gen = new org.bukkit.craftbukkit.generator.NormalChunkGenerator(this, this.getSeed());
|
||||
+ }
|
||||
+
|
||||
+ return new ChunkProviderServer(this, ichunkloader, gen);
|
||||
+ return new ChunkProviderServer(this, ichunkloader, gen, this.server);
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
+ public List<TileEntity> getTileEntities(int i, int j, int k, int l, int i1, int j1) {
|
||||
+ ArrayList arraylist = Lists.newArrayList();
|
||||
+
|
||||
+ // CraftBukkit start - Get tile entities from chunks instead of world
|
||||
+ for (int chunkX = (i >> 4); chunkX <= ((l - 1) >> 4); chunkX++) {
|
||||
+ for (int chunkZ = (k >> 4); chunkZ <= ((j1 - 1) >> 4); chunkZ++) {
|
||||
+ Chunk chunk = getChunkAt(chunkX, chunkZ);
|
||||
+ if (chunk == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ for (Object te : chunk.tileEntities.values()) {
|
||||
+ TileEntity tileentity = (TileEntity) te;
|
||||
+ if ((tileentity.position.getX() >= i) && (tileentity.position.getY() >= j) && (tileentity.position.getZ() >= k) && (tileentity.position.getX() < l) && (tileentity.position.getY() < i1) && (tileentity.position.getZ() < j1)) {
|
||||
+ arraylist.add(tileentity);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ /*
|
||||
+ for (int k1 = 0; k1 < this.tileEntityList.size(); ++k1) {
|
||||
+ TileEntity tileentity = (TileEntity) this.tileEntityList.get(k1);
|
||||
+ BlockPosition blockposition = tileentity.getPosition();
|
||||
+
|
||||
+ if (blockposition.getX() >= i && blockposition.getY() >= j && blockposition.getZ() >= k && blockposition.getX() < l && blockposition.getY() < i1 && blockposition.getZ() < j1) {
|
||||
+ arraylist.add(tileentity);
|
||||
+ }
|
||||
+ }
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ return arraylist;
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman, BlockPosition blockposition) {
|
||||
@@ -699,6 +954,23 @@
|
||||
int j = this.worldProvider.getSeaLevel();
|
||||
int k = 8;
|
||||
@@ -572,6 +757,22 @@
|
||||
BlockPosition blockposition = worldchunkmanager.a(0, 0, 256, list, random);
|
||||
ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (this.generator != null) {
|
||||
@@ -508,34 +399,24 @@
|
||||
+ throw new IllegalStateException("Cannot set spawn point for " + this.worldData.getName() + " to be in another world (" + spawn.getWorld().getName() + ")");
|
||||
+ } else {
|
||||
+ this.worldData.setSpawn(new BlockPosition(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()));
|
||||
+ this.isLoading = false;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (blockposition != null) {
|
||||
i = blockposition.getX();
|
||||
k = blockposition.getZ();
|
||||
@@ -708,7 +980,7 @@
|
||||
|
||||
int l = 0;
|
||||
|
||||
- while (!this.worldProvider.canSpawn(i, k)) {
|
||||
+ while (!this.canSpawn(i, k)) { // CraftBukkit - use our own canSpawn
|
||||
i += random.nextInt(64) - random.nextInt(64);
|
||||
k += random.nextInt(64) - random.nextInt(64);
|
||||
++l;
|
||||
@@ -750,6 +1022,7 @@
|
||||
if (blockposition == null) {
|
||||
WorldServer.a.warn("Unable to find spawn biome");
|
||||
}
|
||||
@@ -647,6 +848,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkProviderServer();
|
||||
|
||||
if (chunkproviderserver.e()) {
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.a("Saving level");
|
||||
iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0]));
|
||||
}
|
||||
@@ -760,7 +1033,8 @@
|
||||
@@ -657,7 +859,8 @@
|
||||
}
|
||||
|
||||
chunkproviderserver.a(flag);
|
||||
@@ -545,20 +426,20 @@
|
||||
Iterator iterator = arraylist.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -795,6 +1069,12 @@
|
||||
@@ -692,6 +895,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Save secondary data for nether/end
|
||||
+ if (this instanceof SecondaryWorldServer) {
|
||||
+ ((SecondaryWorldServer) this).c();
|
||||
+ ((SecondaryWorldServer) this).c(); // As above
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.worldData.a(this.getWorldBorder().getSize());
|
||||
this.worldData.d(this.getWorldBorder().getCenterX());
|
||||
this.worldData.c(this.getWorldBorder().getCenterZ());
|
||||
@@ -808,9 +1088,13 @@
|
||||
@@ -706,9 +915,13 @@
|
||||
this.worldMaps.a();
|
||||
}
|
||||
|
||||
@@ -574,25 +455,25 @@
|
||||
|
||||
public void a(Collection<Entity> collection) {
|
||||
ArrayList arraylist = Lists.newArrayList(collection);
|
||||
@@ -829,7 +1113,7 @@
|
||||
@@ -727,7 +940,7 @@
|
||||
|
||||
private boolean j(Entity entity) {
|
||||
if (entity.dead) {
|
||||
- WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity));
|
||||
+ // WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit
|
||||
- WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.P()));
|
||||
+ // WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.P())); // CraftBukkit
|
||||
return false;
|
||||
} else {
|
||||
UUID uuid = entity.getUniqueID();
|
||||
@@ -841,7 +1125,7 @@
|
||||
this.f.remove(entity1);
|
||||
@@ -739,7 +952,7 @@
|
||||
this.g.remove(entity1);
|
||||
} else {
|
||||
if (!(entity instanceof EntityHuman)) {
|
||||
- WorldServer.a.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.a(entity1), uuid.toString());
|
||||
+ // WorldServer.a.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.a(entity1), uuid.toString()); // CraftBukkit
|
||||
- WorldServer.a.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.P()), uuid.toString());
|
||||
+ // WorldServer.a.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.P()), uuid.toString()); // CraftBukkit
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -894,8 +1178,16 @@
|
||||
@@ -792,8 +1005,16 @@
|
||||
}
|
||||
|
||||
public boolean strikeLightning(Entity entity) {
|
||||
@@ -610,12 +491,12 @@
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -911,10 +1203,20 @@
|
||||
@@ -809,6 +1030,14 @@
|
||||
}
|
||||
|
||||
public Explosion createExplosion(@Nullable Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
|
||||
public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
|
||||
+ // CraftBukkit start
|
||||
+ Explosion explosion = super.createExplosion(entity, d0, d1, d2, f, flag, flag1);
|
||||
+ Explosion explosion = super.createExplosion(entity, damagesource, d0, d1, d2, f, flag, flag1);
|
||||
+
|
||||
+ if (explosion.wasCanceled) {
|
||||
+ return explosion;
|
||||
@@ -624,6 +505,9 @@
|
||||
+ /* Remove
|
||||
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, flag1);
|
||||
|
||||
if (damagesource != null) {
|
||||
@@ -817,6 +1046,8 @@
|
||||
|
||||
explosion.a();
|
||||
explosion.a(false);
|
||||
+ */
|
||||
@@ -631,27 +515,27 @@
|
||||
if (!flag1) {
|
||||
explosion.clearBlocks();
|
||||
}
|
||||
@@ -960,7 +1262,8 @@
|
||||
BlockActionData blockactiondata = (BlockActionData) iterator.next();
|
||||
@@ -843,7 +1074,8 @@
|
||||
BlockActionData blockactiondata = (BlockActionData) this.d.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().getDimensionID(), new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.d(), blockactiondata.b(), blockactiondata.c()));
|
||||
+ // 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.d(), blockactiondata.b(), blockactiondata.c()));
|
||||
}
|
||||
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().getDimensionID(), 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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -983,6 +1286,7 @@
|
||||
@@ -864,6 +1096,7 @@
|
||||
boolean flag = this.isRaining();
|
||||
|
||||
super.t();
|
||||
super.v();
|
||||
+ /* CraftBukkit start
|
||||
if (this.n != this.o) {
|
||||
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.o)), this.worldProvider.getDimensionManager().getDimensionID());
|
||||
if (this.o != this.p) {
|
||||
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.p)), this.worldProvider.getDimensionManager().getDimensionID());
|
||||
}
|
||||
@@ -1001,6 +1305,21 @@
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.o));
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.q));
|
||||
@@ -882,6 +1115,21 @@
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.p));
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.r));
|
||||
}
|
||||
+ // */
|
||||
+ if (flag != this.isRaining()) {
|
||||
@@ -664,31 +548,29 @@
|
||||
+ }
|
||||
+ for (int i = 0; i < this.players.size(); ++i) {
|
||||
+ if (((EntityPlayer) this.players.get(i)).world == this) {
|
||||
+ ((EntityPlayer) this.players.get(i)).updateWeather(this.n, this.o, this.p, this.q);
|
||||
+ ((EntityPlayer) this.players.get(i)).updateWeather(this.o, this.p, this.q, this.r);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
}
|
||||
|
||||
@@ -1030,10 +1349,20 @@
|
||||
@@ -915,11 +1163,18 @@
|
||||
}
|
||||
|
||||
public void a(EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) {
|
||||
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
+ // CraftBukkit - visibility api support
|
||||
+ sendParticles(null, enumparticle, flag, d0, d1, d2, i, d3, d4, d5, d6, aint);
|
||||
+ return sendParticles(null, t0, d0, d1, d2, i, d3, d4, d5, d6);
|
||||
+ }
|
||||
+
|
||||
+ public void sendParticles(EntityPlayer sender, EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) {
|
||||
+ public <T extends ParticleParam> int sendParticles(EntityPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
+ // CraftBukkit end
|
||||
PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(enumparticle, flag, (float) d0, (float) d1, (float) d2, (float) d3, (float) d4, (float) d5, (float) d6, i, aint);
|
||||
PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, false, (float) d0, (float) d1, (float) d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
|
||||
int j = 0;
|
||||
|
||||
for (int j = 0; j < this.players.size(); ++j) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
|
||||
for (int k = 0; k < this.players.size(); ++k) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(k);
|
||||
+ if (sender != null && !entityplayer.getBukkitEntity().canSee(sender.getBukkitEntity())) continue; // CraftBukkit
|
||||
+ BlockPosition blockposition = entityplayer.getChunkCoordinates();
|
||||
+ double d7 = blockposition.distanceSquared(d0, d1, d2);
|
||||
+
|
||||
|
||||
this.a(entityplayer, flag, d0, d1, d2, packetplayoutworldparticles);
|
||||
}
|
||||
if (this.a(entityplayer, false, d0, d1, d2, packetplayoutworldparticles)) {
|
||||
++j;
|
||||
|
Reference in New Issue
Block a user