mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-17 13:24:17 -07:00
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/net/minecraft/server/EntityPlayer.java
|
||||
@@ -15,10 +15,28 @@
|
||||
@@ -12,10 +12,28 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
public PlayerConnection playerConnection;
|
||||
public final MinecraftServer server;
|
||||
public final PlayerInteractManager playerInteractManager;
|
||||
@@ -54,6 +72,20 @@
|
||||
@@ -51,6 +69,20 @@
|
||||
public int ping;
|
||||
public boolean viewingCredits;
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
|
||||
super((World) worldserver, gameprofile);
|
||||
playerinteractmanager.player = this;
|
||||
@@ -64,8 +96,50 @@
|
||||
@@ -61,8 +93,50 @@
|
||||
this.cf = minecraftserver.getPlayerList().h(this);
|
||||
this.Q = 1.0F;
|
||||
this.a(worldserver);
|
||||
@@ -102,7 +102,7 @@
|
||||
private void a(WorldServer worldserver) {
|
||||
BlockPosition blockposition = worldserver.getSpawn();
|
||||
|
||||
@@ -132,6 +206,7 @@
|
||||
@@ -129,6 +203,7 @@
|
||||
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
|
||||
this.recipeBook.a(nbttagcompound.getCompound("recipeBook"));
|
||||
}
|
||||
@@ -110,7 +110,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -151,7 +226,20 @@
|
||||
@@ -148,7 +223,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -162,8 +250,34 @@
|
||||
@@ -159,8 +247,34 @@
|
||||
}
|
||||
|
||||
nbttagcompound.set("recipeBook", this.recipeBook.e());
|
||||
@@ -167,7 +167,7 @@
|
||||
public void a(int i) {
|
||||
float f = (float) this.getExpToLevel();
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -210,6 +324,11 @@
|
||||
@@ -207,6 +321,11 @@
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@@ -179,7 +179,7 @@
|
||||
this.playerInteractManager.a();
|
||||
--this.invulnerableTicks;
|
||||
if (this.noDamageTicks > 0) {
|
||||
@@ -275,7 +394,7 @@
|
||||
@@ -272,7 +391,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cp) {
|
||||
@@ -188,7 +188,7 @@
|
||||
this.lastHealthSent = this.getHealth();
|
||||
this.lastFoodSent = this.foodData.getFoodLevel();
|
||||
this.cp = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -306,6 +425,12 @@
|
||||
@@ -303,6 +422,12 @@
|
||||
this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.cm));
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
if (this.expLevel != this.cl) {
|
||||
this.cl = this.expLevel;
|
||||
this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.cl));
|
||||
@@ -320,6 +445,16 @@
|
||||
@@ -317,6 +442,16 @@
|
||||
CriterionTriggers.p.a(this);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
|
||||
@@ -330,24 +465,50 @@
|
||||
@@ -327,16 +462,43 @@
|
||||
}
|
||||
|
||||
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
@@ -265,16 +265,7 @@
|
||||
|
||||
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
|
||||
if (!future.isSuccess()) {
|
||||
- boolean flag = true;
|
||||
String s = ichatbasecomponent.a(256);
|
||||
ChatMessage chatmessage = new ChatMessage("death.attack.message_too_long", new Object[] { (new ChatComponentText(s)).a(EnumChatFormat.YELLOW)});
|
||||
IChatBaseComponent ichatbasecomponent1 = (new ChatMessage("death.attack.even_more_magic", new Object[] { this.getScoreboardDisplayName()})).a((chatmodifier) -> {
|
||||
- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent));
|
||||
+ chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatmessage));
|
||||
});
|
||||
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent1));
|
||||
@@ -370,12 +531,17 @@
|
||||
@@ -367,12 +529,17 @@
|
||||
}
|
||||
|
||||
this.releaseShoulderEntities();
|
||||
@@ -296,7 +287,7 @@
|
||||
EntityLiving entityliving = this.cv();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -398,10 +564,12 @@
|
||||
@@ -395,10 +562,12 @@
|
||||
String s = this.getName();
|
||||
String s1 = entity.getName();
|
||||
|
||||
@@ -311,7 +302,7 @@
|
||||
} else {
|
||||
this.a(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -419,7 +587,8 @@
|
||||
@@ -416,7 +585,8 @@
|
||||
int i = scoreboardteam.getColor().b();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
@@ -321,7 +312,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,12 +630,14 @@
|
||||
@@ -458,12 +628,14 @@
|
||||
}
|
||||
|
||||
private boolean canPvP() {
|
||||
@@ -338,7 +329,7 @@
|
||||
if (this.dimension == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) {
|
||||
this.cC = new Vec3D(this.locX, this.locY, this.locZ);
|
||||
} else if (this.dimension != DimensionManager.NETHER && dimensionmanager != DimensionManager.OVERWORLD) {
|
||||
@@ -474,6 +645,7 @@
|
||||
@@ -471,6 +643,7 @@
|
||||
}
|
||||
|
||||
if (this.dimension == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) {
|
||||
@@ -346,7 +337,7 @@
|
||||
this.world.kill(this);
|
||||
if (!this.viewingCredits) {
|
||||
this.viewingCredits = true;
|
||||
@@ -487,7 +659,10 @@
|
||||
@@ -484,7 +657,10 @@
|
||||
dimensionmanager = DimensionManager.THE_END;
|
||||
}
|
||||
|
||||
@@ -358,7 +349,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false));
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
@@ -533,6 +708,7 @@
|
||||
@@ -530,6 +706,7 @@
|
||||
}
|
||||
|
||||
public void a(boolean flag, boolean flag1, boolean flag2) {
|
||||
@@ -366,7 +357,7 @@
|
||||
if (this.isSleeping()) {
|
||||
this.getWorldServer().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -611,23 +787,55 @@
|
||||
@@ -608,23 +785,55 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||
}
|
||||
|
||||
@@ -425,7 +416,7 @@
|
||||
if (iinventory instanceof ILootable && ((ILootable) iinventory).getLootTable() != null && this.isSpectator()) {
|
||||
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true);
|
||||
} else {
|
||||
@@ -641,18 +849,21 @@
|
||||
@@ -638,18 +847,21 @@
|
||||
if (itileinventory.isLocked() && !this.a(itileinventory.getLock()) && !this.isSpectator()) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), ChatMessageType.GAME_INFO));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.BLOCK_CHEST_LOCKED, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F));
|
||||
@@ -449,7 +440,7 @@
|
||||
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
@@ -660,8 +871,14 @@
|
||||
@@ -657,8 +869,14 @@
|
||||
}
|
||||
|
||||
public void openTrade(IMerchant imerchant) {
|
||||
@@ -465,7 +456,7 @@
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).d();
|
||||
@@ -681,13 +898,20 @@
|
||||
@@ -678,13 +896,20 @@
|
||||
}
|
||||
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
@@ -487,7 +478,7 @@
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
@@ -728,6 +952,11 @@
|
||||
@@ -725,6 +950,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()));
|
||||
@@ -499,7 +490,7 @@
|
||||
}
|
||||
|
||||
public void setContainerData(Container container, int i, int j) {
|
||||
@@ -742,6 +971,7 @@
|
||||
@@ -739,6 +969,7 @@
|
||||
}
|
||||
|
||||
public void closeInventory() {
|
||||
@@ -507,7 +498,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
|
||||
this.m();
|
||||
}
|
||||
@@ -775,14 +1005,14 @@
|
||||
@@ -772,14 +1003,14 @@
|
||||
|
||||
public void a(Statistic<?> statistic, int i) {
|
||||
this.cg.b(this, statistic, i);
|
||||
@@ -524,7 +515,7 @@
|
||||
}
|
||||
|
||||
public int discoverRecipes(Collection<IRecipe> collection) {
|
||||
@@ -830,8 +1060,17 @@
|
||||
@@ -827,8 +1058,17 @@
|
||||
|
||||
public void triggerHealthUpdate() {
|
||||
this.lastHealthSent = -1.0E8F;
|
||||
@@ -542,7 +533,7 @@
|
||||
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT));
|
||||
}
|
||||
@@ -882,7 +1121,7 @@
|
||||
@@ -879,7 +1119,7 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
@@ -551,7 +542,7 @@
|
||||
this.removeQueue.addAll(entityplayer.removeQueue);
|
||||
this.cx = entityplayer.cx;
|
||||
this.cC = entityplayer.cC;
|
||||
@@ -941,6 +1180,18 @@
|
||||
@@ -938,6 +1178,18 @@
|
||||
}
|
||||
|
||||
public void a(EnumGamemode enumgamemode) {
|
||||
@@ -570,7 +561,7 @@
|
||||
this.playerInteractManager.setGameMode(enumgamemode);
|
||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
|
||||
if (enumgamemode == EnumGamemode.SPECTATOR) {
|
||||
@@ -988,6 +1239,17 @@
|
||||
@@ -985,6 +1237,17 @@
|
||||
}
|
||||
|
||||
public void a(PacketPlayInSettings packetplayinsettings) {
|
||||
@@ -588,7 +579,7 @@
|
||||
this.locale = packetplayinsettings.b();
|
||||
this.cs = packetplayinsettings.d();
|
||||
this.ct = packetplayinsettings.e();
|
||||
@@ -1023,13 +1285,13 @@
|
||||
@@ -1020,13 +1283,13 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[] { entity.getId()}));
|
||||
} else {
|
||||
@@ -604,7 +595,7 @@
|
||||
}
|
||||
|
||||
protected void C() {
|
||||
@@ -1053,7 +1315,7 @@
|
||||
@@ -1050,7 +1313,7 @@
|
||||
this.spectatedEntity = (Entity) (entity == null ? this : entity);
|
||||
if (entity1 != this.spectatedEntity) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
|
||||
@@ -613,7 +604,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1080,7 +1342,7 @@
|
||||
@@ -1077,7 +1340,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getPlayerListName() {
|
||||
@@ -622,7 +613,7 @@
|
||||
}
|
||||
|
||||
public void a(EnumHand enumhand) {
|
||||
@@ -1097,12 +1359,17 @@
|
||||
@@ -1094,12 +1357,17 @@
|
||||
}
|
||||
|
||||
public void J() {
|
||||
@@ -640,7 +631,7 @@
|
||||
}
|
||||
|
||||
public AdvancementDataPlayer getAdvancementData() {
|
||||
@@ -1114,9 +1381,16 @@
|
||||
@@ -1111,9 +1379,16 @@
|
||||
return this.cC;
|
||||
}
|
||||
|
||||
@@ -657,7 +648,7 @@
|
||||
if (worldserver == this.world) {
|
||||
this.playerConnection.a(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1141,6 +1415,149 @@
|
||||
@@ -1138,6 +1413,149 @@
|
||||
this.server.getPlayerList().b(this, worldserver);
|
||||
this.server.getPlayerList().updateClient(this);
|
||||
}
|
||||
|
Reference in New Issue
Block a user