Update to Minecraft 1.20.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-09-22 02:40:00 +10:00
parent 193398c0ff
commit 8a3c8cfcd4
238 changed files with 2448 additions and 2344 deletions

View File

@@ -95,7 +95,7 @@
boolean flag2 = minecraftserver.forceSynchronousWrites();
DataFixer datafixer = minecraftserver.getFixerUpper();
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
@@ -250,9 +304,9 @@
@@ -246,9 +300,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);
@@ -108,15 +108,15 @@
} else {
this.dragonFight = null;
}
@@ -266,6 +320,7 @@
return new RandomSequences(l);
}, "random_sequences");
@@ -258,6 +312,7 @@
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
});
+ this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
}
/** @deprecated */
@@ -304,12 +359,20 @@
@@ -296,12 +351,20 @@
long j;
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
@@ -140,7 +140,7 @@
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle();
}
@@ -335,7 +398,7 @@
@@ -327,7 +390,7 @@
this.runBlockEvents();
this.handlingTick = false;
gameprofilerfiller.pop();
@@ -149,7 +149,7 @@
if (flag) {
this.resetEmptyTime();
@@ -351,7 +414,7 @@
@@ -343,7 +406,7 @@
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
@@ -158,7 +158,7 @@
entity.discard();
} else {
gameprofilerfiller.push("checkDespawn");
@@ -423,7 +486,7 @@
@@ -415,7 +478,7 @@
private void wakeUpAllPlayers() {
this.sleepStatus.removeAllSleepers();
@@ -167,7 +167,7 @@
entityplayer.stopSleepInBed(false, false);
});
}
@@ -451,7 +514,7 @@
@@ -442,7 +505,7 @@
entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@@ -176,7 +176,7 @@
}
}
@@ -460,7 +523,7 @@
@@ -451,7 +514,7 @@
if (entitylightning != null) {
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setVisualOnly(flag1);
@@ -185,29 +185,29 @@
}
}
}
@@ -475,7 +538,7 @@
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value();
@@ -506,7 +569,7 @@
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition1).value();
if (biomebase.shouldFreeze(this, blockposition1)) {
- this.setBlockAndUpdate(blockposition1, Blocks.ICE.defaultBlockState());
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.defaultBlockState(), null); // CraftBukkit
if (biomebase.shouldFreeze(this, blockposition2)) {
- this.setBlockAndUpdate(blockposition2, Blocks.ICE.defaultBlockState());
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition2, Blocks.ICE.defaultBlockState(), null); // CraftBukkit
}
if (flag) {
@@ -522,10 +585,10 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, j + 1);
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1);
- this.setBlockAndUpdate(blockposition1, iblockdata1);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, iblockdata1, null); // CraftBukkit
}
} else {
- this.setBlockAndUpdate(blockposition1, Blocks.SNOW.defaultBlockState());
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit
}
}
if (flag) {
@@ -489,10 +552,10 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, i1 + 1);
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition);
- this.setBlockAndUpdate(blockposition, iblockdata1);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, iblockdata1, null); // CraftBukkit
}
} else {
- this.setBlockAndUpdate(blockposition, Blocks.SNOW.defaultBlockState());
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit
}
}
@@ -688,6 +751,7 @@
@@ -686,6 +749,7 @@
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
}
@@ -215,7 +215,7 @@
if (this.oRainLevel != this.rainLevel) {
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
}
@@ -706,14 +770,47 @@
@@ -704,14 +768,47 @@
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
}
@@ -265,7 +265,7 @@
}
public void resetEmptyTime() {
@@ -748,6 +845,7 @@
@@ -746,6 +843,7 @@
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
entity.tick();
@@ -273,7 +273,7 @@
this.getProfiler().pop();
Iterator iterator = entity.getPassengers().iterator();
@@ -771,6 +869,7 @@
@@ -769,6 +867,7 @@
});
gameprofilerfiller.incrementCounter("tickPassenger");
entity1.rideTick();
@@ -281,7 +281,7 @@
gameprofilerfiller.pop();
Iterator iterator = entity1.getPassengers().iterator();
@@ -795,6 +894,7 @@
@@ -793,6 +892,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkSource();
if (!flag1) {
@@ -289,7 +289,7 @@
if (iprogressupdate != null) {
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
}
@@ -812,11 +912,19 @@
@@ -810,11 +910,19 @@
}
}
@@ -310,7 +310,7 @@
}
this.getChunkSource().getDataStorage().save();
@@ -881,15 +989,37 @@
@@ -879,15 +987,37 @@
@Override
public boolean addFreshEntity(Entity entity) {
@@ -351,7 +351,7 @@
}
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
@@ -920,24 +1050,37 @@
@@ -918,24 +1048,37 @@
this.entityManager.addNewEntity(entityplayer);
}
@@ -393,7 +393,7 @@
return true;
}
}
@@ -951,10 +1094,32 @@
@@ -949,10 +1092,32 @@
entityplayer.remove(entity_removalreason);
}
@@ -426,7 +426,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -963,6 +1128,12 @@
@@ -961,6 +1126,12 @@
double d1 = (double) blockposition.getY() - entityplayer.getY();
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
@@ -439,7 +439,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -1022,7 +1193,18 @@
@@ -1020,7 +1191,18 @@
Iterator iterator = this.navigatingMobs.iterator();
while (iterator.hasNext()) {
@@ -459,7 +459,7 @@
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
if (navigationabstract.shouldRecomputePath(blockposition)) {
@@ -1084,6 +1266,11 @@
@@ -1082,6 +1264,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) {
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false);
@@ -471,7 +471,7 @@
if (!explosion.interactsWithBlocks()) {
explosion.clearToBlow();
@@ -1156,13 +1343,20 @@
@@ -1154,13 +1341,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) {
@@ -494,7 +494,7 @@
++j;
}
}
@@ -1213,7 +1407,7 @@
@@ -1211,7 +1405,7 @@
@Nullable
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
@@ -503,22 +503,7 @@
return null;
} else {
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
@@ -1250,11 +1444,21 @@
@Nullable
@Override
public WorldMap getMapData(String s) {
- return (WorldMap) this.getServer().overworld().getDataStorage().get(WorldMap::load, s);
+ // CraftBukkit start
+ return (WorldMap) this.getServer().overworld().getDataStorage().get((nbttagcompound) -> {
+ // We only get here when the data file exists, but is not a valid map
+ WorldMap newMap = WorldMap.load(nbttagcompound);
+ newMap.id = s;
+ MapInitializeEvent event = new MapInitializeEvent(newMap.mapView);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ return newMap;
+ }, s);
+ // CraftBukkit end
}
@@ -1253,6 +1447,7 @@
@Override
public void setMapData(String s, WorldMap worldmap) {
@@ -526,7 +511,7 @@
this.getServer().overworld().getDataStorage().set(s, worldmap);
}
@@ -1552,6 +1756,11 @@
@@ -1550,6 +1745,11 @@
@Override
public void blockUpdated(BlockPosition blockposition, Block block) {
if (!this.isDebug()) {
@@ -538,7 +523,7 @@
this.updateNeighborsAt(blockposition, block);
}
@@ -1571,12 +1780,12 @@
@@ -1569,12 +1769,12 @@
}
public boolean isFlat() {
@@ -553,7 +538,7 @@
}
@Nullable
@@ -1599,7 +1808,7 @@
@@ -1597,7 +1797,7 @@
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
try {
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
@@ -562,7 +547,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1608,7 +1817,7 @@
@@ -1606,7 +1806,7 @@
object2intopenhashmap.addTo(s, 1);
}
@@ -571,7 +556,7 @@
String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue();
@@ -1619,17 +1828,33 @@
@@ -1617,17 +1817,33 @@
}
public static void makeObsidianPlatform(WorldServer worldserver) {
@@ -607,7 +592,7 @@
}
@Override
@@ -1753,6 +1978,7 @@
@@ -1751,6 +1967,7 @@
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
@@ -615,7 +600,7 @@
}
public void onTrackingEnd(Entity entity) {
@@ -1789,6 +2015,14 @@
@@ -1787,6 +2004,14 @@
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);