@@ -12,7 +12,7 @@
|
||||
+
|
||||
public class Main {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Logger LOGGER;
|
||||
@@ -63,8 +69,9 @@
|
||||
public Main() {}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, 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();
|
||||
@@ -329,9 +355,12 @@
|
||||
@@ -291,9 +317,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();
|
||||
@@ -55,7 +55,7 @@
|
||||
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
||||
Optional<IChunkAccess> optional = either.left();
|
||||
|
||||
@@ -501,7 +530,7 @@
|
||||
@@ -463,7 +492,7 @@
|
||||
|
||||
private void scheduleUnload(long i, PlayerChunk playerchunk) {
|
||||
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
|
||||
@@ -64,7 +64,7 @@
|
||||
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
|
||||
|
||||
if (completablefuture1 != completablefuture) {
|
||||
@@ -680,7 +709,21 @@
|
||||
@@ -642,7 +671,21 @@
|
||||
|
||||
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
|
||||
if (!list.isEmpty()) {
|
||||
@@ -87,7 +87,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -778,7 +821,7 @@
|
||||
@@ -740,7 +783,7 @@
|
||||
if (!playerchunk.wasAccessibleSinceLastSave()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
|
||||
return false;
|
||||
@@ -927,7 +970,8 @@
|
||||
@@ -890,7 +933,8 @@
|
||||
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
|
||||
});
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
return chunk.getBlockEntities().size();
|
||||
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
|
||||
return chunk.getBlockTicks().count();
|
||||
@@ -940,7 +984,7 @@
|
||||
@@ -903,7 +947,7 @@
|
||||
|
||||
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
|
||||
try {
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
return either != null ? (String) either.map((chunk) -> {
|
||||
return "done";
|
||||
@@ -958,7 +1002,7 @@
|
||||
@@ -921,7 +965,7 @@
|
||||
private NBTTagCompound readChunk(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
}
|
||||
|
||||
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
|
||||
@@ -1382,7 +1426,7 @@
|
||||
@@ -1342,7 +1386,7 @@
|
||||
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
|
||||
|
||||
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
||||
@@ -133,7 +133,7 @@
|
||||
this.entity = entity;
|
||||
this.range = i;
|
||||
this.lastSectionPos = SectionPosition.of(entity);
|
||||
@@ -1435,12 +1479,17 @@
|
||||
@@ -1395,12 +1439,17 @@
|
||||
|
||||
public void updatePlayer(EntityPlayer entityplayer) {
|
||||
if (entityplayer != this.entity) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -147,6 +147,20 @@
|
||||
@@ -149,6 +149,20 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -164,7 +178,7 @@
|
||||
@@ -166,7 +180,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
@@ -30,7 +30,7 @@
|
||||
final EntityTickList entityTickList;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
public boolean noSave;
|
||||
@@ -186,9 +200,29 @@
|
||||
@@ -189,9 +203,29 @@
|
||||
private final StructureCheck structureCheck;
|
||||
private final boolean tickTime;
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
@@ -200,7 +234,13 @@
|
||||
@@ -203,7 +237,13 @@
|
||||
this.tickTime = flag1;
|
||||
this.server = minecraftserver;
|
||||
this.customSpawners = list;
|
||||
@@ -78,7 +78,7 @@
|
||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
|
||||
@@ -231,14 +271,15 @@
|
||||
@@ -234,14 +274,15 @@
|
||||
long l = minecraftserver.getWorldData().worldGenSettings().seed();
|
||||
|
||||
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this, chunkgenerator.getBiomeSource(), l, datafixer);
|
||||
@@ -96,7 +96,7 @@
|
||||
}
|
||||
|
||||
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
|
||||
@@ -270,12 +311,20 @@
|
||||
@@ -273,12 +314,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
@@ -120,7 +120,7 @@
|
||||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -301,7 +350,7 @@
|
||||
@@ -304,7 +353,7 @@
|
||||
this.runBlockEvents();
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
@@ -129,7 +129,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.resetEmptyTime();
|
||||
@@ -317,7 +366,7 @@
|
||||
@@ -320,7 +369,7 @@
|
||||
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
@@ -138,7 +138,7 @@
|
||||
entity.discard();
|
||||
} else {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
@@ -389,7 +438,7 @@
|
||||
@@ -392,7 +441,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
@@ -147,7 +147,7 @@
|
||||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -416,14 +465,14 @@
|
||||
@@ -419,14 +468,14 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
@@ -164,7 +164,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,12 +483,12 @@
|
||||
@@ -437,12 +486,12 @@
|
||||
BiomeBase biomebase = this.getBiome(blockposition);
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition1)) {
|
||||
@@ -179,7 +179,7 @@
|
||||
}
|
||||
|
||||
IBlockData iblockdata = this.getBlockState(blockposition1);
|
||||
@@ -635,6 +684,7 @@
|
||||
@@ -638,6 +687,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -653,14 +703,47 @@
|
||||
@@ -656,14 +706,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));
|
||||
}
|
||||
@@ -237,7 +237,7 @@
|
||||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -695,6 +778,7 @@
|
||||
@@ -698,6 +781,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
@@ -245,7 +245,7 @@
|
||||
this.getProfiler().pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -718,6 +802,7 @@
|
||||
@@ -721,6 +805,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
@@ -253,7 +253,7 @@
|
||||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -742,6 +827,7 @@
|
||||
@@ -745,6 +830,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
@@ -261,7 +261,7 @@
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(new ChatMessage("menu.savingLevel"));
|
||||
}
|
||||
@@ -759,11 +845,19 @@
|
||||
@@ -762,11 +848,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -282,7 +282,7 @@
|
||||
}
|
||||
|
||||
this.getChunkSource().getDataStorage().save();
|
||||
@@ -809,15 +903,34 @@
|
||||
@@ -812,15 +906,34 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
@@ -320,7 +320,7 @@
|
||||
}
|
||||
|
||||
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
|
||||
@@ -848,24 +961,36 @@
|
||||
@@ -851,24 +964,36 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -879,10 +1004,32 @@
|
||||
@@ -882,10 +1007,32 @@
|
||||
entityplayer.remove(entity_removalreason);
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -891,6 +1038,12 @@
|
||||
@@ -894,6 +1041,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
@@ -407,7 +407,7 @@
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -938,7 +1091,18 @@
|
||||
@@ -948,7 +1101,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -426,8 +426,8 @@
|
||||
+ // CraftBukkit end
|
||||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (!navigationabstract.hasDelayedRecomputation()) {
|
||||
@@ -961,10 +1125,20 @@
|
||||
if (navigationabstract.shouldRecomputePath(blockposition)) {
|
||||
@@ -984,10 +1148,20 @@
|
||||
|
||||
@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) {
|
||||
@@ -448,7 +448,7 @@
|
||||
if (explosion_effect == Explosion.Effect.NONE) {
|
||||
explosion.clearToBlow();
|
||||
}
|
||||
@@ -1045,13 +1219,20 @@
|
||||
@@ -1068,13 +1242,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) {
|
||||
@@ -471,7 +471,7 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1102,7 +1283,7 @@
|
||||
@@ -1125,7 +1306,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapFeature(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
|
||||
@@ -480,7 +480,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1139,11 +1320,21 @@
|
||||
@@ -1162,11 +1343,21 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap getMapData(String s) {
|
||||
@@ -503,7 +503,7 @@
|
||||
this.getServer().overworld().getDataStorage().set(s, worldmap);
|
||||
}
|
||||
|
||||
@@ -1455,6 +1646,11 @@
|
||||
@@ -1478,6 +1669,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
@@ -515,7 +515,7 @@
|
||||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1474,12 +1670,12 @@
|
||||
@@ -1497,12 +1693,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
@@ -530,7 +530,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1507,7 +1703,7 @@
|
||||
@@ -1530,7 +1726,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
@@ -539,7 +539,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1516,7 +1712,7 @@
|
||||
@@ -1539,7 +1735,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
@@ -548,7 +548,7 @@
|
||||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1527,17 +1723,33 @@
|
||||
@@ -1550,17 +1746,33 @@
|
||||
}
|
||||
|
||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||
@@ -584,7 +584,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1632,6 +1844,7 @@
|
||||
@@ -1666,6 +1878,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@
|
||||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1664,6 +1877,14 @@
|
||||
@@ -1707,6 +1920,14 @@
|
||||
gameeventlistenerregistrar.onListenerRemoved(entity.level);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +74,9 @@
|
||||
private int dropSpamTickCount;
|
||||
private double firstGoodX;
|
||||
private double firstGoodY;
|
||||
@@ -201,7 +259,33 @@
|
||||
this.player = entityplayer;
|
||||
@@ -202,7 +260,33 @@
|
||||
entityplayer.connection = this;
|
||||
this.keepAliveTime = SystemUtils.getMillis();
|
||||
entityplayer.getTextFilter().join();
|
||||
+
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
@@ -108,7 +108,7 @@
|
||||
|
||||
public void tick() {
|
||||
this.resetPosition();
|
||||
@@ -250,7 +334,7 @@
|
||||
@@ -251,7 +335,7 @@
|
||||
this.server.getProfiler().push("keepAlive");
|
||||
long i = SystemUtils.getMillis();
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
if (this.keepAlivePending) {
|
||||
this.disconnect(new ChatMessage("disconnect.timeout"));
|
||||
} else {
|
||||
@@ -262,15 +346,21 @@
|
||||
@@ -263,15 +347,21 @@
|
||||
}
|
||||
|
||||
this.server.getProfiler().pop();
|
||||
@@ -139,7 +139,7 @@
|
||||
this.disconnect(new ChatMessage("multiplayer.disconnect.idling"));
|
||||
}
|
||||
|
||||
@@ -294,16 +384,46 @@
|
||||
@@ -295,16 +385,46 @@
|
||||
return this.server.isSingleplayerOwner(this.player.getGameProfile());
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
}
|
||||
|
||||
private <T, R> void filterTextPacket(T t0, Consumer<R> consumer, BiFunction<ITextFilter, T, CompletableFuture<R>> bifunction) {
|
||||
@@ -370,7 +490,34 @@
|
||||
@@ -371,7 +491,34 @@
|
||||
double d9 = entity.getDeltaMovement().lengthSqr();
|
||||
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName().getString(), this.player.getName().getString(), d6, d7, d8);
|
||||
this.connection.send(new PacketPlayOutVehicleMove(entity));
|
||||
return;
|
||||
@@ -400,14 +547,72 @@
|
||||
@@ -401,14 +548,72 @@
|
||||
}
|
||||
|
||||
entity.absMoveTo(d3, d4, d5, f, f1);
|
||||
@@ -296,7 +296,7 @@
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
this.player.checkMovementStatistics(this.player.getX() - d0, this.player.getY() - d1, this.player.getZ() - d2);
|
||||
this.clientVehicleIsFloating = d11 >= -0.03125D && !this.server.isFlightAllowed() && this.noBlocksAround(entity);
|
||||
@@ -426,7 +631,7 @@
|
||||
@@ -427,7 +632,7 @@
|
||||
@Override
|
||||
public void handleAcceptTeleportPacket(PacketPlayInTeleportAccept packetplayinteleportaccept) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinteleportaccept, this, this.player.getLevel());
|
||||
@@ -305,7 +305,7 @@
|
||||
this.player.absMoveTo(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
|
||||
this.lastGoodX = this.awaitingPositionFromClient.x;
|
||||
this.lastGoodY = this.awaitingPositionFromClient.y;
|
||||
@@ -436,6 +641,7 @@
|
||||
@@ -437,6 +642,7 @@
|
||||
}
|
||||
|
||||
this.awaitingPositionFromClient = null;
|
||||
@@ -313,7 +313,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -443,7 +649,7 @@
|
||||
@@ -444,7 +650,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.getLevel());
|
||||
@@ -322,7 +322,7 @@
|
||||
RecipeBookServer recipebookserver = this.player.getRecipeBook();
|
||||
|
||||
Objects.requireNonNull(recipebookserver);
|
||||
@@ -473,6 +679,12 @@
|
||||
@@ -474,6 +680,12 @@
|
||||
@Override
|
||||
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.getLevel());
|
||||
@@ -335,7 +335,7 @@
|
||||
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
@@ -482,6 +694,7 @@
|
||||
@@ -483,6 +695,7 @@
|
||||
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
|
||||
|
||||
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
@@ -343,7 +343,7 @@
|
||||
this.connection.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions));
|
||||
});
|
||||
}
|
||||
@@ -714,6 +927,7 @@
|
||||
@@ -715,6 +928,7 @@
|
||||
|
||||
if (container instanceof ContainerMerchant) {
|
||||
ContainerMerchant containermerchant = (ContainerMerchant) container;
|
||||
@@ -351,7 +351,7 @@
|
||||
|
||||
containermerchant.setSelectionHint(i);
|
||||
containermerchant.tryMoveItems(i);
|
||||
@@ -723,6 +937,13 @@
|
||||
@@ -724,6 +938,13 @@
|
||||
|
||||
@Override
|
||||
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
|
||||
@@ -365,7 +365,7 @@
|
||||
int i = packetplayinbedit.getSlot();
|
||||
|
||||
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
|
||||
@@ -731,7 +952,7 @@
|
||||
@@ -732,7 +953,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -374,7 +374,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
stream.forEach(list::add);
|
||||
@@ -747,7 +968,7 @@
|
||||
@@ -748,7 +969,7 @@
|
||||
ItemStack itemstack = this.player.getInventory().getItem(i);
|
||||
|
||||
if (itemstack.is(Items.WRITABLE_BOOK)) {
|
||||
@@ -383,7 +383,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,16 +993,16 @@
|
||||
@@ -773,16 +994,16 @@
|
||||
|
||||
this.updateBookPages(list, (s) -> {
|
||||
return IChatBaseComponent.ChatSerializer.toJson(new ChatComponentText(s));
|
||||
@@ -404,7 +404,7 @@
|
||||
return NBTTagString.valueOf((String) unaryoperator.apply(itextfilter_a.getFiltered()));
|
||||
});
|
||||
|
||||
@@ -809,6 +1030,7 @@
|
||||
@@ -810,6 +1031,7 @@
|
||||
}
|
||||
|
||||
itemstack.addTagElement("pages", nbttaglist);
|
||||
@@ -412,7 +412,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -845,7 +1067,7 @@
|
||||
@@ -846,7 +1068,7 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
|
||||
@@ -421,7 +421,7 @@
|
||||
if (this.tickCount == 0) {
|
||||
this.resetPosition();
|
||||
}
|
||||
@@ -855,7 +1077,7 @@
|
||||
@@ -856,7 +1078,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
|
||||
}
|
||||
@@ -430,7 +430,7 @@
|
||||
} else {
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX()));
|
||||
@@ -867,7 +1089,15 @@
|
||||
@@ -868,7 +1090,15 @@
|
||||
if (this.player.isPassenger()) {
|
||||
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
@@ -446,7 +446,7 @@
|
||||
double d3 = this.player.getX();
|
||||
double d4 = this.player.getY();
|
||||
double d5 = this.player.getZ();
|
||||
@@ -887,15 +1117,33 @@
|
||||
@@ -888,15 +1118,33 @@
|
||||
++this.receivedMovePacketCount;
|
||||
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
|
||||
|
||||
@@ -482,7 +482,7 @@
|
||||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d7, d8, d9);
|
||||
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
||||
return;
|
||||
@@ -914,6 +1162,7 @@
|
||||
@@ -915,6 +1163,7 @@
|
||||
}
|
||||
|
||||
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
|
||||
@@ -490,7 +490,7 @@
|
||||
double d12 = d8;
|
||||
|
||||
d7 = d0 - this.player.getX();
|
||||
@@ -935,7 +1184,71 @@
|
||||
@@ -936,7 +1185,71 @@
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag1 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb))) {
|
||||
this.teleport(d3, d4, d5, f, f1);
|
||||
} else {
|
||||
@@ -563,7 +563,7 @@
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
|
||||
this.player.setOnGround(packetplayinflying.isOnGround());
|
||||
@@ -973,19 +1286,80 @@
|
||||
@@ -974,19 +1287,80 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@
|
||||
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.getX() : 0.0D;
|
||||
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.getY() : 0.0D;
|
||||
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.getZ() : 0.0D;
|
||||
@@ -997,6 +1371,14 @@
|
||||
@@ -998,6 +1372,14 @@
|
||||
this.awaitingTeleport = 0;
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag));
|
||||
@@ -1005,6 +1387,7 @@
|
||||
@@ -1006,6 +1388,7 @@
|
||||
@Override
|
||||
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.getLevel());
|
||||
@@ -671,7 +671,7 @@
|
||||
BlockPosition blockposition = packetplayinblockdig.getPos();
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
@@ -1015,14 +1398,46 @@
|
||||
@@ -1016,14 +1399,46 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
|
||||
|
||||
@@ -720,7 +720,7 @@
|
||||
this.player.drop(false);
|
||||
}
|
||||
|
||||
@@ -1059,6 +1474,7 @@
|
||||
@@ -1060,6 +1475,7 @@
|
||||
@Override
|
||||
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.getLevel());
|
||||
@@ -728,7 +728,7 @@
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
EnumHand enumhand = packetplayinuseitem.getHand();
|
||||
ItemStack itemstack = this.player.getItemInHand(enumhand);
|
||||
@@ -1071,6 +1487,14 @@
|
||||
@@ -1072,6 +1488,14 @@
|
||||
|
||||
if (blockposition.getY() < i) {
|
||||
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
|
||||
@@ -743,7 +743,7 @@
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) {
|
||||
@@ -1094,12 +1518,51 @@
|
||||
@@ -1095,12 +1519,51 @@
|
||||
@Override
|
||||
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.getLevel());
|
||||
@@ -795,7 +795,7 @@
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
|
||||
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1120,7 +1583,7 @@
|
||||
@@ -1121,7 +1584,7 @@
|
||||
Entity entity = packetplayinspectate.getEntity(worldserver);
|
||||
|
||||
if (entity != null) {
|
||||
@@ -804,7 +804,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1135,6 +1598,7 @@
|
||||
@@ -1136,6 +1599,7 @@
|
||||
PlayerConnection.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
|
||||
this.disconnect(new ChatMessage("multiplayer.requiredTexturePrompt.disconnect"));
|
||||
}
|
||||
@@ -812,7 +812,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1154,11 +1618,26 @@
|
||||
@@ -1155,11 +1619,26 @@
|
||||
|
||||
@Override
|
||||
public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
|
||||
@@ -840,7 +840,7 @@
|
||||
this.player.getTextFilter().leave();
|
||||
if (this.isSingleplayerOwner()) {
|
||||
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
|
||||
@@ -1173,6 +1652,15 @@
|
||||
@@ -1174,6 +1653,15 @@
|
||||
}
|
||||
|
||||
public void send(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
|
||||
@@ -856,7 +856,7 @@
|
||||
try {
|
||||
this.connection.send(packet, genericfuturelistener);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -1189,7 +1677,16 @@
|
||||
@@ -1190,7 +1678,16 @@
|
||||
@Override
|
||||
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.getLevel());
|
||||
@@ -873,7 +873,7 @@
|
||||
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
|
||||
this.player.stopUsingItem();
|
||||
}
|
||||
@@ -1198,11 +1695,18 @@
|
||||
@@ -1199,11 +1696,18 @@
|
||||
this.player.resetLastActionTime();
|
||||
} else {
|
||||
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
@@ -892,7 +892,7 @@
|
||||
String s = StringUtils.normalizeSpace(packetplayinchat.getMessage());
|
||||
|
||||
for (int i = 0; i < s.length(); ++i) {
|
||||
@@ -1216,20 +1720,42 @@
|
||||
@@ -1217,20 +1721,42 @@
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinchat, this, this.player.getLevel());
|
||||
this.handleChat(ITextFilter.a.passThrough(s));
|
||||
} else {
|
||||
@@ -939,7 +939,7 @@
|
||||
} else {
|
||||
String s1 = itextfilter_a.getFiltered();
|
||||
ChatMessage chatmessage = s1.isEmpty() ? null : new ChatMessage("chat.type.text", new Object[]{this.player.getDisplayName(), s1});
|
||||
@@ -1240,28 +1766,198 @@
|
||||
@@ -1241,28 +1767,198 @@
|
||||
}, ChatMessageType.CHAT, this.player.getUUID());
|
||||
}
|
||||
|
||||
@@ -1142,7 +1142,7 @@
|
||||
this.player.resetLastActionTime();
|
||||
IJumpable ijumpable;
|
||||
|
||||
@@ -1319,6 +2015,7 @@
|
||||
@@ -1320,6 +2016,7 @@
|
||||
@Override
|
||||
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.getLevel());
|
||||
@@ -1150,7 +1150,7 @@
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
final Entity entity = packetplayinuseentity.getTarget(worldserver);
|
||||
|
||||
@@ -1333,10 +2030,44 @@
|
||||
@@ -1334,10 +2031,44 @@
|
||||
|
||||
if (this.player.distanceToSqr(entity) < 36.0D) {
|
||||
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
|
||||
@@ -1196,7 +1196,7 @@
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack, entity);
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1348,20 +2079,27 @@
|
||||
@@ -1349,20 +2080,27 @@
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand) {
|
||||
@@ -1227,7 +1227,7 @@
|
||||
} else {
|
||||
PlayerConnection.this.disconnect(new ChatMessage("multiplayer.disconnect.invalid_entity_attacked"));
|
||||
PlayerConnection.LOGGER.warn("Player {} tried to attack an invalid entity", PlayerConnection.this.player.getName().getString());
|
||||
@@ -1406,21 +2144,304 @@
|
||||
@@ -1407,21 +2145,304 @@
|
||||
@Override
|
||||
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.getLevel());
|
||||
@@ -1535,7 +1535,7 @@
|
||||
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -1455,6 +2476,7 @@
|
||||
@@ -1456,6 +2477,7 @@
|
||||
@Override
|
||||
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.getLevel());
|
||||
@@ -1543,7 +1543,7 @@
|
||||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) {
|
||||
this.player.containerMenu.clickMenuButton(this.player, packetplayinenchantitem.getButtonId());
|
||||
@@ -1482,6 +2504,43 @@
|
||||
@@ -1483,6 +2505,43 @@
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
||||
@@ -1587,7 +1587,7 @@
|
||||
|
||||
if (flag1 && flag2) {
|
||||
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).set(itemstack);
|
||||
@@ -1504,6 +2563,7 @@
|
||||
@@ -1505,6 +2564,7 @@
|
||||
}
|
||||
|
||||
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<ITextFilter.a> list) {
|
||||
@@ -1595,7 +1595,7 @@
|
||||
this.player.resetLastActionTime();
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
BlockPosition blockposition = packetplayinupdatesign.getPos();
|
||||
@@ -1520,18 +2580,37 @@
|
||||
@@ -1521,18 +2581,37 @@
|
||||
|
||||
if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) {
|
||||
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());
|
||||
@@ -1635,7 +1635,7 @@
|
||||
|
||||
tileentitysign.setChanged();
|
||||
worldserver.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
|
||||
@@ -1541,6 +2620,7 @@
|
||||
@@ -1542,6 +2621,7 @@
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(PacketPlayInKeepAlive packetplayinkeepalive) {
|
||||
@@ -1643,7 +1643,7 @@
|
||||
if (this.keepAlivePending && packetplayinkeepalive.getId() == this.keepAliveChallenge) {
|
||||
int i = (int) (SystemUtils.getMillis() - this.keepAliveTime);
|
||||
|
||||
@@ -1555,7 +2635,17 @@
|
||||
@@ -1556,7 +2636,17 @@
|
||||
@Override
|
||||
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.getLevel());
|
||||
@@ -1662,7 +1662,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1564,8 +2654,50 @@
|
||||
@@ -1565,8 +2655,50 @@
|
||||
this.player.updateOptions(packetplayinsettings);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user