@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -140,6 +140,36 @@
|
||||
@@ -141,6 +141,36 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
public class EntityPlayer extends EntityHuman {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -187,6 +217,20 @@
|
||||
@@ -188,6 +218,20 @@
|
||||
public int latency;
|
||||
public boolean wonGame;
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
|
||||
super(worldserver, worldserver.getSpawn(), worldserver.x(), gameprofile);
|
||||
this.chatVisibility = EnumChatVisibility.FULL;
|
||||
@@ -253,12 +297,56 @@
|
||||
@@ -249,12 +293,56 @@
|
||||
this.advancements = minecraftserver.getPlayerList().f(this);
|
||||
this.maxUpStep = 1.0F;
|
||||
this.d(worldserver);
|
||||
@@ -116,7 +116,7 @@
|
||||
int i = Math.max(0, this.server.a(worldserver));
|
||||
int j = MathHelper.floor(worldserver.getWorldBorder().b((double) blockposition.getX(), (double) blockposition.getZ()));
|
||||
|
||||
@@ -316,11 +404,20 @@
|
||||
@@ -312,11 +400,20 @@
|
||||
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
|
||||
this.recipeBook.a(nbttagcompound.getCompound("recipeBook"), this.server.getCraftingManager());
|
||||
}
|
||||
@@ -137,7 +137,7 @@
|
||||
if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) {
|
||||
this.respawnPosition = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
|
||||
this.respawnForced = nbttagcompound.getBoolean("SpawnForced");
|
||||
@@ -353,7 +450,20 @@
|
||||
@@ -349,7 +446,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -371,7 +481,7 @@
|
||||
@@ -367,7 +477,7 @@
|
||||
nbttagcompound.setInt("SpawnZ", this.respawnPosition.getZ());
|
||||
nbttagcompound.setBoolean("SpawnForced", this.respawnForced);
|
||||
nbttagcompound.setFloat("SpawnAngle", this.respawnAngle);
|
||||
@@ -168,7 +168,7 @@
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -379,9 +489,33 @@
|
||||
@@ -375,9 +485,33 @@
|
||||
nbttagcompound.set("SpawnDimension", nbtbase);
|
||||
});
|
||||
}
|
||||
@@ -202,7 +202,7 @@
|
||||
public void a(int i) {
|
||||
float f = (float) this.getExpToLevel();
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -440,6 +574,11 @@
|
||||
@@ -436,6 +570,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -214,7 +214,7 @@
|
||||
this.gameMode.a();
|
||||
--this.spawnInvulnerableTime;
|
||||
if (this.invulnerableTime > 0) {
|
||||
@@ -493,7 +632,7 @@
|
||||
@@ -489,7 +628,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
|
||||
@@ -223,7 +223,7 @@
|
||||
this.lastSentHealth = this.getHealth();
|
||||
this.lastSentFood = this.foodData.getFoodLevel();
|
||||
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -524,6 +663,12 @@
|
||||
@@ -520,6 +659,12 @@
|
||||
this.a(IScoreboardCriteria.EXPERIENCE, MathHelper.f((float) this.lastRecordedExperience));
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@
|
||||
if (this.experienceLevel != this.lastRecordedLevel) {
|
||||
this.lastRecordedLevel = this.experienceLevel;
|
||||
this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.lastRecordedLevel));
|
||||
@@ -538,6 +683,16 @@
|
||||
@@ -534,6 +679,16 @@
|
||||
CriterionTriggers.LOCATION.a(this);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
|
||||
@@ -548,7 +703,8 @@
|
||||
@@ -544,7 +699,8 @@
|
||||
}
|
||||
|
||||
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
@@ -263,7 +263,7 @@
|
||||
scoreboardscore.setScore(i);
|
||||
});
|
||||
}
|
||||
@@ -556,9 +712,46 @@
|
||||
@@ -552,9 +708,46 @@
|
||||
@Override
|
||||
public void die(DamageSource damagesource) {
|
||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
@@ -312,9 +312,9 @@
|
||||
|
||||
this.connection.a((Packet) (new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent)), (future) -> {
|
||||
if (!future.isSuccess()) {
|
||||
@@ -592,12 +785,18 @@
|
||||
@@ -588,12 +781,18 @@
|
||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
this.fH();
|
||||
this.fI();
|
||||
}
|
||||
-
|
||||
- if (!this.isSpectator()) {
|
||||
@@ -335,7 +335,7 @@
|
||||
EntityLiving entityliving = this.getKillingEntity();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -634,10 +833,12 @@
|
||||
@@ -630,10 +829,12 @@
|
||||
String s = this.getName();
|
||||
String s1 = entity.getName();
|
||||
|
||||
@@ -350,7 +350,7 @@
|
||||
} else {
|
||||
this.a(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -655,7 +856,8 @@
|
||||
@@ -651,7 +852,8 @@
|
||||
int i = scoreboardteam.getColor().b();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
@@ -360,7 +360,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -699,18 +901,20 @@
|
||||
@@ -695,18 +897,20 @@
|
||||
}
|
||||
|
||||
private boolean canPvP() {
|
||||
@@ -384,7 +384,7 @@
|
||||
} else {
|
||||
return shapedetectorshape;
|
||||
}
|
||||
@@ -719,11 +923,20 @@
|
||||
@@ -715,11 +919,20 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity b(WorldServer worldserver) {
|
||||
@@ -408,7 +408,7 @@
|
||||
this.decouple();
|
||||
this.getWorldServer().a(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
if (!this.wonGame) {
|
||||
@@ -734,6 +947,8 @@
|
||||
@@ -730,6 +943,8 @@
|
||||
|
||||
return this;
|
||||
} else {
|
||||
@@ -417,7 +417,7 @@
|
||||
WorldData worlddata = worldserver.getWorldData();
|
||||
|
||||
this.connection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.gameMode.getGameMode(), this.gameMode.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
|
||||
@@ -743,22 +958,52 @@
|
||||
@@ -739,22 +954,52 @@
|
||||
playerlist.d(this);
|
||||
worldserver1.a(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
@@ -476,7 +476,7 @@
|
||||
worldserver1.getMethodProfiler().exit();
|
||||
this.triggerDimensionAdvancements(worldserver1);
|
||||
this.connection.sendPacket(new PacketPlayOutAbilities(this.getAbilities()));
|
||||
@@ -776,12 +1021,31 @@
|
||||
@@ -772,12 +1017,31 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
@@ -508,7 +508,7 @@
|
||||
private void a(WorldServer worldserver, BlockPosition blockposition) {
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
|
||||
|
||||
@@ -798,17 +1062,17 @@
|
||||
@@ -794,17 +1058,17 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -531,7 +531,7 @@
|
||||
}
|
||||
|
||||
return optional1;
|
||||
@@ -818,13 +1082,21 @@
|
||||
@@ -814,13 +1078,21 @@
|
||||
public void triggerDimensionAdvancements(WorldServer worldserver) {
|
||||
ResourceKey<World> resourcekey = worldserver.getDimensionKey();
|
||||
ResourceKey<World> resourcekey1 = this.level.getDimensionKey();
|
||||
@@ -556,7 +556,7 @@
|
||||
this.enteredNetherPosition = null;
|
||||
}
|
||||
|
||||
@@ -852,10 +1124,8 @@
|
||||
@@ -848,10 +1120,8 @@
|
||||
this.containerMenu.d();
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@
|
||||
if (!this.isSleeping() && this.isAlive()) {
|
||||
if (!this.level.getDimensionManager().isNatural()) {
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
|
||||
@@ -881,7 +1151,36 @@
|
||||
@@ -877,7 +1147,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,7 +607,7 @@
|
||||
this.a(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.SLEPT_IN_BED.a(this);
|
||||
});
|
||||
@@ -894,9 +1193,8 @@
|
||||
@@ -890,9 +1189,8 @@
|
||||
return either;
|
||||
}
|
||||
}
|
||||
@@ -618,7 +618,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -923,6 +1221,24 @@
|
||||
@@ -919,6 +1217,24 @@
|
||||
|
||||
@Override
|
||||
public void wakeup(boolean flag, boolean flag1) {
|
||||
@@ -643,7 +643,7 @@
|
||||
if (this.isSleeping()) {
|
||||
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -1004,8 +1320,9 @@
|
||||
@@ -1000,8 +1316,9 @@
|
||||
this.connection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||
}
|
||||
|
||||
@@ -654,7 +654,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1020,6 +1337,24 @@
|
||||
@@ -1016,6 +1333,24 @@
|
||||
this.nextContainerCounter();
|
||||
Container container = itileinventory.createMenu(this.containerCounter, this.getInventory(), this);
|
||||
|
||||
@@ -679,7 +679,7 @@
|
||||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
|
||||
@@ -1027,9 +1362,11 @@
|
||||
@@ -1023,9 +1358,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@@ -693,7 +693,7 @@
|
||||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -1042,13 +1379,24 @@
|
||||
@@ -1038,13 +1375,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
@@ -720,7 +720,7 @@
|
||||
this.initMenu(this.containerMenu);
|
||||
}
|
||||
|
||||
@@ -1072,6 +1420,7 @@
|
||||
@@ -1068,6 +1416,7 @@
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@@ -728,7 +728,7 @@
|
||||
this.connection.sendPacket(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
||||
this.o();
|
||||
}
|
||||
@@ -1101,7 +1450,7 @@
|
||||
@@ -1097,7 +1446,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic, int i) {
|
||||
this.stats.b(this, statistic, i);
|
||||
@@ -737,7 +737,7 @@
|
||||
scoreboardscore.addScore(i);
|
||||
});
|
||||
}
|
||||
@@ -1109,7 +1458,7 @@
|
||||
@@ -1105,7 +1454,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic) {
|
||||
this.stats.setStatistic(this, statistic, 0);
|
||||
@@ -746,7 +746,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1125,7 +1474,7 @@
|
||||
@@ -1121,7 +1470,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
MinecraftKey minecraftkey = aminecraftkey1[j];
|
||||
@@ -755,7 +755,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -1160,7 +1509,16 @@
|
||||
@@ -1156,7 +1505,16 @@
|
||||
|
||||
public void triggerHealthUpdate() {
|
||||
this.lastSentHealth = -1.0E8F;
|
||||
@@ -772,7 +772,7 @@
|
||||
|
||||
@Override
|
||||
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
@@ -1215,11 +1573,12 @@
|
||||
@@ -1211,11 +1569,12 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
@@ -786,7 +786,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1341,7 +1700,20 @@
|
||||
@@ -1337,7 +1696,20 @@
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -807,7 +807,7 @@
|
||||
this.chatVisibility = packetplayinsettings.d();
|
||||
this.canChatColor = packetplayinsettings.e();
|
||||
this.textFilteringEnabled = packetplayinsettings.h();
|
||||
@@ -1411,7 +1783,7 @@
|
||||
@@ -1407,7 +1779,7 @@
|
||||
this.camera = (Entity) (entity == null ? this : entity);
|
||||
if (entity1 != this.camera) {
|
||||
this.connection.sendPacket(new PacketPlayOutCamera(this.camera));
|
||||
@@ -816,7 +816,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1440,7 +1812,7 @@
|
||||
@@ -1436,7 +1808,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getPlayerListName() {
|
||||
@@ -825,7 +825,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1461,9 +1833,16 @@
|
||||
@@ -1457,9 +1829,16 @@
|
||||
return this.advancements;
|
||||
}
|
||||
|
||||
@@ -842,7 +842,7 @@
|
||||
if (worldserver == this.level) {
|
||||
this.connection.b(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1483,6 +1862,9 @@
|
||||
@@ -1479,6 +1858,9 @@
|
||||
this.server.getPlayerList().a(this, worldserver);
|
||||
this.server.getPlayerList().updateClient(this);
|
||||
}
|
||||
@@ -852,9 +852,9 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1628,4 +2010,144 @@
|
||||
CriterionTriggers.USING_ITEM.a(this, itemstack);
|
||||
super.a(itemstack);
|
||||
@@ -1634,4 +2016,144 @@
|
||||
});
|
||||
return this.a(itemstack, false, true) != null;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - Add per-player time and weather.
|
||||
|
||||
Reference in New Issue
Block a user