@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -170,6 +170,23 @@
|
||||
@@ -171,6 +171,23 @@
|
||||
import net.minecraft.world.ticks.TickListServer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -183,7 +200,7 @@
|
||||
@@ -184,7 +201,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
@@ -33,7 +33,7 @@
|
||||
private int lastSpawnChunkRadius;
|
||||
final EntityTickList entityTickList;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
@@ -210,12 +227,30 @@
|
||||
@@ -211,12 +228,30 @@
|
||||
private final boolean tickTime;
|
||||
private final RandomSequences randomSequences;
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
@@ -230,6 +265,22 @@
|
||||
@@ -231,6 +266,22 @@
|
||||
this.customSpawners = list;
|
||||
this.serverLevelData = iworlddataserver;
|
||||
ChunkGenerator chunkgenerator = worlddimension.generator();
|
||||
@@ -92,7 +92,7 @@
|
||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
||||
@@ -257,9 +308,9 @@
|
||||
@@ -258,9 +309,9 @@
|
||||
long l = minecraftserver.getWorldData().worldGenOptions().seed();
|
||||
|
||||
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
|
||||
@@ -105,7 +105,7 @@
|
||||
} else {
|
||||
this.dragonFight = null;
|
||||
}
|
||||
@@ -269,6 +320,7 @@
|
||||
@@ -270,6 +321,7 @@
|
||||
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
|
||||
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
|
||||
});
|
||||
@@ -113,7 +113,7 @@
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@@ -313,12 +365,20 @@
|
||||
@@ -314,12 +366,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
@@ -137,7 +137,7 @@
|
||||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -353,7 +413,7 @@
|
||||
@@ -354,7 +414,7 @@
|
||||
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
@@ -146,7 +146,7 @@
|
||||
|
||||
if (flag1) {
|
||||
this.resetEmptyTime();
|
||||
@@ -369,7 +429,7 @@
|
||||
@@ -370,7 +430,7 @@
|
||||
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
@@ -155,7 +155,7 @@
|
||||
entity.discard();
|
||||
} else if (!tickratemanager.isEntityFrozen(entity)) {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
@@ -441,7 +501,7 @@
|
||||
@@ -442,7 +502,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
@@ -164,7 +164,7 @@
|
||||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -468,7 +528,7 @@
|
||||
@@ -469,7 +529,7 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
@@ -173,7 +173,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,7 +537,7 @@
|
||||
@@ -478,7 +538,7 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setVisualOnly(flag1);
|
||||
@@ -182,7 +182,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -533,7 +593,7 @@
|
||||
@@ -534,7 +594,7 @@
|
||||
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition1).value();
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition2)) {
|
||||
@@ -191,7 +191,7 @@
|
||||
}
|
||||
|
||||
if (this.isRaining()) {
|
||||
@@ -549,10 +609,10 @@
|
||||
@@ -550,10 +610,10 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, j + 1);
|
||||
|
||||
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1);
|
||||
@@ -204,7 +204,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,6 +773,7 @@
|
||||
@@ -714,6 +774,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@
|
||||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -731,15 +792,48 @@
|
||||
@@ -732,15 +793,48 @@
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
@@ -263,7 +263,7 @@
|
||||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -774,6 +868,7 @@
|
||||
@@ -775,6 +869,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
@@ -271,7 +271,7 @@
|
||||
this.getProfiler().pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -797,6 +892,7 @@
|
||||
@@ -798,6 +893,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
@@ -279,7 +279,7 @@
|
||||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -821,6 +917,7 @@
|
||||
@@ -822,6 +918,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
@@ -287,7 +287,7 @@
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
|
||||
}
|
||||
@@ -838,11 +935,19 @@
|
||||
@@ -839,11 +936,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -308,7 +308,7 @@
|
||||
}
|
||||
|
||||
this.getChunkSource().getDataStorage().save();
|
||||
@@ -907,15 +1012,37 @@
|
||||
@@ -908,18 +1013,40 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
@@ -335,7 +335,6 @@
|
||||
}
|
||||
|
||||
public void addDuringTeleport(Entity entity) {
|
||||
- this.addEntity(entity);
|
||||
+ // CraftBukkit start
|
||||
+ // SPIGOT-6415: Don't call spawn event for entities which travel trough worlds,
|
||||
+ // since it is only an implementation detail, that a new entity is created when
|
||||
@@ -344,12 +343,16 @@
|
||||
+ }
|
||||
+
|
||||
+ public void addDuringTeleport(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ this.addEntity(entity, reason);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
if (entity instanceof EntityPlayer entityplayer) {
|
||||
this.addPlayer(entityplayer);
|
||||
} else {
|
||||
- this.addEntity(entity);
|
||||
+ this.addEntity(entity, reason); // CraftBukkit
|
||||
}
|
||||
|
||||
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
|
||||
@@ -946,24 +1073,37 @@
|
||||
}
|
||||
@@ -944,24 +1071,37 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
@@ -391,14 +394,14 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -974,13 +1114,35 @@
|
||||
@@ -972,13 +1112,35 @@
|
||||
}
|
||||
|
||||
public void removePlayerImmediately(EntityPlayer entityplayer, Entity.RemovalReason entity_removalreason) {
|
||||
- entityplayer.remove(entity_removalreason);
|
||||
+ entityplayer.remove(entity_removalreason, null); // CraftBukkit - add Bukkit remove cause
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public boolean strikeLightning(Entity entitylightning) {
|
||||
+ return this.strikeLightning(entitylightning, LightningStrikeEvent.Cause.UNKNOWN);
|
||||
@@ -412,9 +415,9 @@
|
||||
+ }
|
||||
+
|
||||
+ return this.addFreshEntity(entitylightning);
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
@Override
|
||||
public void destroyBlockProgress(int i, BlockPosition blockposition, int j) {
|
||||
Iterator iterator = this.server.getPlayerList().getPlayers().iterator();
|
||||
@@ -428,7 +431,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -989,6 +1151,12 @@
|
||||
@@ -987,6 +1149,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
@@ -441,7 +444,7 @@
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -1049,7 +1217,18 @@
|
||||
@@ -1047,7 +1215,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -461,7 +464,7 @@
|
||||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (navigationabstract.shouldRecomputePath(blockposition)) {
|
||||
@@ -1111,6 +1290,11 @@
|
||||
@@ -1109,6 +1288,11 @@
|
||||
@Override
|
||||
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a, ParticleParam particleparam, ParticleParam particleparam1, Holder<SoundEffect> holder) {
|
||||
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false, particleparam, particleparam1, holder);
|
||||
@@ -473,7 +476,7 @@
|
||||
|
||||
if (!explosion.interactsWithBlocks()) {
|
||||
explosion.clearToBlow();
|
||||
@@ -1183,13 +1367,20 @@
|
||||
@@ -1181,13 +1365,20 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
@@ -496,7 +499,7 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1240,7 +1431,7 @@
|
||||
@@ -1238,7 +1429,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
|
||||
@@ -505,7 +508,7 @@
|
||||
return null;
|
||||
} else {
|
||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
|
||||
@@ -1282,11 +1473,22 @@
|
||||
@@ -1280,11 +1471,22 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap getMapData(MapId mapid) {
|
||||
@@ -529,7 +532,7 @@
|
||||
this.getServer().overworld().getDataStorage().set(mapid.key(), worldmap);
|
||||
}
|
||||
|
||||
@@ -1597,6 +1799,11 @@
|
||||
@@ -1595,6 +1797,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
@@ -541,7 +544,7 @@
|
||||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1616,12 +1823,12 @@
|
||||
@@ -1614,12 +1821,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
@@ -556,7 +559,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1644,7 +1851,7 @@
|
||||
@@ -1642,7 +1849,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
@@ -565,7 +568,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1653,7 +1860,7 @@
|
||||
@@ -1651,7 +1858,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
@@ -574,43 +577,7 @@
|
||||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1664,17 +1871,33 @@
|
||||
}
|
||||
|
||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||
+ // CraftBukkit start
|
||||
+ WorldServer.makeObsidianPlatform(worldserver, null);
|
||||
+ }
|
||||
+
|
||||
+ public static void makeObsidianPlatform(WorldServer worldserver, Entity entity) {
|
||||
+ // CraftBukkit end
|
||||
BlockPosition blockposition = WorldServer.END_SPAWN_POINT;
|
||||
int i = blockposition.getX();
|
||||
int j = blockposition.getY() - 2;
|
||||
int k = blockposition.getZ();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.craftbukkit.util.BlockStateListPopulator blockList = new org.bukkit.craftbukkit.util.BlockStateListPopulator(worldserver);
|
||||
BlockPosition.betweenClosed(i - 2, j + 1, k - 2, i + 2, j + 3, k + 2).forEach((blockposition1) -> {
|
||||
- worldserver.setBlockAndUpdate(blockposition1, Blocks.AIR.defaultBlockState());
|
||||
+ blockList.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3);
|
||||
});
|
||||
BlockPosition.betweenClosed(i - 2, j, k - 2, i + 2, j, k + 2).forEach((blockposition1) -> {
|
||||
- worldserver.setBlockAndUpdate(blockposition1, Blocks.OBSIDIAN.defaultBlockState());
|
||||
+ blockList.setBlock(blockposition1, Blocks.OBSIDIAN.defaultBlockState(), 3);
|
||||
});
|
||||
+ org.bukkit.World bworld = worldserver.getWorld();
|
||||
+ org.bukkit.event.world.PortalCreateEvent portalEvent = new org.bukkit.event.world.PortalCreateEvent((List<org.bukkit.block.BlockState>) (List) blockList.getList(), bworld, (entity == null) ? null : entity.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.END_PLATFORM);
|
||||
+
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(portalEvent);
|
||||
+ if (!portalEvent.isCancelled()) {
|
||||
+ blockList.updateList();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1812,6 +2035,8 @@
|
||||
@@ -1796,6 +2003,8 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||
@@ -619,7 +586,7 @@
|
||||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1843,6 +2068,14 @@
|
||||
@@ -1827,6 +2036,14 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||
|
||||
Reference in New Issue
Block a user