Update to Minecraft 1.19.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-12-08 03:00:00 +11:00
parent a13136ada2
commit 8b26bb8f3e
305 changed files with 3331 additions and 2864 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ChunkProviderServer.java
+++ b/net/minecraft/server/level/ChunkProviderServer.java
@@ -84,6 +84,16 @@
@@ -85,6 +85,16 @@
this.clearCache();
}
@@ -17,7 +17,7 @@
@Override
public LightEngineThreaded getLightEngine() {
return this.lightEngine;
@@ -128,7 +138,7 @@
@@ -129,7 +139,7 @@
for (int l = 0; l < 4; ++l) {
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
ichunkaccess = this.lastChunk[l];
@@ -26,7 +26,7 @@
return ichunkaccess;
}
}
@@ -176,12 +186,12 @@
@@ -177,12 +187,12 @@
if (playerchunk == null) {
return null;
} else {
@@ -41,7 +41,7 @@
if (ichunkaccess1 != null) {
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
@@ -229,7 +239,15 @@
@@ -230,7 +240,15 @@
int l = 33 + ChunkStatus.getDistance(chunkstatus);
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
@@ -58,7 +58,7 @@
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
if (this.chunkAbsent(playerchunk, l)) {
GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -248,7 +266,7 @@
@@ -249,7 +267,7 @@
}
private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
@@ -67,7 +67,7 @@
}
@Override
@@ -315,7 +333,7 @@
@@ -316,7 +334,7 @@
} else if (!this.level.shouldTickBlocksAt(i)) {
return false;
} else {
@@ -76,7 +76,7 @@
return either != null && either.left().isPresent();
}
@@ -328,11 +346,31 @@
@@ -329,11 +347,31 @@
@Override
public void close() throws IOException {
@@ -109,7 +109,7 @@
@Override
public void tick(BooleanSupplier booleansupplier, boolean flag) {
this.level.getProfiler().push("purge");
@@ -364,7 +402,7 @@
@@ -365,7 +403,7 @@
gameprofilerfiller.push("pollingChunks");
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
@@ -118,7 +118,7 @@
gameprofilerfiller.push("naturalSpawnCount");
int l = this.distanceManager.getNaturalSpawnChunkCount();
@@ -385,7 +423,7 @@
@@ -386,7 +424,7 @@
}
gameprofilerfiller.popPush("spawnAndTick");
@@ -127,7 +127,7 @@
Collections.shuffle(list);
Iterator iterator1 = list.iterator();
@@ -586,13 +624,19 @@
@@ -591,13 +629,19 @@
}
@Override

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/EntityPlayer.java
+++ b/net/minecraft/server/level/EntityPlayer.java
@@ -148,6 +148,35 @@
@@ -150,6 +150,35 @@
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
import org.slf4j.Logger;
@@ -36,7 +36,7 @@
public class EntityPlayer extends EntityHuman {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -202,6 +231,21 @@
@@ -207,6 +236,21 @@
public int latency;
public boolean wonGame;
@@ -55,10 +55,10 @@
+ public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
+ // CraftBukkit end
+
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, @Nullable ProfilePublicKey profilepublickey) {
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile, profilepublickey);
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
this.chatVisibility = EnumChatVisibility.FULL;
@@ -264,12 +308,56 @@
@@ -270,12 +314,56 @@
this.advancements = minecraftserver.getPlayerList().getPlayerAdvancements(this);
this.maxUpStep = 1.0F;
this.fudgeSpawnLocation(worldserver);
@@ -116,7 +116,16 @@
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -327,17 +415,26 @@
@@ -324,7 +412,7 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
- DataResult dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker")));
+ DataResult<WardenSpawnTracker> dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker"))); // CraftBukkit - decompile error
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -343,17 +431,26 @@
if (nbttagcompound.contains("recipeBook", 10)) {
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
}
@@ -139,12 +148,21 @@
this.respawnForced = nbttagcompound.getBoolean("SpawnForced");
this.respawnAngle = nbttagcompound.getFloat("SpawnAngle");
if (nbttagcompound.contains("SpawnDimension")) {
- DataResult dataresult = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension"));
+ DataResult<ResourceKey<World>> dataresult = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension")); // CraftBukkit - decompile error
Logger logger = EntityPlayer.LOGGER;
- DataResult dataresult1 = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension"));
+ DataResult<ResourceKey<World>> dataresult1 = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension")); // CraftBukkit - decompile error
Logger logger1 = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -364,7 +461,20 @@
Objects.requireNonNull(logger1);
@@ -366,7 +463,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
- DataResult dataresult = WardenSpawnTracker.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.wardenSpawnTracker);
+ DataResult<NBTBase> dataresult = WardenSpawnTracker.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.wardenSpawnTracker); // CraftBukkit - decompile error
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -387,7 +484,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@@ -166,16 +184,7 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
@@ -382,7 +492,7 @@
nbttagcompound.putInt("SpawnZ", this.respawnPosition.getZ());
nbttagcompound.putBoolean("SpawnForced", this.respawnForced);
nbttagcompound.putFloat("SpawnAngle", this.respawnAngle);
- DataResult dataresult = MinecraftKey.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.respawnDimension.location());
+ DataResult<NBTBase> dataresult = MinecraftKey.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.respawnDimension.location()); // CraftBukkit - decompile error
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -390,9 +500,33 @@
@@ -412,9 +522,33 @@
nbttagcompound.put("SpawnDimension", nbtbase);
});
}
@@ -209,7 +218,7 @@
public void setExperiencePoints(int i) {
float f = (float) this.getXpNeededForNextLevel();
float f1 = (f - 1.0F) / f;
@@ -451,6 +585,11 @@
@@ -473,6 +607,11 @@
@Override
public void tick() {
@@ -219,9 +228,9 @@
+ }
+ // CraftBukkit end
this.gameMode.tick();
this.wardenSpawnTracker.tick();
--this.spawnInvulnerableTime;
if (this.invulnerableTime > 0) {
@@ -506,7 +645,7 @@
@@ -529,7 +668,7 @@
}
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
@@ -230,7 +239,7 @@
this.lastSentHealth = this.getHealth();
this.lastSentFood = this.foodData.getFoodLevel();
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -537,6 +676,12 @@
@@ -560,6 +699,12 @@
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
}
@@ -243,7 +252,7 @@
if (this.experienceLevel != this.lastRecordedLevel) {
this.lastRecordedLevel = this.experienceLevel;
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
@@ -551,6 +696,20 @@
@@ -574,6 +719,20 @@
CriterionTriggers.LOCATION.trigger(this);
}
@@ -264,7 +273,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
@@ -593,7 +752,8 @@
@@ -616,7 +775,8 @@
}
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
@@ -274,7 +283,7 @@
scoreboardscore.setScore(i);
});
}
@@ -602,9 +762,47 @@
@@ -625,9 +785,47 @@
public void die(DamageSource damagesource) {
this.gameEvent(GameEvent.ENTITY_DIE);
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
@@ -324,7 +333,7 @@
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
boolean flag1 = true;
@@ -635,12 +833,18 @@
@@ -658,12 +856,18 @@
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
this.tellNeutralMobsThatIDied();
}
@@ -347,7 +356,7 @@
EntityLiving entityliving = this.getKillCredit();
if (entityliving != null) {
@@ -678,10 +882,12 @@
@@ -701,10 +905,12 @@
String s = this.getScoreboardName();
String s1 = entity.getScoreboardName();
@@ -362,7 +371,7 @@
} else {
this.awardStat(StatisticList.MOB_KILLS);
}
@@ -699,7 +905,8 @@
@@ -722,7 +928,8 @@
int i = scoreboardteam.getColor().getId();
if (i >= 0 && i < aiscoreboardcriteria.length) {
@@ -372,7 +381,7 @@
}
}
@@ -743,18 +950,20 @@
@@ -766,18 +973,20 @@
}
private boolean isPvpAllowed() {
@@ -396,7 +405,7 @@
} else {
return shapedetectorshape;
}
@@ -763,11 +972,20 @@
@@ -786,11 +995,20 @@
@Nullable
@Override
public Entity changeDimension(WorldServer worldserver) {
@@ -420,7 +429,7 @@
this.unRide();
this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
if (!this.wonGame) {
@@ -778,6 +996,8 @@
@@ -801,6 +1019,8 @@
return this;
} else {
@@ -428,8 +437,8 @@
+ /*
WorldData worlddata = worldserver.getLevelData();
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true, this.getLastDeathLocation()));
@@ -787,22 +1007,52 @@
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation()));
@@ -810,20 +1030,50 @@
playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
@@ -468,7 +477,7 @@
+ if (true) { // CraftBukkit
+ this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
+
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true, this.getLastDeathLocation()));
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation()));
+ this.connection.send(new PacketPlayOutServerDifficulty(this.level.getDifficulty(), this.level.getLevelData().isDifficultyLocked()));
+ PlayerList playerlist = this.server.getPlayerList();
+
@@ -480,15 +489,12 @@
- worldserver1.getProfiler().push("placing");
+ // CraftBukkit end
this.setLevel(worldserver);
worldserver.addDuringPortalTeleport(this);
- this.setRot(shapedetectorshape.yRot, shapedetectorshape.xRot);
- this.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z);
- this.connection.teleport(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
+ this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
+ this.connection.resetPosition(); // CraftBukkit - sync position after changing it (from PortalTravelAgent#findAndteleport)
this.connection.resetPosition();
worldserver.addDuringPortalTeleport(this);
worldserver1.getProfiler().pop();
this.triggerDimensionChangeTriggers(worldserver1);
this.connection.send(new PacketPlayOutAbilities(this.getAbilities()));
@@ -820,39 +1070,66 @@
@@ -843,39 +1093,66 @@
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
@@ -561,7 +567,7 @@
}
return optional1;
@@ -862,13 +1139,21 @@
@@ -885,13 +1162,21 @@
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
ResourceKey<World> resourcekey = worldserver.dimension();
ResourceKey<World> resourcekey1 = this.level.dimension();
@@ -586,7 +592,7 @@
this.enteredNetherPosition = null;
}
@@ -885,12 +1170,10 @@
@@ -908,12 +1193,10 @@
this.containerMenu.broadcastChanges();
}
@@ -602,7 +608,7 @@
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
} else if (!this.bedInRange(blockposition, enumdirection)) {
return Either.left(EntityHuman.EnumBedResult.TOO_FAR_AWAY);
@@ -914,7 +1197,36 @@
@@ -937,7 +1220,36 @@
}
}
@@ -640,7 +646,7 @@
this.awardStat(StatisticList.SLEEP_IN_BED);
CriterionTriggers.SLEPT_IN_BED.trigger(this);
});
@@ -927,9 +1239,8 @@
@@ -950,9 +1262,8 @@
return either;
}
}
@@ -651,7 +657,7 @@
}
@Override
@@ -956,6 +1267,24 @@
@@ -979,6 +1290,24 @@
@Override
public void stopSleepInBed(boolean flag, boolean flag1) {
@@ -676,7 +682,7 @@
if (this.isSleeping()) {
this.getLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2));
}
@@ -1037,8 +1366,9 @@
@@ -1060,8 +1389,9 @@
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos()));
}
@@ -687,7 +693,7 @@
}
@Override
@@ -1046,13 +1376,35 @@
@@ -1069,13 +1399,35 @@
if (itileinventory == null) {
return OptionalInt.empty();
} else {
@@ -723,7 +729,7 @@
if (container == null) {
if (this.isSpectator()) {
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
@@ -1060,9 +1412,11 @@
@@ -1083,9 +1435,11 @@
return OptionalInt.empty();
} else {
@@ -737,7 +743,7 @@
return OptionalInt.of(this.containerCounter);
}
}
@@ -1075,13 +1429,24 @@
@@ -1098,13 +1452,24 @@
@Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@@ -764,7 +770,7 @@
this.initMenu(this.containerMenu);
}
@@ -1104,6 +1469,7 @@
@@ -1127,6 +1492,7 @@
@Override
public void closeContainer() {
@@ -772,7 +778,7 @@
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
this.doCloseContainer();
}
@@ -1133,7 +1499,7 @@
@@ -1157,7 +1523,7 @@
@Override
public void awardStat(Statistic<?> statistic, int i) {
this.stats.increment(this, statistic, i);
@@ -781,7 +787,7 @@
scoreboardscore.add(i);
});
}
@@ -1141,7 +1507,7 @@
@@ -1165,7 +1531,7 @@
@Override
public void resetStat(Statistic<?> statistic) {
this.stats.setValue(this, statistic, 0);
@@ -790,7 +796,7 @@
}
@Override
@@ -1157,7 +1523,7 @@
@@ -1181,7 +1547,7 @@
for (int j = 0; j < i; ++j) {
MinecraftKey minecraftkey = aminecraftkey1[j];
@@ -799,7 +805,7 @@
Objects.requireNonNull(list);
optional.ifPresent(list::add);
@@ -1192,6 +1558,7 @@
@@ -1216,6 +1582,7 @@
public void resetSentInfo() {
this.lastSentHealth = -1.0E8F;
@@ -807,7 +813,7 @@
}
@Override
@@ -1247,7 +1614,7 @@
@@ -1274,7 +1641,7 @@
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
@@ -816,7 +822,7 @@
this.seenCredits = entityplayer.seenCredits;
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
@@ -1390,7 +1757,20 @@
@@ -1415,7 +1782,20 @@
return s;
}
@@ -837,16 +843,16 @@
this.chatVisibility = packetplayinsettings.chatVisibility();
this.canChatColor = packetplayinsettings.chatColors();
this.textFilteringEnabled = packetplayinsettings.textFilteringEnabled();
@@ -1461,7 +1841,7 @@
@@ -1486,7 +1866,7 @@
this.camera = (Entity) (entity == null ? this : entity);
if (entity1 != this.camera) {
this.connection.send(new PacketPlayOutCamera(this.camera));
- this.teleportTo(this.camera.getX(), this.camera.getY(), this.camera.getZ());
- this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot());
+ this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit
this.connection.resetPosition();
}
}
@@ -1490,7 +1870,7 @@
@@ -1516,7 +1896,7 @@
@Nullable
public IChatBaseComponent getTabListDisplayName() {
@@ -855,7 +861,7 @@
}
@Override
@@ -1511,9 +1891,16 @@
@@ -1537,9 +1917,16 @@
return this.advancements;
}
@@ -872,7 +878,7 @@
if (worldserver == this.level) {
this.connection.teleport(d0, d1, d2, f, f1);
} else {
@@ -1533,6 +1920,9 @@
@@ -1559,6 +1946,9 @@
this.server.getPlayerList().sendLevelInfo(this, worldserver);
this.server.getPlayerList().sendAllPlayerInfo(this);
}
@@ -882,9 +888,9 @@
}
@@ -1702,4 +2092,146 @@
}
@@ -1743,4 +2133,146 @@
public RemoteChatSession getChatSession() {
return this.chatSession;
}
+
+ // CraftBukkit start - Add per-player time and weather.

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/EntityTrackerEntry.java
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
@@ -40,6 +40,12 @@
@@ -42,6 +42,12 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -13,10 +13,10 @@
public class EntityTrackerEntry {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -59,8 +65,12 @@
private List<Entity> lastPassengers;
private boolean wasRiding;
@@ -63,8 +69,12 @@
private boolean wasOnGround;
@Nullable
private List<DataWatcher.b<?>> trackedDataValues;
+ // CraftBukkit start
+ private final Set<ServerPlayerConnection> trackedPlayers;
@@ -27,7 +27,7 @@
this.ap = Vec3D.ZERO;
this.lastPassengers = Collections.emptyList();
this.level = worldserver;
@@ -80,7 +90,7 @@
@@ -85,7 +95,7 @@
if (!list.equals(this.lastPassengers)) {
this.lastPassengers = list;
@@ -36,7 +36,7 @@
}
Entity entity = this.entity;
@@ -88,18 +98,18 @@
@@ -93,18 +103,18 @@
if (entity instanceof EntityItemFrame) {
EntityItemFrame entityitemframe = (EntityItemFrame) entity;
@@ -59,7 +59,7 @@
worldmap.tickCarriedBy(entityplayer, itemstack);
Packet<?> packet = worldmap.getUpdatePacket(integer, entityplayer);
@@ -204,7 +214,27 @@
@@ -209,7 +219,27 @@
++this.tickCount;
if (this.entity.hurtMarked) {
@@ -88,7 +88,7 @@
this.entity.hurtMarked = false;
}
@@ -219,13 +249,16 @@
@@ -224,13 +254,16 @@
PlayerConnection playerconnection = entityplayer.connection;
Objects.requireNonNull(entityplayer.connection);
@@ -107,8 +107,8 @@
+ // CraftBukkit end
}
Packet<?> packet = this.entity.getAddEntityPacket();
@@ -241,6 +274,12 @@
Packet<PacketListenerPlayOut> packet = this.entity.getAddEntityPacket();
@@ -246,6 +279,12 @@
if (this.entity instanceof EntityLiving) {
Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributes().getSyncableAttributes();
@@ -121,7 +121,7 @@
if (!collection.isEmpty()) {
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
}
@@ -272,8 +311,14 @@
@@ -277,8 +316,14 @@
if (!list.isEmpty()) {
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
}
@@ -136,7 +136,7 @@
if (this.entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) this.entity;
Iterator iterator = entityliving.getActiveEffects().iterator();
@@ -314,6 +359,11 @@
@@ -321,6 +366,11 @@
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getDirtyAttributes();
if (!set.isEmpty()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/PlayerChunkMap.java
+++ b/net/minecraft/server/level/PlayerChunkMap.java
@@ -103,6 +103,12 @@
@@ -106,6 +106,12 @@
import org.apache.commons.lang3.mutable.MutableObject;
import org.slf4j.Logger;
@@ -13,7 +13,7 @@
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
@@ -145,6 +151,27 @@
@@ -149,6 +155,27 @@
private final Queue<Runnable> unloadQueue;
int viewDistance;
@@ -41,7 +41,7 @@
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, StructureTemplateManager structuretemplatemanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -163,6 +190,11 @@
@@ -167,6 +194,11 @@
this.storageName = path.getFileName().toString();
this.level = worldserver;
this.generator = chunkgenerator;
@@ -50,10 +50,10 @@
+ chunkgenerator = ((CustomChunkGenerator) chunkgenerator).getDelegate();
+ }
+ // CraftBukkit end
if (chunkgenerator instanceof ChunkGeneratorAbstract) {
ChunkGeneratorAbstract chunkgeneratorabstract = (ChunkGeneratorAbstract) chunkgenerator;
IRegistryCustom iregistrycustom = worldserver.registryAccess();
long j = worldserver.getSeed();
@@ -314,9 +346,12 @@
@@ -326,9 +358,12 @@
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
List<IChunkAccess> list3 = Lists.newArrayList();
@@ -68,7 +68,7 @@
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
if (either == null) {
@@ -521,7 +556,7 @@
@@ -533,7 +568,7 @@
private void scheduleUnload(long i, PlayerChunk playerchunk) {
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
@@ -77,7 +77,7 @@
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
if (completablefuture1 != completablefuture) {
@@ -610,9 +645,9 @@
@@ -622,9 +657,9 @@
ProtoChunk protochunk = ChunkRegionLoader.read(this.level, this.poiManager, chunkcoordintpair, (NBTTagCompound) optional.get());
this.markPosition(chunkcoordintpair, protochunk.getStatus().getChunkType());
@@ -89,7 +89,7 @@
}
}, this.mainThreadExecutor).exceptionallyAsync((throwable) -> {
return this.handleChunkLoadFailure(throwable, chunkcoordintpair);
@@ -718,7 +753,21 @@
@@ -730,7 +765,21 @@
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
if (!list.isEmpty()) {
@@ -112,7 +112,7 @@
}
}
@@ -817,7 +866,7 @@
@@ -829,7 +878,7 @@
if (!playerchunk.wasAccessibleSinceLastSave()) {
return false;
} else {
@@ -121,7 +121,7 @@
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
return false;
@@ -979,7 +1028,8 @@
@@ -991,7 +1040,8 @@
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
});
@@ -131,7 +131,7 @@
return chunk.getBlockEntities().size();
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
return chunk.getBlockTicks().count();
@@ -992,7 +1042,7 @@
@@ -1004,7 +1054,7 @@
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
try {
@@ -140,7 +140,7 @@
return either != null ? (String) either.map((chunk) -> {
return "done";
@@ -1008,12 +1058,14 @@
@@ -1020,12 +1070,14 @@
private CompletableFuture<Optional<NBTTagCompound>> readChunk(ChunkCoordIntPair chunkcoordintpair) {
return this.read(chunkcoordintpair).thenApplyAsync((optional) -> {
@@ -158,7 +158,7 @@
}
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
@@ -1434,7 +1486,7 @@
@@ -1471,7 +1523,7 @@
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
public EntityTracker(Entity entity, int i, int j, boolean flag) {
@@ -167,7 +167,7 @@
this.entity = entity;
this.range = i;
this.lastSectionPos = SectionPosition.of((EntityAccess) entity);
@@ -1493,6 +1545,11 @@
@@ -1530,6 +1582,11 @@
double d2 = d0 * d0;
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(entityplayer);

View File

@@ -28,7 +28,7 @@
public class PlayerInteractManager {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -56,6 +77,13 @@
@@ -56,9 +77,16 @@
if (enumgamemode == this.gameModeForPlayer) {
return false;
} else {
@@ -39,18 +39,13 @@
+ return false;
+ }
+ // CraftBukkit end
this.setGameModeForPlayer(enumgamemode, this.gameModeForPlayer);
this.setGameModeForPlayer(enumgamemode, this.previousGameModeForPlayer);
this.player.onUpdateAbilities();
- this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.a.UPDATE_GAME_MODE, this.player));
+ this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.a.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
this.level.updateSleepingPlayerList();
return true;
}
@@ -66,7 +94,7 @@
this.gameModeForPlayer = enumgamemode;
enumgamemode.updatePlayerAbilities(this.player.getAbilities());
this.player.onUpdateAbilities();
- this.player.server.getPlayerList().broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, new EntityPlayer[]{this.player}));
+ this.player.server.getPlayerList().broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, new EntityPlayer[]{this.player}), this.player); // CraftBukkit
this.level.updateSleepingPlayerList();
}
@@ -88,7 +116,7 @@
}
@@ -179,8 +174,7 @@
+
+ // Sword + Creative mode pre-cancel
+ event.setCancelled(isSwordNoBreak);
- if (!this.player.getMainHandItem().getItem().canAttackBlock(iblockdata, this.level, blockposition, this.player)) {
+
+ // Calculate default block experience
+ IBlockData nmsData = this.level.getBlockState(blockposition);
+ Block nmsBlock = nmsData.getBlock();
@@ -199,7 +193,8 @@
+ }
+ // Let the client know the block still exists
+ this.player.connection.send(new PacketPlayOutBlockChange(this.level, blockposition));
+
- if (!this.player.getMainHandItem().getItem().canAttackBlock(iblockdata, this.level, blockposition, this.player)) {
+ // Brute force all possible updates
+ for (EnumDirection dir : EnumDirection.values()) {
+ this.player.connection.send(new PacketPlayOutBlockChange(level, blockposition.relative(dir)));
@@ -257,20 +252,20 @@
+ // CraftBukkit start
+ if (event.isDropItems()) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, level.captureDrops);
+ }
}
+ level.captureDrops = null;
+
+ // Drop event experience
+ if (flag && event != null) {
+ iblockdata.getBlock().popExperience(this.level, blockposition, event.getExpToDrop());
}
+ }
+
+ return true;
+ // CraftBukkit end
}
}
}
@@ -313,12 +469,52 @@
@@ -313,14 +469,54 @@
}
}
@@ -286,7 +281,9 @@
+ EnumInteractionResult enuminteractionresult = EnumInteractionResult.PASS;
+ boolean cancelledBlock = false;
if (this.gameModeForPlayer == EnumGamemode.SPECTATOR) {
if (!iblockdata.getBlock().isEnabled(world.enabledFeatures())) {
return EnumInteractionResult.FAIL;
} else if (this.gameModeForPlayer == EnumGamemode.SPECTATOR) {
ITileInventory itileinventory = iblockdata.getMenuProvider(world, blockposition);
+ cancelledBlock = !(itileinventory instanceof ITileInventory);
+ }
@@ -323,7 +320,7 @@
if (itileinventory != null) {
entityplayer.openMenu(itileinventory);
@@ -332,7 +528,7 @@
@@ -334,7 +530,7 @@
ItemStack itemstack1 = itemstack.copy();
if (!flag1) {
@@ -332,7 +329,7 @@
if (enuminteractionresult.consumesAction()) {
CriterionTriggers.ITEM_USED_ON_BLOCK.trigger(entityplayer, blockposition, itemstack1);
@@ -340,17 +536,17 @@
@@ -342,17 +538,17 @@
}
}
@@ -353,7 +350,7 @@
}
if (enuminteractionresult1.consumesAction()) {
@@ -358,10 +554,10 @@
@@ -360,10 +556,10 @@
}
return enuminteractionresult1;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/RegionLimitedWorldAccess.java
+++ b/net/minecraft/server/level/RegionLimitedWorldAccess.java
@@ -207,7 +207,7 @@
@@ -208,7 +208,7 @@
if (iblockdata.isAir()) {
return false;
} else {
@@ -9,7 +9,7 @@
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(blockposition) : null;
Block.dropResources(iblockdata, this.level, blockposition, tileentity, entity, ItemStack.EMPTY);
@@ -326,6 +326,13 @@
@@ -327,6 +327,13 @@
@Override
public boolean addFreshEntity(Entity entity) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/WorldServer.java
+++ b/net/minecraft/server/level/WorldServer.java
@@ -153,6 +153,26 @@
@@ -156,6 +156,26 @@
import net.minecraft.world.ticks.TickListServer;
import org.slf4j.Logger;
@@ -27,7 +27,7 @@
public class WorldServer extends World implements GeneratorAccessSeed {
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
@@ -170,7 +190,7 @@
@@ -173,7 +193,7 @@
final List<EntityPlayer> players;
private final ChunkProviderServer chunkSource;
private final MinecraftServer server;
@@ -35,13 +35,13 @@
+ public final WorldDataServer serverLevelData; // CraftBukkit - type
final EntityTickList entityTickList;
public final PersistentEntitySectionManager<Entity> entityManager;
public boolean noSave;
@@ -194,11 +214,28 @@
private final GameEventDispatcher gameEventDispatcher;
@@ -197,11 +217,28 @@
private final StructureCheck structureCheck;
private final boolean tickTime;
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
- Holder holder = worlddimension.typeHolder();
- Holder holder = worlddimension.type();
+ // CraftBukkit start
+ public final Convertable.ConversionSession convertable;
+ public final UUID uuid;
@@ -59,9 +59,9 @@
- super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates());
+ // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, WorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
+ // Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error
+ // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
+ // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
+ super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ super(iworlddataserver, resourcekey, worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ this.pvpMode = minecraftserver.isPvpAllowed();
+ convertable = convertable_conversionsession;
+ uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
@@ -69,7 +69,7 @@
this.players = Lists.newArrayList();
this.entityTickList = new EntityTickList();
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
@@ -213,6 +250,22 @@
@@ -215,6 +252,22 @@
this.customSpawners = list;
this.serverLevelData = iworlddataserver;
ChunkGenerator chunkgenerator = worlddimension.generator();
@@ -77,11 +77,11 @@
+ serverLevelData.setWorld(this);
+
+ if (biomeProvider != null) {
+ WorldChunkManager worldChunkManager = new CustomWorldChunkManager(getWorld(), biomeProvider, server.registryHolder.registryOrThrow(IRegistry.BIOME_REGISTRY));
+ WorldChunkManager worldChunkManager = new CustomWorldChunkManager(getWorld(), biomeProvider, server.registryAccess().registryOrThrow(Registries.BIOME));
+ if (chunkgenerator instanceof ChunkGeneratorAbstract cga) {
+ chunkgenerator = new ChunkGeneratorAbstract(cga.structureSets, cga.noises, worldChunkManager, cga.settings);
+ chunkgenerator = new ChunkGeneratorAbstract(worldChunkManager, cga.settings);
+ } else if (chunkgenerator instanceof ChunkProviderFlat cpf) {
+ chunkgenerator = new ChunkProviderFlat(cpf.structureSets, cpf.settings(), worldChunkManager);
+ chunkgenerator = new ChunkProviderFlat(cpf.settings(), worldChunkManager);
+ }
+ }
+
@@ -92,26 +92,27 @@
boolean flag2 = minecraftserver.forceSynchronousWrites();
DataFixer datafixer = minecraftserver.getFixerUpper();
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
@@ -244,14 +297,15 @@
long l = minecraftserver.getWorldData().worldGenSettings().seed();
@@ -246,15 +299,16 @@
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);
- this.structureManager = new StructureManager(this, minecraftserver.getWorldData().worldGenSettings(), this.structureCheck);
- this.structureManager = new StructureManager(this, minecraftserver.getWorldData().worldGenOptions(), this.structureCheck);
- if (this.dimension() == World.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END)) {
- this.dragonFight = new EnderDragonBattle(this, l, minecraftserver.getWorldData().endDragonFightData());
+ this.structureManager = new StructureManager(this, this.serverLevelData.worldGenSettings(), structureCheck); // CraftBukkit
+ this.structureManager = new StructureManager(this, this.serverLevelData.worldGenOptions(), structureCheck); // CraftBukkit
+ if ((this.dimension() == World.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END)) || env == org.bukkit.World.Environment.THE_END) { // CraftBukkit - Allow to create EnderDragonBattle in default and custom END
+ this.dragonFight = new EnderDragonBattle(this, this.serverLevelData.worldGenSettings().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
+ this.dragonFight = new EnderDragonBattle(this, this.serverLevelData.worldGenOptions().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
} else {
this.dragonFight = null;
}
this.sleepStatus = new SleepStatus();
this.gameEventDispatcher = new GameEventDispatcher(this);
+ this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
}
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
@@ -283,12 +337,20 @@
@@ -286,12 +340,20 @@
long j;
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
@@ -135,7 +136,7 @@
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle();
}
@@ -314,7 +376,7 @@
@@ -317,7 +379,7 @@
this.runBlockEvents();
this.handlingTick = false;
gameprofilerfiller.pop();
@@ -144,7 +145,7 @@
if (flag) {
this.resetEmptyTime();
@@ -330,7 +392,7 @@
@@ -333,7 +395,7 @@
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
@@ -153,7 +154,7 @@
entity.discard();
} else {
gameprofilerfiller.push("checkDespawn");
@@ -404,7 +466,7 @@
@@ -405,7 +467,7 @@
private void wakeUpAllPlayers() {
this.sleepStatus.removeAllSleepers();
@@ -162,24 +163,25 @@
entityplayer.stopSleepInBed(false, false);
});
}
@@ -431,14 +493,14 @@
entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
- this.addFreshEntity(entityhorseskeleton);
+ this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
@@ -433,7 +495,7 @@
entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
- this.addFreshEntity(entityhorseskeleton);
+ this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
}
}
EntityLightning entitylightning = (EntityLightning) EntityTypes.LIGHTNING_BOLT.create(this);
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setVisualOnly(flag1);
- this.addFreshEntity(entitylightning);
+ this.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.WEATHER); // CraftBukkit
@@ -442,7 +504,7 @@
if (entitylightning != null) {
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setVisualOnly(flag1);
- this.addFreshEntity(entitylightning);
+ this.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.WEATHER); // CraftBukkit
}
}
}
@@ -449,12 +511,12 @@
@@ -456,7 +518,7 @@
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value();
if (biomebase.shouldFreeze(this, blockposition1)) {
@@ -188,13 +190,20 @@
}
if (flag) {
if (biomebase.shouldSnow(this, blockposition)) {
- this.setBlockAndUpdate(blockposition, Blocks.SNOW.defaultBlockState());
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit
@@ -471,10 +533,10 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, l + 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
}
}
IBlockData iblockdata = this.getBlockState(blockposition1);
@@ -650,6 +712,7 @@
@@ -671,6 +733,7 @@
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
}
@@ -202,7 +211,7 @@
if (this.oRainLevel != this.rainLevel) {
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
}
@@ -668,14 +731,47 @@
@@ -689,14 +752,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));
}
@@ -252,7 +261,7 @@
}
public void resetEmptyTime() {
@@ -710,6 +806,7 @@
@@ -731,6 +827,7 @@
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
entity.tick();
@@ -260,7 +269,7 @@
this.getProfiler().pop();
Iterator iterator = entity.getPassengers().iterator();
@@ -733,6 +830,7 @@
@@ -754,6 +851,7 @@
});
gameprofilerfiller.incrementCounter("tickPassenger");
entity1.rideTick();
@@ -268,7 +277,7 @@
gameprofilerfiller.pop();
Iterator iterator = entity1.getPassengers().iterator();
@@ -757,6 +855,7 @@
@@ -778,6 +876,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkSource();
if (!flag1) {
@@ -276,7 +285,7 @@
if (iprogressupdate != null) {
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
}
@@ -774,11 +873,19 @@
@@ -795,11 +894,19 @@
}
}
@@ -286,7 +295,7 @@
+
+ serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings());
+ serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save());
+ convertable.saveDataTag(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
+ convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
+ // CraftBukkit end
}
@@ -297,7 +306,7 @@
}
this.getChunkSource().getDataStorage().save();
@@ -824,15 +931,37 @@
@@ -864,15 +971,37 @@
@Override
public boolean addFreshEntity(Entity entity) {
@@ -338,7 +347,7 @@
}
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
@@ -863,24 +992,37 @@
@@ -903,24 +1032,37 @@
this.entityManager.addNewEntity(entityplayer);
}
@@ -380,7 +389,7 @@
return true;
}
}
@@ -894,10 +1036,32 @@
@@ -934,10 +1076,32 @@
entityplayer.remove(entity_removalreason);
}
@@ -413,7 +422,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -906,6 +1070,12 @@
@@ -946,6 +1110,12 @@
double d1 = (double) blockposition.getY() - entityplayer.getY();
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
@@ -426,22 +435,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -942,6 +1112,14 @@
public void gameEvent(GameEvent gameevent, Vec3D vec3d, GameEvent.a gameevent_a) {
int i = gameevent.getNotificationRadius();
BlockPosition blockposition = new BlockPosition(vec3d);
+ // CraftBukkit start
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.GAME_EVENT.getKey(gameevent))), new Location(this.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
+ getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ i = event.getRadius();
+ // CraftBukkit end
int j = SectionPosition.blockToSectionCoord(blockposition.getX() - i);
int k = SectionPosition.blockToSectionCoord(blockposition.getY() - i);
int l = SectionPosition.blockToSectionCoord(blockposition.getZ() - i);
@@ -1014,7 +1192,18 @@
@@ -1005,7 +1175,18 @@
Iterator iterator = this.navigatingMobs.iterator();
while (iterator.hasNext()) {
@@ -461,28 +455,19 @@
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
if (navigationabstract.shouldRecomputePath(blockposition)) {
@@ -1070,10 +1259,20 @@
@@ -1062,6 +1243,11 @@
@Override
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
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);
+ // CraftBukkit start
+ Explosion explosion = super.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, explosion_effect);
+
+ if (explosion.wasCanceled) {
+ return explosion;
+ }
+
+ /* Remove
Explosion explosion = new Explosion(this, entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, explosion_effect);
+ // CraftBukkit end
explosion.explode();
explosion.finalizeExplosion(false);
+ */
+ // CraftBukkit end - TODO: Check if explosions are still properly implemented
if (explosion_effect == Explosion.Effect.NONE) {
if (!explosion.interactsWithBlocks()) {
explosion.clearToBlow();
}
@@ -1145,13 +1344,20 @@
@@ -1134,13 +1320,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) {
@@ -505,16 +490,16 @@
++j;
}
}
@@ -1202,7 +1408,7 @@
@@ -1191,7 +1384,7 @@
@Nullable
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
- if (!this.server.getWorldData().worldGenSettings().generateStructures()) {
+ if (!this.serverLevelData.worldGenSettings().generateStructures()) { // CraftBukkit
- if (!this.server.getWorldData().worldGenOptions().generateStructures()) {
+ if (!this.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
return null;
} else {
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(IRegistry.STRUCTURE_REGISTRY).getTag(tagkey);
@@ -1244,11 +1450,21 @@
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
@@ -1233,11 +1426,21 @@
@Nullable
@Override
public WorldMap getMapData(String s) {
@@ -537,7 +522,7 @@
this.getServer().overworld().getDataStorage().set(s, worldmap);
}
@@ -1546,6 +1762,11 @@
@@ -1535,6 +1738,11 @@
@Override
public void blockUpdated(BlockPosition blockposition, Block block) {
if (!this.isDebug()) {
@@ -549,22 +534,22 @@
this.updateNeighborsAt(blockposition, block);
}
@@ -1565,12 +1786,12 @@
@@ -1554,12 +1762,12 @@
}
public boolean isFlat() {
- return this.server.getWorldData().worldGenSettings().isFlatWorld();
+ return this.serverLevelData.worldGenSettings().isFlatWorld(); // CraftBukkit
- return this.server.getWorldData().isFlatWorld();
+ return this.serverLevelData.isFlatWorld(); // CraftBukkit
}
@Override
public long getSeed() {
- return this.server.getWorldData().worldGenSettings().seed();
+ return this.serverLevelData.worldGenSettings().seed(); // CraftBukkit
- return this.server.getWorldData().worldGenOptions().seed();
+ return this.serverLevelData.worldGenOptions().seed(); // CraftBukkit
}
@Nullable
@@ -1593,7 +1814,7 @@
@@ -1582,7 +1790,7 @@
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
try {
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
@@ -573,7 +558,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1602,7 +1823,7 @@
@@ -1591,7 +1799,7 @@
object2intopenhashmap.addTo(s, 1);
}
@@ -582,7 +567,7 @@
String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue();
@@ -1613,17 +1834,33 @@
@@ -1602,17 +1810,33 @@
}
public static void makeObsidianPlatform(WorldServer worldserver) {
@@ -618,7 +603,7 @@
}
@Override
@@ -1734,6 +1971,7 @@
@@ -1728,6 +1952,7 @@
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
@@ -626,7 +611,7 @@
}
public void onTrackingEnd(Entity entity) {
@@ -1770,6 +2008,14 @@
@@ -1764,6 +1989,14 @@
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);