mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-17 21:33:49 -07:00
@@ -83,7 +83,7 @@
|
||||
+ }
|
||||
+
|
||||
+ int k = (i * 2 + 1) * (i * 2 + 1);
|
||||
+ int l = this.s(k);
|
||||
+ int l = this.t(k);
|
||||
+ int i1 = (new Random()).nextInt(k);
|
||||
+
|
||||
+ for (int j1 = 0; j1 < k; ++j1) {
|
||||
@@ -105,15 +105,15 @@
|
||||
private void a(WorldServer worldserver) {
|
||||
BlockPosition blockposition = worldserver.getSpawn();
|
||||
|
||||
@@ -131,6 +208,7 @@
|
||||
@@ -133,6 +210,7 @@
|
||||
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
|
||||
this.recipeBook.a(nbttagcompound.getCompound("recipeBook"));
|
||||
}
|
||||
+ this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
|
||||
|
||||
if (this.isSleeping()) {
|
||||
this.dy();
|
||||
@@ -155,7 +233,20 @@
|
||||
this.dz();
|
||||
@@ -157,7 +235,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
@@ -135,13 +135,13 @@
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -166,7 +257,33 @@
|
||||
@@ -168,8 +259,34 @@
|
||||
}
|
||||
|
||||
nbttagcompound.set("recipeBook", this.recipeBook.save());
|
||||
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - World fallback code, either respawn location or global spawn
|
||||
+ public void spawnIn(World world) {
|
||||
+ super.spawnIn(world);
|
||||
@@ -164,12 +164,13 @@
|
||||
+ }
|
||||
+ this.dimension = ((WorldServer) this.world).getWorldProvider().getDimensionManager();
|
||||
+ this.playerInteractManager.a((WorldServer) world);
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public void a(int i) {
|
||||
float f = (float) this.getExpToLevel();
|
||||
@@ -221,6 +338,11 @@
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -223,6 +340,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -181,7 +182,7 @@
|
||||
this.playerInteractManager.a();
|
||||
--this.invulnerableTicks;
|
||||
if (this.noDamageTicks > 0) {
|
||||
@@ -288,7 +410,7 @@
|
||||
@@ -290,7 +412,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastSentSaturationZero) {
|
||||
@@ -190,7 +191,7 @@
|
||||
this.lastHealthSent = this.getHealth();
|
||||
this.lastFoodSent = this.foodData.getFoodLevel();
|
||||
this.lastSentSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -319,6 +441,12 @@
|
||||
@@ -321,6 +443,12 @@
|
||||
this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.lastExpTotalScored));
|
||||
}
|
||||
|
||||
@@ -203,7 +204,7 @@
|
||||
if (this.expLevel != this.lastExpLevelScored) {
|
||||
this.lastExpLevelScored = this.expLevel;
|
||||
this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.lastExpLevelScored));
|
||||
@@ -333,6 +461,16 @@
|
||||
@@ -335,6 +463,16 @@
|
||||
CriterionTriggers.p.a(this);
|
||||
}
|
||||
|
||||
@@ -220,7 +221,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
|
||||
@@ -343,7 +481,8 @@
|
||||
@@ -345,7 +483,8 @@
|
||||
}
|
||||
|
||||
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
@@ -230,16 +231,16 @@
|
||||
scoreboardscore.setScore(i);
|
||||
});
|
||||
}
|
||||
@@ -351,9 +490,46 @@
|
||||
@@ -353,9 +492,46 @@
|
||||
@Override
|
||||
public void die(DamageSource damagesource) {
|
||||
boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
|
||||
boolean flag = this.world.getGameRules().getBoolean(GameRules.SHOW_DEATH_MESSAGES);
|
||||
+ // CraftBukkit start - fire PlayerDeathEvent
|
||||
+ if (this.dead) {
|
||||
+ return;
|
||||
+ }
|
||||
+ java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(this.inventory.getSize());
|
||||
+ boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory") || this.isSpectator();
|
||||
+ boolean keepInventory = this.world.getGameRules().getBoolean(GameRules.KEEP_INVENTORY) || this.isSpectator();
|
||||
+
|
||||
+ if (!keepInventory) {
|
||||
+ for (ItemStack item : this.inventory.getContents()) {
|
||||
@@ -279,7 +280,7 @@
|
||||
|
||||
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
|
||||
if (!future.isSuccess()) {
|
||||
@@ -384,11 +560,16 @@
|
||||
@@ -386,11 +562,16 @@
|
||||
}
|
||||
|
||||
this.releaseShoulderEntities();
|
||||
@@ -299,7 +300,7 @@
|
||||
EntityLiving entityliving = this.getKillingEntity();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -431,10 +612,12 @@
|
||||
@@ -433,10 +614,12 @@
|
||||
String s = this.getName();
|
||||
String s1 = entity.getName();
|
||||
|
||||
@@ -314,7 +315,7 @@
|
||||
} else {
|
||||
this.a(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -452,7 +635,8 @@
|
||||
@@ -454,7 +637,8 @@
|
||||
int i = scoreboardteam.getColor().b();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
@@ -324,7 +325,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,16 +680,26 @@
|
||||
@@ -498,16 +682,26 @@
|
||||
}
|
||||
|
||||
private boolean canPvP() {
|
||||
@@ -354,7 +355,7 @@
|
||||
this.decouple();
|
||||
this.getWorldServer().removePlayer(this);
|
||||
if (!this.viewingCredits) {
|
||||
@@ -518,10 +712,12 @@
|
||||
@@ -520,10 +714,12 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.server.getWorldServer(dimensionmanager1);
|
||||
|
||||
@@ -368,7 +369,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutRespawn(dimensionmanager, worlddata.getType(), this.playerInteractManager.getGameMode()));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
PlayerList playerlist = this.server.getPlayerList();
|
||||
@@ -529,6 +725,8 @@
|
||||
@@ -531,6 +727,8 @@
|
||||
playerlist.d(this);
|
||||
worldserver.removePlayer(this);
|
||||
this.dead = false;
|
||||
@@ -377,7 +378,7 @@
|
||||
double d0 = this.locX;
|
||||
double d1 = this.locY;
|
||||
double d2 = this.locZ;
|
||||
@@ -538,6 +736,7 @@
|
||||
@@ -540,6 +738,7 @@
|
||||
float f2 = f1;
|
||||
|
||||
worldserver.getMethodProfiler().enter("moving");
|
||||
@@ -385,7 +386,7 @@
|
||||
if (dimensionmanager1 == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) {
|
||||
this.cu = new Vec3D(this.locX, this.locY, this.locZ);
|
||||
d0 /= 8.0D;
|
||||
@@ -555,6 +754,52 @@
|
||||
@@ -557,6 +756,52 @@
|
||||
f = 0.0F;
|
||||
}
|
||||
|
||||
@@ -438,7 +439,7 @@
|
||||
this.setPositionRotation(d0, d1, d2, f1, f);
|
||||
worldserver.getMethodProfiler().exit();
|
||||
worldserver.getMethodProfiler().enter("placing");
|
||||
@@ -566,12 +811,13 @@
|
||||
@@ -568,12 +813,13 @@
|
||||
d0 = MathHelper.a(d0, d4, d6);
|
||||
d2 = MathHelper.a(d2, d5, d7);
|
||||
this.setPositionRotation(d0, d1, d2, f1, f);
|
||||
@@ -453,7 +454,7 @@
|
||||
|
||||
for (int l = -2; l <= 2; ++l) {
|
||||
for (int i1 = -2; i1 <= 2; ++i1) {
|
||||
@@ -581,11 +827,20 @@
|
||||
@@ -583,11 +829,20 @@
|
||||
int i2 = k + i1 * 0 - l * 1;
|
||||
boolean flag2 = j1 < 0;
|
||||
|
||||
@@ -475,7 +476,7 @@
|
||||
this.setPositionRotation((double) i, (double) j, (double) k, f1, 0.0F);
|
||||
this.setMot(Vec3D.a);
|
||||
} else if (!worldserver1.getTravelAgent().a(this, f2)) {
|
||||
@@ -614,11 +869,16 @@
|
||||
@@ -616,11 +871,16 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
@@ -493,7 +494,7 @@
|
||||
DimensionManager dimensionmanager = worldserver.worldProvider.getDimensionManager();
|
||||
DimensionManager dimensionmanager1 = this.world.worldProvider.getDimensionManager();
|
||||
|
||||
@@ -655,9 +915,16 @@
|
||||
@@ -657,9 +917,16 @@
|
||||
this.activeContainer.c();
|
||||
}
|
||||
|
||||
@@ -512,7 +513,7 @@
|
||||
this.a(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.q.a(this);
|
||||
});
|
||||
@@ -665,6 +932,7 @@
|
||||
@@ -667,6 +934,7 @@
|
||||
|
||||
@Override
|
||||
public void wakeup(boolean flag, boolean flag1, boolean flag2) {
|
||||
@@ -520,7 +521,7 @@
|
||||
if (this.isSleeping()) {
|
||||
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -752,8 +1020,9 @@
|
||||
@@ -754,8 +1022,9 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||
}
|
||||
|
||||
@@ -531,7 +532,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -768,6 +1037,17 @@
|
||||
@@ -770,6 +1039,17 @@
|
||||
this.nextContainerCounter();
|
||||
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
|
||||
|
||||
@@ -549,7 +550,7 @@
|
||||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true);
|
||||
@@ -775,9 +1055,11 @@
|
||||
@@ -777,9 +1057,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@@ -563,7 +564,7 @@
|
||||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -790,13 +1072,24 @@
|
||||
@@ -792,13 +1074,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
@@ -590,7 +591,7 @@
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
@@ -841,6 +1134,11 @@
|
||||
@@ -843,6 +1136,11 @@
|
||||
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
|
||||
@@ -602,7 +603,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -850,6 +1148,7 @@
|
||||
@@ -852,6 +1150,7 @@
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@@ -610,7 +611,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
|
||||
this.m();
|
||||
}
|
||||
@@ -884,7 +1183,7 @@
|
||||
@@ -886,7 +1185,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic, int i) {
|
||||
this.serverStatisticManager.b(this, statistic, i);
|
||||
@@ -619,7 +620,7 @@
|
||||
scoreboardscore.addScore(i);
|
||||
});
|
||||
}
|
||||
@@ -892,7 +1191,7 @@
|
||||
@@ -894,7 +1193,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic) {
|
||||
this.serverStatisticManager.setStatistic(this, statistic, 0);
|
||||
@@ -628,7 +629,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -941,7 +1240,16 @@
|
||||
@@ -943,7 +1242,16 @@
|
||||
|
||||
public void triggerHealthUpdate() {
|
||||
this.lastHealthSent = -1.0E8F;
|
||||
@@ -645,7 +646,7 @@
|
||||
|
||||
@Override
|
||||
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
@@ -996,12 +1304,14 @@
|
||||
@@ -998,12 +1306,14 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
@@ -661,7 +662,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1063,6 +1373,18 @@
|
||||
@@ -1065,6 +1375,18 @@
|
||||
|
||||
@Override
|
||||
public void a(EnumGamemode enumgamemode) {
|
||||
@@ -680,7 +681,7 @@
|
||||
this.playerInteractManager.setGameMode(enumgamemode);
|
||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
|
||||
if (enumgamemode == EnumGamemode.SPECTATOR) {
|
||||
@@ -1113,6 +1435,17 @@
|
||||
@@ -1115,6 +1437,17 @@
|
||||
}
|
||||
|
||||
public void a(PacketPlayInSettings packetplayinsettings) {
|
||||
@@ -698,7 +699,7 @@
|
||||
this.locale = packetplayinsettings.b();
|
||||
this.ck = packetplayinsettings.d();
|
||||
this.cl = packetplayinsettings.e();
|
||||
@@ -1149,13 +1482,13 @@
|
||||
@@ -1151,13 +1484,13 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
|
||||
} else {
|
||||
@@ -714,7 +715,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1179,7 +1512,7 @@
|
||||
@@ -1181,7 +1514,7 @@
|
||||
this.spectatedEntity = (Entity) (entity == null ? this : entity);
|
||||
if (entity1 != this.spectatedEntity) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
|
||||
@@ -723,7 +724,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1208,7 +1541,7 @@
|
||||
@@ -1210,7 +1543,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getPlayerListName() {
|
||||
@@ -732,7 +733,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1226,21 +1559,33 @@
|
||||
@@ -1228,21 +1561,33 @@
|
||||
}
|
||||
|
||||
public void J() {
|
||||
@@ -766,7 +767,7 @@
|
||||
if (worldserver == this.world) {
|
||||
this.playerConnection.a(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1263,6 +1608,9 @@
|
||||
@@ -1265,6 +1610,9 @@
|
||||
this.server.getPlayerList().a(this, worldserver);
|
||||
this.server.getPlayerList().updateClient(this);
|
||||
}
|
||||
@@ -776,7 +777,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1314,4 +1662,144 @@
|
||||
@@ -1316,4 +1664,144 @@
|
||||
return entityitem;
|
||||
}
|
||||
}
|
||||
@@ -883,7 +884,7 @@
|
||||
+
|
||||
+ public void reset() {
|
||||
+ float exp = 0;
|
||||
+ boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory");
|
||||
+ boolean keepInventory = this.world.getGameRules().getBoolean(GameRules.KEEP_INVENTORY);
|
||||
+
|
||||
+ if (this.keepLevel || keepInventory) {
|
||||
+ exp = this.exp;
|
||||
|
Reference in New Issue
Block a user