Update to Minecraft 1.16.4

This commit is contained in:
md_5 2020-11-03 07:00:00 +11:00
parent dea4138900
commit 3af81c7179
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
34 changed files with 374 additions and 330 deletions

View File

@ -15,9 +15,9 @@
public class DedicatedServer extends MinecraftServer implements IMinecraftServer { public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();
@@ -34,8 +42,10 @@ @@ -36,8 +44,10 @@
@Nullable @Nullable
private ServerGUI q; private final TextFilter r;
- public DedicatedServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) { - public DedicatedServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
- super(thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory); - super(thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
@ -27,8 +27,8 @@
+ // CraftBukkit end + // CraftBukkit end
this.propertyManager = dedicatedserversettings; this.propertyManager = dedicatedserversettings;
this.remoteControlCommandListener = new RemoteControlCommandListener(this); this.remoteControlCommandListener = new RemoteControlCommandListener(this);
} this.r = null;
@@ -44,13 +54,44 @@ @@ -47,13 +57,44 @@
public boolean init() throws IOException { public boolean init() throws IOException {
Thread thread = new Thread("Server console handler") { Thread thread = new Thread("Server console handler") {
public void run() { public void run() {
@ -76,7 +76,7 @@
} }
} catch (IOException ioexception) { } catch (IOException ioexception) {
DedicatedServer.LOGGER.error("Exception handling console input", ioexception); DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
@@ -59,6 +100,27 @@ @@ -62,6 +103,27 @@
} }
}; };
@ -104,7 +104,7 @@
thread.setDaemon(true); thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER)); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
thread.start(); thread.start();
@@ -85,7 +147,7 @@ @@ -88,7 +150,7 @@
this.setForceGamemode(dedicatedserverproperties.forceGamemode); this.setForceGamemode(dedicatedserverproperties.forceGamemode);
super.setIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get()); super.setIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
this.i(dedicatedserverproperties.enforceWhitelist); this.i(dedicatedserverproperties.enforceWhitelist);
@ -113,7 +113,7 @@
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode); DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
InetAddress inetaddress = null; InetAddress inetaddress = null;
@@ -110,6 +172,12 @@ @@ -112,6 +174,12 @@
return false; return false;
} }
@ -126,7 +126,7 @@
if (!this.getOnlineMode()) { if (!this.getOnlineMode()) {
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware."); DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
@@ -124,7 +192,7 @@ @@ -126,7 +194,7 @@
if (!NameReferencingFileConverter.e(this)) { if (!NameReferencingFileConverter.e(this)) {
return false; return false;
} else { } else {
@ -135,7 +135,7 @@
long i = SystemUtils.getMonotonicNanos(); long i = SystemUtils.getMonotonicNanos();
this.c(dedicatedserverproperties.maxBuildHeight); this.c(dedicatedserverproperties.maxBuildHeight);
@@ -132,7 +200,7 @@ @@ -134,7 +202,7 @@
TileEntitySkull.a(this.getMinecraftSessionService()); TileEntitySkull.a(this.getMinecraftSessionService());
UserCache.a(this.getOnlineMode()); UserCache.a(this.getOnlineMode());
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getWorld()); DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getWorld());
@ -144,7 +144,7 @@
long j = SystemUtils.getMonotonicNanos() - i; long j = SystemUtils.getMonotonicNanos() - i;
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D); String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
@@ -149,6 +217,7 @@ @@ -151,6 +219,7 @@
if (dedicatedserverproperties.enableRcon) { if (dedicatedserverproperties.enableRcon) {
DedicatedServer.LOGGER.info("Starting remote control listener"); DedicatedServer.LOGGER.info("Starting remote control listener");
this.remoteControlListener = RemoteControlListener.a((IMinecraftServer) this); this.remoteControlListener = RemoteControlListener.a((IMinecraftServer) this);
@ -152,7 +152,7 @@
} }
if (this.getMaxTickTime() > 0L) { if (this.getMaxTickTime() > 0L) {
@@ -259,6 +328,7 @@ @@ -265,6 +334,7 @@
this.remoteStatusListener.b(); this.remoteStatusListener.b();
} }
@ -160,7 +160,7 @@
} }
@Override @Override
@@ -287,7 +357,15 @@ @@ -293,7 +363,15 @@
while (!this.serverCommandQueue.isEmpty()) { while (!this.serverCommandQueue.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
@ -177,7 +177,7 @@
} }
} }
@@ -497,14 +575,45 @@ @@ -503,14 +581,45 @@
@Override @Override
public String getPlugins() { public String getPlugins() {
@ -225,9 +225,9 @@
}); });
return this.remoteControlCommandListener.getMessages(); return this.remoteControlCommandListener.getMessages();
} }
@@ -540,4 +649,15 @@ @@ -552,4 +661,15 @@
public boolean isSyncChunkWrites() { public ITextFilter a(EntityPlayer entityplayer) {
return this.propertyManager.getProperties().syncChunkWrites; return this.r != null ? this.r.a(entityplayer.getProfile()) : null;
} }
+ +
+ // CraftBukkit start + // CraftBukkit start

View File

@ -12,7 +12,7 @@
public final boolean onlineMode = this.getBoolean("online-mode", true); public final boolean onlineMode = this.getBoolean("online-mode", true);
public final boolean preventProxyConnections = this.getBoolean("prevent-proxy-connections", false); public final boolean preventProxyConnections = this.getBoolean("prevent-proxy-connections", false);
public final String serverIp = this.getString("server-ip", ""); public final String serverIp = this.getString("server-ip", "");
@@ -54,8 +56,10 @@ @@ -55,8 +57,10 @@
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList; public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
public final GeneratorSettings generatorSettings; public final GeneratorSettings generatorSettings;
@ -25,7 +25,7 @@
this.difficulty = (EnumDifficulty) this.a("difficulty", a(EnumDifficulty::getById, EnumDifficulty::a), EnumDifficulty::c, EnumDifficulty.EASY); this.difficulty = (EnumDifficulty) this.a("difficulty", a(EnumDifficulty::getById, EnumDifficulty::a), EnumDifficulty::c, EnumDifficulty.EASY);
this.gamemode = (EnumGamemode) this.a("gamemode", a(EnumGamemode::getById, EnumGamemode::a), EnumGamemode::b, EnumGamemode.SURVIVAL); this.gamemode = (EnumGamemode) this.a("gamemode", a(EnumGamemode::getById, EnumGamemode::a), EnumGamemode::b, EnumGamemode.SURVIVAL);
this.levelName = this.getString("level-name", "world"); this.levelName = this.getString("level-name", "world");
@@ -105,12 +109,14 @@ @@ -107,12 +111,14 @@
this.generatorSettings = GeneratorSettings.a(iregistrycustom, properties); this.generatorSettings = GeneratorSettings.a(iregistrycustom, properties);
} }

View File

@ -135,7 +135,7 @@
+ if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit + if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
} }
protected void ae() { protected void af() {
@@ -249,6 +348,15 @@ @@ -249,6 +348,15 @@
this.entityBaseTick(); this.entityBaseTick();
} }
@ -158,8 +158,8 @@
this.lastYaw = this.yaw; this.lastYaw = this.yaw;
- this.doPortalTick(); - this.doPortalTick();
+ if (this instanceof EntityPlayer) this.doPortalTick(); // CraftBukkit - // Moved up to postTick + if (this instanceof EntityPlayer) this.doPortalTick(); // CraftBukkit - // Moved up to postTick
if (this.aN()) { if (this.aO()) {
this.aO(); this.aP();
} }
@@ -325,12 +433,44 @@ @@ -325,12 +433,44 @@
@ -233,7 +233,7 @@
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ +
if (this.onGround && !this.bu()) { if (this.onGround && !this.bv()) {
block.stepOn(this.world, blockposition, this); block.stepOn(this.world, blockposition, this);
} }
@@ -700,6 +862,7 @@ @@ -700,6 +862,7 @@
@ -430,7 +430,7 @@
} }
@@ -1589,10 +1851,31 @@ @@ -1589,10 +1851,31 @@
this.be(); this.bf();
} }
- protected void addPassenger(Entity entity) { - protected void addPassenger(Entity entity) {
@ -662,7 +662,7 @@
+ // CraftBukkit end + // CraftBukkit end
} }
this.bM(); this.bN();
@@ -2012,13 +2398,18 @@ @@ -2012,13 +2398,18 @@
@Nullable @Nullable

View File

@ -32,4 +32,4 @@
+ if (this.world.isClientSide || ageLocked) { // CraftBukkit + if (this.world.isClientSide || ageLocked) { // CraftBukkit
if (this.d > 0) { if (this.d > 0) {
if (this.d % 4 == 0) { if (this.d % 4 == 0) {
this.world.addParticle(Particles.HAPPY_VILLAGER, this.d(1.0D), this.cE() + 0.5D, this.g(1.0D), 0.0D, 0.0D, 0.0D); this.world.addParticle(Particles.HAPPY_VILLAGER, this.d(1.0D), this.cF() + 0.5D, this.g(1.0D), 0.0D, 0.0D, 0.0D);

View File

@ -18,7 +18,7 @@
@@ -14,6 +18,12 @@ @@ -14,6 +18,12 @@
this(entitytypes, world); this(entitytypes, world);
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch); this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
this.ae(); this.af();
+ // CraftBukkit start - Added setDirection method + // CraftBukkit start - Added setDirection method
+ this.setDirection(d3, d4, d5); + this.setDirection(d3, d4, d5);
+ } + }

View File

@ -8,7 +8,7 @@
public class EntityFireworks extends IProjectile { public class EntityFireworks extends IProjectile {
@@ -119,7 +120,11 @@ @@ -121,7 +122,11 @@
} }
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) { if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
@ -21,7 +21,7 @@
} }
} }
@@ -134,7 +139,11 @@ @@ -136,7 +141,11 @@
protected void a(MovingObjectPositionEntity movingobjectpositionentity) { protected void a(MovingObjectPositionEntity movingobjectpositionentity) {
super.a(movingobjectpositionentity); super.a(movingobjectpositionentity);
if (!this.world.isClientSide) { if (!this.world.isClientSide) {
@ -34,7 +34,7 @@
} }
} }
@@ -144,7 +153,11 @@ @@ -146,7 +155,11 @@
this.world.getType(blockposition).a(this.world, blockposition, (Entity) this); this.world.getType(blockposition).a(this.world, blockposition, (Entity) this);
if (!this.world.s_() && this.hasExplosions()) { if (!this.world.s_() && this.hasExplosions()) {
@ -47,7 +47,7 @@
} }
super.a(movingobjectpositionblock); super.a(movingobjectpositionblock);
@@ -170,7 +183,9 @@ @@ -172,7 +185,9 @@
if (f > 0.0F) { if (f > 0.0F) {
if (this.ridingEntity != null) { if (this.ridingEntity != null) {
@ -57,7 +57,7 @@
} }
double d0 = 5.0D; double d0 = 5.0D;
@@ -197,7 +212,9 @@ @@ -199,7 +214,9 @@
if (flag) { if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g((Entity) entityliving)) / 5.0D); float f1 = f * (float) Math.sqrt((5.0D - (double) this.g((Entity) entityliving)) / 5.0D);

View File

@ -114,7 +114,7 @@
return false; return false;
} else { } else {
this.ticksFarFromPlayer = 0; this.ticksFarFromPlayer = 0;
if (this.dk()) { if (this.dl()) {
return false; return false;
} else { } else {
- this.releaseShoulderEntities(); - this.releaseShoulderEntities();

View File

@ -323,8 +323,8 @@
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f); boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);
@@ -1420,6 +1538,7 @@ @@ -1420,6 +1538,7 @@
@Override @Override
protected void bM() { protected void bN() {
super.bM(); super.bN();
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit + this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(true, false); this.unleash(true, false);
} }

View File

@ -45,7 +45,7 @@
} }
+ // CraftBukkit end */ + // CraftBukkit end */
this.impulse |= this.aJ(); this.impulse |= this.aK();
if (!this.world.isClientSide) { if (!this.world.isClientSide) {
@@ -122,6 +132,12 @@ @@ -122,6 +132,12 @@
} }

View File

@ -60,7 +60,7 @@
+ this.datawatcher.set(EntityLiving.HEALTH, (float) this.getAttributeInstance(GenericAttributes.MAX_HEALTH).getValue()); + this.datawatcher.set(EntityLiving.HEALTH, (float) this.getAttributeInstance(GenericAttributes.MAX_HEALTH).getValue());
this.i = true; this.i = true;
this.az = (float) ((Math.random() + 1.0D) * 0.009999999776482582D); this.az = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.ae(); this.af();
@@ -184,7 +222,13 @@ @@ -184,7 +222,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D); double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1); int i = (int) (150.0D * d1);
@ -78,7 +78,7 @@
@@ -406,7 +450,7 @@ @@ -406,7 +450,7 @@
protected void cT() { protected void cU() {
++this.deathTicks; ++this.deathTicks;
- if (this.deathTicks == 20) { - if (this.deathTicks == 20) {
+ if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead) + if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
@ -345,7 +345,7 @@
return false; return false;
} else if (this.world.isClientSide) { } else if (this.world.isClientSide) {
return false; return false;
- } else if (this.dk()) { - } else if (this.dl()) {
+ } else if (this.dead || this.killed || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die + } else if (this.dead || this.killed || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die
return false; return false;
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) { } else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
@ -476,7 +476,7 @@
boolean flag = this.lastDamageByPlayerTime > 0; boolean flag = this.lastDamageByPlayerTime > 0;
+ this.dropInventory(); // CraftBukkit - from below + this.dropInventory(); // CraftBukkit - from below
if (this.cV() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { if (this.cW() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
this.a(damagesource, flag); this.a(damagesource, flag);
this.dropDeathLoot(damagesource, i, flag); this.dropDeathLoot(damagesource, i, flag);
} }
@ -757,7 +757,7 @@
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ +
public final int dy() { public final int dz() {
return (Integer) this.datawatcher.get(EntityLiving.bi); return (Integer) this.datawatcher.get(EntityLiving.bi);
} }
@@ -1816,6 +2223,7 @@ @@ -1816,6 +2223,7 @@

View File

@ -95,7 +95,7 @@
this.c(this.getType() - 1); this.c(this.getType() - 1);
} }
@@ -246,7 +296,7 @@ @@ -246,7 +296,7 @@
this.am(); this.an();
} }
- this.doPortalTick(); - this.doPortalTick();

View File

@ -2,7 +2,7 @@
+++ b/net/minecraft/server/EntityMinecartCommandBlock.java +++ b/net/minecraft/server/EntityMinecartCommandBlock.java
@@ -103,5 +103,12 @@ @@ -103,5 +103,12 @@
public CommandListenerWrapper getWrapper() { public CommandListenerWrapper getWrapper() {
return new CommandListenerWrapper(this, EntityMinecartCommandBlock.this.getPositionVector(), EntityMinecartCommandBlock.this.bh(), this.d(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getScoreboardDisplayName(), this.d().getMinecraftServer(), EntityMinecartCommandBlock.this); return new CommandListenerWrapper(this, EntityMinecartCommandBlock.this.getPositionVector(), EntityMinecartCommandBlock.this.bi(), this.d(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getScoreboardDisplayName(), this.d().getMinecraftServer(), EntityMinecartCommandBlock.this);
} }
+ +
+ // CraftBukkit start + // CraftBukkit start

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/server/EntityMinecartFurnace.java
+++ b/net/minecraft/server/EntityMinecartFurnace.java
@@ -3,7 +3,7 @@
public class EntityMinecartFurnace extends EntityMinecartAbstract {
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityMinecartFurnace.class, DataWatcherRegistry.i);
- private int e;
+ public int e; // CraftBukkit PAIL private -> public, RENAME fuel
public double b;
public double c;
private static final RecipeItemStack f = RecipeItemStack.a(Items.COAL, Items.CHARCOAL);

View File

@ -28,7 +28,7 @@
public class EntityPlayer extends EntityHuman implements ICrafting { public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();
@@ -58,6 +79,20 @@ @@ -60,6 +81,20 @@
public int ping; public int ping;
public boolean viewingCredits; public boolean viewingCredits;
@ -49,10 +49,10 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile);
this.spawnDimension = World.OVERWORLD; this.spawnDimension = World.OVERWORLD;
@@ -68,12 +103,56 @@ @@ -71,12 +106,56 @@
this.advancementDataPlayer = minecraftserver.getPlayerList().f(this);
this.G = 1.0F; this.G = 1.0F;
this.c(worldserver); this.c(worldserver);
this.co = minecraftserver.a(this);
+ +
+ // CraftBukkit start + // CraftBukkit start
+ this.displayName = this.getName(); + this.displayName = this.getName();
@ -107,7 +107,7 @@
int i = Math.max(0, this.server.a(worldserver)); int i = Math.max(0, this.server.a(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().b((double) blockposition.getX(), (double) blockposition.getZ())); int j = MathHelper.floor(worldserver.getWorldBorder().b((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -139,11 +218,20 @@ @@ -142,11 +221,20 @@
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) { if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
this.recipeBook.a(nbttagcompound.getCompound("recipeBook"), this.server.getCraftingManager()); this.recipeBook.a(nbttagcompound.getCompound("recipeBook"), this.server.getCraftingManager());
} }
@ -128,7 +128,7 @@
if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) { if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) {
this.spawn = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); this.spawn = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.spawnForced = nbttagcompound.getBoolean("SpawnForced"); this.spawnForced = nbttagcompound.getBoolean("SpawnForced");
@@ -177,7 +265,20 @@ @@ -180,7 +268,20 @@
Entity entity = this.getRootVehicle(); Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle(); Entity entity1 = this.getVehicle();
@ -150,7 +150,7 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound(); NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound(); NBTTagCompound nbttagcompound3 = new NBTTagCompound();
@@ -195,7 +296,7 @@ @@ -198,7 +299,7 @@
nbttagcompound.setInt("SpawnZ", this.spawn.getZ()); nbttagcompound.setInt("SpawnZ", this.spawn.getZ());
nbttagcompound.setBoolean("SpawnForced", this.spawnForced); nbttagcompound.setBoolean("SpawnForced", this.spawnForced);
nbttagcompound.setFloat("SpawnAngle", this.spawnAngle); nbttagcompound.setFloat("SpawnAngle", this.spawnAngle);
@ -159,7 +159,7 @@
Logger logger = EntityPlayer.LOGGER; Logger logger = EntityPlayer.LOGGER;
logger.getClass(); logger.getClass();
@@ -203,9 +304,33 @@ @@ -206,9 +307,33 @@
nbttagcompound.set("SpawnDimension", nbtbase); nbttagcompound.set("SpawnDimension", nbtbase);
}); });
} }
@ -193,7 +193,7 @@
public void a(int i) { public void a(int i) {
float f = (float) this.getExpToLevel(); float f = (float) this.getExpToLevel();
float f1 = (f - 1.0F) / f; float f1 = (f - 1.0F) / f;
@@ -259,6 +384,11 @@ @@ -262,6 +387,11 @@
@Override @Override
public void tick() { public void tick() {
@ -205,7 +205,7 @@
this.playerInteractManager.a(); this.playerInteractManager.a();
--this.invulnerableTicks; --this.invulnerableTicks;
if (this.noDamageTicks > 0) { if (this.noDamageTicks > 0) {
@@ -326,7 +456,7 @@ @@ -329,7 +459,7 @@
} }
if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastSentSaturationZero) { if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastSentSaturationZero) {
@ -214,7 +214,7 @@
this.lastHealthSent = this.getHealth(); this.lastHealthSent = this.getHealth();
this.lastFoodSent = this.foodData.getFoodLevel(); this.lastFoodSent = this.foodData.getFoodLevel();
this.lastSentSaturationZero = this.foodData.getSaturationLevel() == 0.0F; this.lastSentSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -357,6 +487,12 @@ @@ -360,6 +490,12 @@
this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.lastExpTotalScored)); this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.lastExpTotalScored));
} }
@ -227,7 +227,7 @@
if (this.expLevel != this.lastExpLevelScored) { if (this.expLevel != this.lastExpLevelScored) {
this.lastExpLevelScored = this.expLevel; this.lastExpLevelScored = this.expLevel;
this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.lastExpLevelScored)); this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.lastExpLevelScored));
@@ -371,6 +507,16 @@ @@ -374,6 +510,16 @@
CriterionTriggers.p.a(this); CriterionTriggers.p.a(this);
} }
@ -244,7 +244,7 @@
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Ticking player"); CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
@@ -381,7 +527,8 @@ @@ -384,7 +530,8 @@
} }
private void a(IScoreboardCriteria iscoreboardcriteria, int i) { private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
@ -254,7 +254,7 @@
scoreboardscore.setScore(i); scoreboardscore.setScore(i);
}); });
} }
@@ -389,9 +536,46 @@ @@ -392,9 +539,46 @@
@Override @Override
public void die(DamageSource damagesource) { public void die(DamageSource damagesource) {
boolean flag = this.world.getGameRules().getBoolean(GameRules.SHOW_DEATH_MESSAGES); boolean flag = this.world.getGameRules().getBoolean(GameRules.SHOW_DEATH_MESSAGES);
@ -303,9 +303,9 @@
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> { this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
if (!future.isSuccess()) { if (!future.isSuccess()) {
@@ -425,12 +609,18 @@ @@ -428,12 +612,18 @@
if (this.world.getGameRules().getBoolean(GameRules.FORGIVE_DEAD_PLAYERS)) { if (this.world.getGameRules().getBoolean(GameRules.FORGIVE_DEAD_PLAYERS)) {
this.eV(); this.eW();
} }
- -
- if (!this.isSpectator()) { - if (!this.isSpectator()) {
@ -326,7 +326,7 @@
EntityLiving entityliving = this.getKillingEntity(); EntityLiving entityliving = this.getKillingEntity();
if (entityliving != null) { if (entityliving != null) {
@@ -466,10 +656,12 @@ @@ -469,10 +659,12 @@
String s = this.getName(); String s = this.getName();
String s1 = entity.getName(); String s1 = entity.getName();
@ -341,7 +341,7 @@
} else { } else {
this.a(StatisticList.MOB_KILLS); this.a(StatisticList.MOB_KILLS);
} }
@@ -487,7 +679,8 @@ @@ -490,7 +682,8 @@
int i = scoreboardteam.getColor().b(); int i = scoreboardteam.getColor().b();
if (i >= 0 && i < aiscoreboardcriteria.length) { if (i >= 0 && i < aiscoreboardcriteria.length) {
@ -351,7 +351,7 @@
} }
} }
@@ -531,18 +724,20 @@ @@ -534,18 +727,20 @@
} }
private boolean canPvP() { private boolean canPvP() {
@ -375,7 +375,7 @@
} else { } else {
return shapedetectorshape; return shapedetectorshape;
} }
@@ -551,11 +746,20 @@ @@ -554,11 +749,20 @@
@Nullable @Nullable
@Override @Override
public Entity b(WorldServer worldserver) { public Entity b(WorldServer worldserver) {
@ -399,7 +399,7 @@
this.decouple(); this.decouple();
this.getWorldServer().removePlayer(this); this.getWorldServer().removePlayer(this);
if (!this.viewingCredits) { if (!this.viewingCredits) {
@@ -566,6 +770,8 @@ @@ -569,6 +773,8 @@
return this; return this;
} else { } else {
@ -408,7 +408,7 @@
WorldData worlddata = worldserver.getWorldData(); WorldData worlddata = worldserver.getWorldData();
this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.playerInteractManager.getGameMode(), this.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true)); this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.playerInteractManager.getGameMode(), this.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
@@ -575,22 +781,52 @@ @@ -578,22 +784,52 @@
playerlist.d(this); playerlist.d(this);
worldserver1.removePlayer(this); worldserver1.removePlayer(this);
this.dead = false; this.dead = false;
@ -467,7 +467,7 @@
worldserver1.getMethodProfiler().exit(); worldserver1.getMethodProfiler().exit();
this.triggerDimensionAdvancements(worldserver1); this.triggerDimensionAdvancements(worldserver1);
this.playerInteractManager.a(worldserver); this.playerInteractManager.a(worldserver);
@@ -609,12 +845,31 @@ @@ -612,12 +848,31 @@
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastHealthSent = -1.0F; this.lastHealthSent = -1.0F;
this.lastFoodSent = -1; this.lastFoodSent = -1;
@ -499,7 +499,7 @@
private void a(WorldServer worldserver, BlockPosition blockposition) { private void a(WorldServer worldserver, BlockPosition blockposition) {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i(); BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
@@ -631,17 +886,17 @@ @@ -634,17 +889,17 @@
} }
@Override @Override
@ -522,7 +522,7 @@
} }
return optional1; return optional1;
@@ -685,10 +940,8 @@ @@ -688,10 +943,8 @@
this.activeContainer.c(); this.activeContainer.c();
} }
@ -535,7 +535,7 @@
if (!this.isSleeping() && this.isAlive()) { if (!this.isSleeping() && this.isAlive()) {
if (!this.world.getDimensionManager().isNatural()) { if (!this.world.getDimensionManager().isNatural()) {
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE); return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
@@ -714,7 +967,36 @@ @@ -717,7 +970,36 @@
} }
} }
@ -573,7 +573,7 @@
this.a(StatisticList.SLEEP_IN_BED); this.a(StatisticList.SLEEP_IN_BED);
CriterionTriggers.q.a(this); CriterionTriggers.q.a(this);
}); });
@@ -723,9 +1005,8 @@ @@ -726,9 +1008,8 @@
return either; return either;
} }
} }
@ -584,7 +584,7 @@
} }
@Override @Override
@@ -752,6 +1033,7 @@ @@ -755,6 +1036,7 @@
@Override @Override
public void wakeup(boolean flag, boolean flag1) { public void wakeup(boolean flag, boolean flag1) {
@ -592,7 +592,7 @@
if (this.isSleeping()) { if (this.isSleeping()) {
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2)); this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
} }
@@ -823,8 +1105,9 @@ @@ -826,8 +1108,9 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition())); this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
} }
@ -603,7 +603,7 @@
} }
@Override @Override
@@ -839,6 +1122,24 @@ @@ -842,6 +1125,24 @@
this.nextContainerCounter(); this.nextContainerCounter();
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this); Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
@ -628,7 +628,7 @@
if (container == null) { if (container == null) {
if (this.isSpectator()) { if (this.isSpectator()) {
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true); this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
@@ -846,9 +1147,11 @@ @@ -849,9 +1150,11 @@
return OptionalInt.empty(); return OptionalInt.empty();
} else { } else {
@ -642,7 +642,7 @@
return OptionalInt.of(this.containerCounter); return OptionalInt.of(this.containerCounter);
} }
} }
@@ -861,13 +1164,24 @@ @@ -864,13 +1167,24 @@
@Override @Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) { public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@ -669,7 +669,7 @@
this.activeContainer.addSlotListener(this); this.activeContainer.addSlotListener(this);
} }
@@ -912,6 +1226,11 @@ @@ -915,6 +1229,11 @@
public void a(Container container, NonNullList<ItemStack> nonnulllist) { public void a(Container container, NonNullList<ItemStack> nonnulllist) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist)); this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried())); this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
@ -681,7 +681,7 @@
} }
@Override @Override
@@ -921,6 +1240,7 @@ @@ -924,6 +1243,7 @@
@Override @Override
public void closeInventory() { public void closeInventory() {
@ -689,7 +689,7 @@
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId)); this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.o(); this.o();
} }
@@ -955,7 +1275,7 @@ @@ -958,7 +1278,7 @@
@Override @Override
public void a(Statistic<?> statistic, int i) { public void a(Statistic<?> statistic, int i) {
this.serverStatisticManager.b(this, statistic, i); this.serverStatisticManager.b(this, statistic, i);
@ -698,7 +698,7 @@
scoreboardscore.addScore(i); scoreboardscore.addScore(i);
}); });
} }
@@ -963,7 +1283,7 @@ @@ -966,7 +1286,7 @@
@Override @Override
public void a(Statistic<?> statistic) { public void a(Statistic<?> statistic) {
this.serverStatisticManager.setStatistic(this, statistic, 0); this.serverStatisticManager.setStatistic(this, statistic, 0);
@ -707,7 +707,7 @@
} }
@Override @Override
@@ -1012,8 +1332,17 @@ @@ -1015,8 +1335,17 @@
public void triggerHealthUpdate() { public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F; this.lastHealthSent = -1.0E8F;
@ -725,7 +725,7 @@
@Override @Override
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) { public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT, SystemUtils.b)); this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT, SystemUtils.b));
@@ -1065,12 +1394,13 @@ @@ -1068,12 +1397,13 @@
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastHealthSent = -1.0F; this.lastHealthSent = -1.0F;
this.lastFoodSent = -1; this.lastFoodSent = -1;
@ -740,7 +740,7 @@
} }
@Override @Override
@@ -1138,6 +1468,18 @@ @@ -1141,6 +1471,18 @@
@Override @Override
public void a(EnumGamemode enumgamemode) { public void a(EnumGamemode enumgamemode) {
@ -759,7 +759,7 @@
this.playerInteractManager.setGameMode(enumgamemode); this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId())); this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId()));
if (enumgamemode == EnumGamemode.SPECTATOR) { if (enumgamemode == EnumGamemode.SPECTATOR) {
@@ -1187,7 +1529,20 @@ @@ -1190,7 +1532,20 @@
return s; return s;
} }
@ -780,7 +780,7 @@
this.bY = packetplayinsettings.d(); this.bY = packetplayinsettings.d();
this.bZ = packetplayinsettings.e(); this.bZ = packetplayinsettings.e();
this.getDataWatcher().set(EntityPlayer.bi, (byte) packetplayinsettings.f()); this.getDataWatcher().set(EntityPlayer.bi, (byte) packetplayinsettings.f());
@@ -1223,13 +1578,13 @@ @@ -1226,13 +1581,13 @@
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()})); this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
} else { } else {
@ -796,7 +796,7 @@
} }
@Override @Override
@@ -1253,7 +1608,7 @@ @@ -1256,7 +1611,7 @@
this.spectatedEntity = (Entity) (entity == null ? this : entity); this.spectatedEntity = (Entity) (entity == null ? this : entity);
if (entity1 != this.spectatedEntity) { if (entity1 != this.spectatedEntity) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity)); this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
@ -805,7 +805,7 @@
} }
} }
@@ -1282,7 +1637,7 @@ @@ -1285,7 +1640,7 @@
@Nullable @Nullable
public IChatBaseComponent getPlayerListName() { public IChatBaseComponent getPlayerListName() {
@ -814,7 +814,7 @@
} }
@Override @Override
@@ -1303,9 +1658,16 @@ @@ -1306,9 +1661,16 @@
return this.advancementDataPlayer; return this.advancementDataPlayer;
} }
@ -831,7 +831,7 @@
if (worldserver == this.world) { if (worldserver == this.world) {
this.playerConnection.a(d0, d1, d2, f, f1); this.playerConnection.a(d0, d1, d2, f, f1);
} else { } else {
@@ -1326,6 +1688,9 @@ @@ -1329,6 +1691,9 @@
this.server.getPlayerList().a(this, worldserver); this.server.getPlayerList().a(this, worldserver);
this.server.getPlayerList().updateClient(this); this.server.getPlayerList().updateClient(this);
} }
@ -841,9 +841,9 @@
} }
@@ -1418,4 +1783,144 @@ @@ -1426,4 +1791,144 @@
return entityitem; public ITextFilter Q() {
} return this.co;
} }
+ +
+ // CraftBukkit start - Add per-player time and weather. + // CraftBukkit start - Add per-player time and weather.

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityTNTPrimed.java --- a/net/minecraft/server/EntityTNTPrimed.java
+++ b/net/minecraft/server/EntityTNTPrimed.java +++ b/net/minecraft/server/EntityTNTPrimed.java
@@ -1,13 +1,16 @@ @@ -1,6 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -8,10 +8,9 @@
public class EntityTNTPrimed extends Entity { public class EntityTNTPrimed extends Entity {
private static final DataWatcherObject<Integer> FUSE_TICKS = DataWatcher.a(EntityTNTPrimed.class, DataWatcherRegistry.b); @@ -8,6 +9,8 @@
@Nullable @Nullable
- private EntityLiving source; public EntityLiving source;
+ public EntityLiving source; // PAIL private -> public
private int fuseTicks; private int fuseTicks;
+ public float yield = 4; // CraftBukkit - add field + public float yield = 4; // CraftBukkit - add field
+ public boolean isIncendiary = false; // CraftBukkit - add field + public boolean isIncendiary = false; // CraftBukkit - add field
@ -31,7 +30,7 @@
+ this.die(); + this.die();
+ // CraftBukkit end + // CraftBukkit end
} else { } else {
this.aJ(); this.aK();
if (this.world.isClientSide) { if (this.world.isClientSide) {
@@ -71,9 +77,16 @@ @@ -71,9 +77,16 @@
} }

View File

@ -64,7 +64,7 @@
this.a(f); this.a(f);
this.foodTickTimer = 0; this.foodTickTimer = 0;
} }
} else if (flag && this.foodLevel >= 18 && entityhuman.eI()) { } else if (flag && this.foodLevel >= 18 && entityhuman.eJ()) {
++this.foodTickTimer; ++this.foodTickTimer;
if (this.foodTickTimer >= 80) { if (this.foodTickTimer >= 80) {
- entityhuman.heal(1.0F); - entityhuman.heal(1.0F);

View File

@ -17,10 +17,10 @@
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request"); private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
private final MinecraftServer b; private final MinecraftServer b;
private final NetworkManager c; private final NetworkManager c;
@@ -18,6 +27,41 @@ @@ -16,6 +25,40 @@
switch (packethandshakinginsetprotocol.b()) {
case LOGIN:
this.c.setProtocol(EnumProtocol.LOGIN); this.c.setProtocol(EnumProtocol.LOGIN);
ChatMessage chatmessage;
+ // CraftBukkit start - Connection throttle + // CraftBukkit start - Connection throttle
+ try { + try {
+ long currentTime = System.currentTimeMillis(); + long currentTime = System.currentTimeMillis();
@ -30,7 +30,7 @@
+ synchronized (throttleTracker) { + synchronized (throttleTracker) {
+ if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { + if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
+ throttleTracker.put(address, currentTime); + throttleTracker.put(address, currentTime);
+ chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting."); + ChatMessage chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting.");
+ this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage)); + this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
+ this.c.close(chatmessage); + this.c.close(chatmessage);
+ return; + return;
@ -55,11 +55,10 @@
+ org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t); + org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ if (packethandshakinginsetprotocol.c() != SharedConstants.getGameVersion().getProtocolVersion()) {
if (packethandshakinginsetprotocol.c() > SharedConstants.getGameVersion().getProtocolVersion()) { ChatMessage chatmessage;
chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[]{SharedConstants.getGameVersion().getName()});
this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage)); @@ -29,6 +72,7 @@
@@ -28,6 +72,7 @@
this.c.close(chatmessage); this.c.close(chatmessage);
} else { } else {
this.c.setPacketListener(new LoginListener(this.b, this.c)); this.c.setPacketListener(new LoginListener(this.b, this.c));

View File

@ -7,5 +7,5 @@
- if (!entity1.isCollidable()) { - if (!entity1.isCollidable()) {
+ if (!entity1.canCollideWith(entity) || !entity.canCollideWith(entity1)) { // CraftBukkit - collidable API + if (!entity1.canCollideWith(entity) || !entity.canCollideWith(entity1)) { // CraftBukkit - collidable API
return false; return false;
} else if (entity.world.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).ey())) { } else if (entity.world.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).ez())) {
return false; return false;

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/LoginListener.java --- a/net/minecraft/server/LoginListener.java
+++ b/net/minecraft/server/LoginListener.java +++ b/net/minecraft/server/LoginListener.java
@@ -17,6 +17,12 @@ @@ -18,6 +18,12 @@
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -13,7 +13,7 @@
public class LoginListener implements PacketLoginInListener { public class LoginListener implements PacketLoginInListener {
private static final AtomicInteger b = new AtomicInteger(0); private static final AtomicInteger b = new AtomicInteger(0);
@@ -31,6 +37,7 @@ @@ -32,6 +38,7 @@
private final String j; private final String j;
private SecretKey loginKey; private SecretKey loginKey;
private EntityPlayer l; private EntityPlayer l;
@ -21,7 +21,7 @@
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.g = LoginListener.EnumProtocolState.HELLO; this.g = LoginListener.EnumProtocolState.HELLO;
@@ -59,6 +66,20 @@ @@ -60,6 +67,20 @@
} }
@ -42,7 +42,7 @@
@Override @Override
public NetworkManager a() { public NetworkManager a() {
return this.networkManager; return this.networkManager;
@@ -80,10 +101,12 @@ @@ -81,10 +102,12 @@
this.i = this.a(this.i); this.i = this.a(this.i);
} }
@ -57,8 +57,8 @@
+ // CraftBukkit end + // CraftBukkit end
} else { } else {
this.g = LoginListener.EnumProtocolState.ACCEPTED; this.g = LoginListener.EnumProtocolState.ACCEPTED;
if (this.server.aw() >= 0 && !this.networkManager.isLocal()) { if (this.server.ax() >= 0 && !this.networkManager.isLocal()) {
@@ -97,9 +120,9 @@ @@ -98,9 +121,9 @@
if (entityplayer != null) { if (entityplayer != null) {
this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT; this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT;
@ -70,8 +70,8 @@
} }
} }
@@ -147,6 +170,43 @@ @@ -158,6 +181,43 @@
try {
LoginListener.this.i = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a()); LoginListener.this.i = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
if (LoginListener.this.i != null) { if (LoginListener.this.i != null) {
+ // CraftBukkit start - fire PlayerPreLoginEvent + // CraftBukkit start - fire PlayerPreLoginEvent
@ -114,7 +114,7 @@
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId()); LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId());
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else if (LoginListener.this.server.isEmbeddedServer()) { } else if (LoginListener.this.server.isEmbeddedServer()) {
@@ -166,6 +226,11 @@ @@ -177,6 +237,11 @@
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down")); LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable"); LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
} }

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/Main.java --- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java
@@ -28,7 +28,8 @@ @@ -27,7 +27,8 @@
public Main() {} public Main() {}
@ -10,7 +10,7 @@
OptionParser optionparser = new OptionParser(); OptionParser optionparser = new OptionParser();
OptionSpec<Void> optionspec = optionparser.accepts("nogui"); OptionSpec<Void> optionspec = optionparser.accepts("nogui");
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits"); OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
@@ -52,20 +53,22 @@ @@ -51,20 +52,22 @@
optionparser.printHelpOn(System.err); optionparser.printHelpOn(System.err);
return; return;
} }
@ -35,13 +35,13 @@
Main.LOGGER.info("Initialized '{}' and '{}'", java_nio_file_path.toAbsolutePath(), java_nio_file_path1.toAbsolutePath()); Main.LOGGER.info("Initialized '{}' and '{}'", java_nio_file_path.toAbsolutePath(), java_nio_file_path1.toAbsolutePath());
return; return;
} }
@@ -75,24 +78,42 @@ @@ -74,24 +77,42 @@
return; return;
} }
- File file = new File((String) optionset.valueOf(optionspec9)); - File file = new File((String) optionset.valueOf(optionspec9));
+ File file = (File) optionset.valueOf("universe"); // CraftBukkit + File file = (File) optionset.valueOf("universe"); // CraftBukkit
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString()); YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY);
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName())); UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName()));
@ -82,7 +82,7 @@
DataPackConfiguration datapackconfiguration1 = MinecraftServer.a(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.a : datapackconfiguration, flag); DataPackConfiguration datapackconfiguration1 = MinecraftServer.a(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.a : datapackconfiguration, flag);
CompletableFuture completablefuture = DataPackResources.a(resourcepackrepository.f(), CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.f(), Runnable::run); CompletableFuture completablefuture = DataPackResources.a(resourcepackrepository.f(), CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.f(), Runnable::run);
@@ -107,6 +128,7 @@ @@ -106,6 +127,7 @@
} }
datapackresources.i(); datapackresources.i();
@ -90,7 +90,7 @@
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, datapackresources.h(), iregistrycustom_dimension); RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, datapackresources.h(), iregistrycustom_dimension);
Object object = convertable_conversionsession.a((DynamicOps) registryreadops, datapackconfiguration1); Object object = convertable_conversionsession.a((DynamicOps) registryreadops, datapackconfiguration1);
@@ -134,21 +156,32 @@ @@ -133,21 +155,32 @@
} }
convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object); convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object);
@ -109,7 +109,7 @@
+ boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); + boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");
if (flag1 && !GraphicsEnvironment.isHeadless()) { if (flag1 && !GraphicsEnvironment.isHeadless()) {
dedicatedserver1.bc(); dedicatedserver1.bd();
} }
+ if (optionset.has("port")) { + if (optionset.has("port")) {
@ -125,7 +125,7 @@
Thread thread = new Thread("Server Shutdown Thread") { Thread thread = new Thread("Server Shutdown Thread") {
public void run() { public void run() {
dedicatedserver.safeShutdown(true); dedicatedserver.safeShutdown(true);
@@ -157,14 +190,15 @@ @@ -156,14 +189,15 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER)); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
Runtime.getRuntime().addShutdownHook(thread); Runtime.getRuntime().addShutdownHook(thread);

View File

@ -61,7 +61,7 @@
- public MinecraftServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) { - public MinecraftServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) { + public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
super("Server"); super("Server");
this.m = new GameProfilerSwitcher(SystemUtils.a, this::ah); this.m = new GameProfilerSwitcher(SystemUtils.a, this::ai);
this.methodProfiler = GameProfilerDisabled.a; this.methodProfiler = GameProfilerDisabled.a;
this.serverPing = new ServerPing(); this.serverPing = new ServerPing();
this.r = new Random(); this.r = new Random();
@ -447,7 +447,7 @@
+ // CraftBukkit end + // CraftBukkit end
worldloadlistener.b(); worldloadlistener.b();
chunkproviderserver.getLightEngine().a(5); chunkproviderserver.getLightEngine().a(5);
this.bb(); this.bc();
+ +
+ // CraftBukkit start + // CraftBukkit start
+ this.forceTicks = false; + this.forceTicks = false;
@ -616,7 +616,7 @@
} }
public CrashReport b(CrashReport crashreport) { public CrashReport b(CrashReport crashreport) {
@@ -1214,16 +1472,17 @@ @@ -1220,16 +1478,17 @@
public CompletableFuture<Void> a(Collection<String> collection) { public CompletableFuture<Void> a(Collection<String> collection) {
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> { CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
@ -636,7 +636,7 @@
this.resourcePackRepository.a(collection); this.resourcePackRepository.a(collection);
this.saveData.a(a(this.resourcePackRepository)); this.saveData.a(a(this.resourcePackRepository));
datapackresources.i(); datapackresources.i();
@@ -1589,6 +1848,22 @@ @@ -1595,6 +1854,22 @@
} }

View File

@ -53,8 +53,8 @@
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel)); + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
+ // CraftBukkit end + // CraftBukkit end
} }
} else if ((this != MobEffects.HEAL || entityliving.di()) && (this != MobEffects.HARM || !entityliving.di())) { } else if ((this != MobEffects.HEAL || entityliving.dj()) && (this != MobEffects.HARM || !entityliving.dj())) {
if (this == MobEffects.HARM && !entityliving.di() || this == MobEffects.HEAL && entityliving.di()) { if (this == MobEffects.HARM && !entityliving.dj() || this == MobEffects.HEAL && entityliving.dj()) {
entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i)); entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i));
} }
} else { } else {

View File

@ -7,7 +7,7 @@
- this.e.setGoalTarget(this.e.getLastDamager()); - this.e.setGoalTarget(this.e.getLastDamager());
+ this.e.setGoalTarget(this.e.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason + this.e.setGoalTarget(this.e.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
this.g = this.e.getGoalTarget(); this.g = this.e.getGoalTarget();
this.c = this.e.cZ(); this.c = this.e.da();
this.h = 300; this.h = 300;
@@ -100,6 +100,6 @@ @@ -100,6 +100,6 @@
} }

View File

@ -6,6 +6,6 @@
if (!this.entity.isTamed()) { if (!this.entity.isTamed()) {
- return false; - return false;
+ return this.entity.isWillSit() && this.entity.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals + return this.entity.isWillSit() && this.entity.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
} else if (this.entity.aG()) { } else if (this.entity.aH()) {
return false; return false;
} else if (!this.entity.isOnGround()) { } else if (!this.entity.isOnGround()) {

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/PlayerConnection.java --- a/net/minecraft/server/PlayerConnection.java
+++ b/net/minecraft/server/PlayerConnection.java +++ b/net/minecraft/server/PlayerConnection.java
@@ -18,6 +18,48 @@ @@ -24,6 +24,48 @@
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -49,7 +49,7 @@
public class PlayerConnection implements PacketListenerPlayIn { public class PlayerConnection implements PacketListenerPlayIn {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();
@@ -28,7 +70,10 @@ @@ -34,7 +76,10 @@
private long lastKeepAlive; private long lastKeepAlive;
private boolean awaitingKeepAlive; private boolean awaitingKeepAlive;
private long h; private long h;
@ -61,15 +61,14 @@
private int j; private int j;
private final Int2ShortMap k = new Int2ShortOpenHashMap(); private final Int2ShortMap k = new Int2ShortOpenHashMap();
private double l; private double l;
@@ -60,7 +105,33 @@ @@ -72,8 +117,33 @@
networkmanager.setPacketListener(this); itextfilter.a();
this.player = entityplayer; }
entityplayer.playerConnection = this;
+
+ // CraftBukkit start - add fields and methods + // CraftBukkit start - add fields and methods
+ this.server = minecraftserver.server; + this.server = minecraftserver.server;
+ } }
+
+ private final org.bukkit.craftbukkit.CraftServer server; + private final org.bukkit.craftbukkit.CraftServer server;
+ public boolean processedDisconnect; + public boolean processedDisconnect;
+ private int lastTick = MinecraftServer.currentTick; + private int lastTick = MinecraftServer.currentTick;
@ -90,12 +89,13 @@
+ +
+ public CraftPlayer getPlayer() { + public CraftPlayer getPlayer() {
+ return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity(); + return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity();
} + }
+ // CraftBukkit end + // CraftBukkit end
+
public void tick() { public void tick() {
this.syncPosition(); this.syncPosition();
@@ -109,7 +180,7 @@ this.player.lastX = this.player.locX();
@@ -121,7 +191,7 @@
this.minecraftServer.getMethodProfiler().enter("keepAlive"); this.minecraftServer.getMethodProfiler().enter("keepAlive");
long i = SystemUtils.getMonotonicMillis(); long i = SystemUtils.getMonotonicMillis();
@ -104,7 +104,7 @@
if (this.awaitingKeepAlive) { if (this.awaitingKeepAlive) {
this.disconnect(new ChatMessage("disconnect.timeout")); this.disconnect(new ChatMessage("disconnect.timeout"));
} else { } else {
@@ -121,15 +192,21 @@ @@ -133,15 +203,21 @@
} }
this.minecraftServer.getMethodProfiler().exit(); this.minecraftServer.getMethodProfiler().exit();
@ -126,7 +126,7 @@
this.disconnect(new ChatMessage("multiplayer.disconnect.idling")); this.disconnect(new ChatMessage("multiplayer.disconnect.idling"));
} }
@@ -153,16 +230,46 @@ @@ -165,16 +241,46 @@
return this.minecraftServer.a(this.player.getProfile()); return this.minecraftServer.a(this.player.getProfile());
} }
@ -173,8 +173,17 @@
+ minecraftserver.postToMainThread(networkmanager::handleDisconnection); + minecraftserver.postToMainThread(networkmanager::handleDisconnection);
} }
@Override private <T> void a(T t0, Consumer<T> consumer, BiFunction<ITextFilter, T, CompletableFuture<Optional<T>>> bifunction) {
@@ -203,7 +310,34 @@ @@ -190,7 +296,7 @@
ITextFilter itextfilter = this.player.Q();
if (itextfilter != null) {
- ((CompletableFuture) bifunction.apply(itextfilter, t0)).thenAcceptAsync((optional) -> {
+ (bifunction.apply(itextfilter, t0)).thenAcceptAsync((optional) -> { // CraftBukkit - decompile error
optional.ifPresent(consumer1);
}, iasynctaskhandler);
} else {
@@ -247,7 +353,34 @@
double d9 = entity.getMot().g(); double d9 = entity.getMot().g();
double d10 = d6 * d6 + d7 * d7 + d8 * d8; double d10 = d6 * d6 + d7 * d7 + d8 * d8;
@ -210,7 +219,7 @@
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8); PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8);
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
return; return;
@@ -233,14 +367,72 @@ @@ -277,14 +410,72 @@
} }
entity.setLocation(d3, d4, d5, f, f1); entity.setLocation(d3, d4, d5, f, f1);
@ -283,7 +292,7 @@
this.player.getWorldServer().getChunkProvider().movePlayer(this.player); this.player.getWorldServer().getChunkProvider().movePlayer(this.player);
this.player.checkMovement(this.player.locX() - d0, this.player.locY() - d1, this.player.locZ() - d2); this.player.checkMovement(this.player.locX() - d0, this.player.locY() - d1, this.player.locZ() - d2);
this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && this.a(entity); this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && this.a(entity);
@@ -259,7 +451,7 @@ @@ -303,7 +494,7 @@
@Override @Override
public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) { public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) {
PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer());
@ -292,7 +301,7 @@
this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
this.o = this.teleportPos.x; this.o = this.teleportPos.x;
this.p = this.teleportPos.y; this.p = this.teleportPos.y;
@@ -269,6 +461,7 @@ @@ -313,6 +504,7 @@
} }
this.teleportPos = null; this.teleportPos = null;
@ -300,7 +309,7 @@
} }
} }
@@ -276,7 +469,7 @@ @@ -320,7 +512,7 @@
@Override @Override
public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) { public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.getWorldServer());
@ -309,7 +318,7 @@
RecipeBookServer recipebookserver = this.player.getRecipeBook(); RecipeBookServer recipebookserver = this.player.getRecipeBook();
optional.ifPresent(recipebookserver::e); optional.ifPresent(recipebookserver::e);
@@ -305,6 +498,12 @@ @@ -349,6 +541,12 @@
@Override @Override
public void a(PacketPlayInTabComplete packetplayintabcomplete) { public void a(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer());
@ -322,7 +331,7 @@
StringReader stringreader = new StringReader(packetplayintabcomplete.c()); StringReader stringreader = new StringReader(packetplayintabcomplete.c());
if (stringreader.canRead() && stringreader.peek() == '/') { if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -314,6 +513,7 @@ @@ -358,6 +556,7 @@
ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@ -330,7 +339,7 @@
this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions)); this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions));
}); });
} }
@@ -542,6 +742,7 @@ @@ -586,6 +785,7 @@
if (container instanceof ContainerMerchant) { if (container instanceof ContainerMerchant) {
ContainerMerchant containermerchant = (ContainerMerchant) container; ContainerMerchant containermerchant = (ContainerMerchant) container;
@ -338,35 +347,49 @@
containermerchant.d(i); containermerchant.d(i);
containermerchant.g(i); containermerchant.g(i);
@@ -552,6 +753,14 @@ @@ -595,6 +795,13 @@
@Override @Override
public void a(PacketPlayInBEdit packetplayinbedit) { public void a(PacketPlayInBEdit packetplayinbedit) {
PlayerConnectionUtils.ensureMainThread(packetplayinbedit, this, this.player.getWorldServer());
+ // CraftBukkit start + // CraftBukkit start
+ if (this.lastBookTick + 20 > MinecraftServer.currentTick) { + if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
+ this.disconnect("Book edited too quickly!"); + this.disconnect("Book edited too quickly!");
+ return; + return;
+ } + }
+ this.lastBookTick = MinecraftServer.currentTick; + this.lastBookTick = MinecraftServer.currentTick;
+ EnumItemSlot enumitemslot = packetplayinbedit.d() == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND;
+ // CraftBukkit end + // CraftBukkit end
ItemStack itemstack = packetplayinbedit.b(); ItemStack itemstack = packetplayinbedit.b();
if (!itemstack.isEmpty()) { if (itemstack.getItem() == Items.WRITABLE_BOOK) {
@@ -580,9 +789,11 @@ @@ -610,13 +817,15 @@
NBTTagList nbttaglist = nbttagcompound.getList("pages", 8);
- int i;
+ // CraftBukkit start - decompile error
+ // int i;
- for (i = 0; i < nbttaglist.size(); ++i) {
+ for (int i = 0; i < nbttaglist.size(); ++i) {
list.add(nbttaglist.getString(i));
} }
itemstack2.a("pages", (NBTBase) nbttaglist); - i = packetplayinbedit.d();
- this.player.a(packetplayinbedit.d(), itemstack2); + int i = packetplayinbedit.d();
+ this.player.a(packetplayinbedit.d(), CraftEventFactory.handleEditBookEvent(player, enumitemslot, itemstack1, itemstack2)); // CraftBukkit + // CraftBukkit end
} else { if (PlayerInventory.d(i) || i == 40) {
+ ItemStack old = itemstack1.cloneItemStack(); // CraftBukkit this.a((List) list, flag ? (list1) -> {
itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8)); this.a((String) list1.get(0), list1.subList(1, list1.size()), i);
+ CraftEventFactory.handleEditBookEvent(player, enumitemslot, old, itemstack1); // CraftBukkit @@ -664,7 +873,7 @@
}
itemstack1.a("pages", (NBTBase) nbttaglist);
- this.player.inventory.setItem(i, itemstack1);
+ this.player.inventory.setItem(i, CraftEventFactory.handleEditBookEvent(player, i, itemstack, itemstack1)); // CraftBukkit
} }
} }
@@ -624,7 +835,7 @@ @@ -702,7 +911,7 @@
} else { } else {
WorldServer worldserver = this.player.getWorldServer(); WorldServer worldserver = this.player.getWorldServer();
@ -375,7 +398,7 @@
if (this.e == 0) { if (this.e == 0) {
this.syncPosition(); this.syncPosition();
} }
@@ -634,13 +845,21 @@ @@ -712,13 +921,21 @@
this.A = this.e; this.A = this.e;
this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
} }
@ -398,7 +421,7 @@
double d0 = this.player.locX(); double d0 = this.player.locX();
double d1 = this.player.locY(); double d1 = this.player.locY();
double d2 = this.player.locZ(); double d2 = this.player.locZ();
@@ -665,15 +884,33 @@ @@ -743,15 +960,33 @@
++this.receivedMovePackets; ++this.receivedMovePackets;
int i = this.receivedMovePackets - this.processedMovePackets; int i = this.receivedMovePackets - this.processedMovePackets;
@ -434,7 +457,7 @@
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9); PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9);
this.a(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch); this.a(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch);
return; return;
@@ -692,6 +929,7 @@ @@ -770,6 +1005,7 @@
} }
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9)); this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
@ -442,7 +465,7 @@
double d12 = d8; double d12 = d8;
d7 = d4 - this.player.locX(); d7 = d4 - this.player.locX();
@@ -713,10 +951,74 @@ @@ -791,10 +1027,74 @@
if (!this.player.noclip && !this.player.isSleeping() && (flag1 && worldserver.getCubes(this.player, axisalignedbb) || this.a((IWorldReader) worldserver, axisalignedbb))) { if (!this.player.noclip && !this.player.isSleeping() && (flag1 && worldserver.getCubes(this.player, axisalignedbb) || this.a((IWorldReader) worldserver, axisalignedbb))) {
this.a(d0, d1, d2, f, f1); this.a(d0, d1, d2, f, f1);
} else { } else {
@ -519,7 +542,7 @@
if (flag) { if (flag) {
this.player.fallDistance = 0.0F; this.player.fallDistance = 0.0F;
} }
@@ -745,10 +1047,66 @@ @@ -823,10 +1123,66 @@
} }
public void a(double d0, double d1, double d2, float f, float f1) { public void a(double d0, double d1, double d2, float f, float f1) {
@ -587,7 +610,7 @@
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX() : 0.0D; double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX() : 0.0D;
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY() : 0.0D; double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY() : 0.0D;
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ() : 0.0D; double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ() : 0.0D;
@@ -760,6 +1118,14 @@ @@ -838,6 +1194,14 @@
this.teleportAwait = 0; this.teleportAwait = 0;
} }
@ -602,7 +625,7 @@
this.A = this.e; this.A = this.e;
this.player.setLocation(d0, d1, d2, f, f1); this.player.setLocation(d0, d1, d2, f, f1);
this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait));
@@ -768,6 +1134,7 @@ @@ -846,6 +1210,7 @@
@Override @Override
public void a(PacketPlayInBlockDig packetplayinblockdig) { public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer());
@ -610,7 +633,7 @@
BlockPosition blockposition = packetplayinblockdig.b(); BlockPosition blockposition = packetplayinblockdig.b();
this.player.resetIdleTimer(); this.player.resetIdleTimer();
@@ -778,14 +1145,46 @@ @@ -856,14 +1221,46 @@
if (!this.player.isSpectator()) { if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); ItemStack itemstack = this.player.b(EnumHand.OFF_HAND);
@ -659,7 +682,7 @@
this.player.dropItem(false); this.player.dropItem(false);
} }
@@ -822,6 +1221,7 @@ @@ -900,6 +1297,7 @@
@Override @Override
public void a(PacketPlayInUseItem packetplayinuseitem) { public void a(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.getWorldServer());
@ -667,7 +690,7 @@
WorldServer worldserver = this.player.getWorldServer(); WorldServer worldserver = this.player.getWorldServer();
EnumHand enumhand = packetplayinuseitem.b(); EnumHand enumhand = packetplayinuseitem.b();
ItemStack itemstack = this.player.b(enumhand); ItemStack itemstack = this.player.b(enumhand);
@@ -832,6 +1232,14 @@ @@ -910,6 +1308,14 @@
this.player.resetIdleTimer(); this.player.resetIdleTimer();
if (blockposition.getY() < this.minecraftServer.getMaxBuildHeight()) { if (blockposition.getY() < this.minecraftServer.getMaxBuildHeight()) {
if (this.teleportPos == null && this.player.h((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) { if (this.teleportPos == null && this.player.h((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) {
@ -682,7 +705,7 @@
EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
if (enumdirection == EnumDirection.UP && !enuminteractionresult.a() && blockposition.getY() >= this.minecraftServer.getMaxBuildHeight() - 1 && a(this.player, itemstack)) { if (enumdirection == EnumDirection.UP && !enuminteractionresult.a() && blockposition.getY() >= this.minecraftServer.getMaxBuildHeight() - 1 && a(this.player, itemstack)) {
@@ -855,12 +1263,51 @@ @@ -933,12 +1339,51 @@
@Override @Override
public void a(PacketPlayInBlockPlace packetplayinblockplace) { public void a(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer());
@ -734,7 +757,7 @@
EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand); EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult.b()) { if (enuminteractionresult.b()) {
@@ -881,7 +1328,7 @@ @@ -959,7 +1404,7 @@
Entity entity = packetplayinspectate.a(worldserver); Entity entity = packetplayinspectate.a(worldserver);
if (entity != null) { if (entity != null) {
@ -743,7 +766,7 @@
return; return;
} }
} }
@@ -890,7 +1337,12 @@ @@ -968,7 +1413,12 @@
} }
@Override @Override
@ -757,7 +780,7 @@
@Override @Override
public void a(PacketPlayInBoatMove packetplayinboatmove) { public void a(PacketPlayInBoatMove packetplayinboatmove) {
@@ -905,11 +1357,26 @@ @@ -983,11 +1433,26 @@
@Override @Override
public void a(IChatBaseComponent ichatbasecomponent) { public void a(IChatBaseComponent ichatbasecomponent) {
@ -782,10 +805,10 @@
+ this.minecraftServer.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage)); + this.minecraftServer.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage));
+ } + }
+ // CraftBukkit end + // CraftBukkit end
if (this.isExemptPlayer()) { ITextFilter itextfilter = this.player.Q();
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
this.minecraftServer.safeShutdown(false); if (itextfilter != null) {
@@ -935,6 +1402,15 @@ @@ -1019,6 +1484,15 @@
} }
} }
@ -801,7 +824,7 @@
try { try {
this.networkManager.sendPacket(packet, genericfuturelistener); this.networkManager.sendPacket(packet, genericfuturelistener);
} catch (Throwable throwable) { } catch (Throwable throwable) {
@@ -951,7 +1427,16 @@ @@ -1035,7 +1509,16 @@
@Override @Override
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
@ -818,7 +841,7 @@
if (this.player.inventory.itemInHandIndex != packetplayinhelditemslot.b() && this.player.getRaisedHand() == EnumHand.MAIN_HAND) { if (this.player.inventory.itemInHandIndex != packetplayinhelditemslot.b() && this.player.getRaisedHand() == EnumHand.MAIN_HAND) {
this.player.clearActiveItem(); this.player.clearActiveItem();
} }
@@ -960,13 +1445,24 @@ @@ -1044,65 +1527,286 @@
this.player.resetIdleTimer(); this.player.resetIdleTimer();
} else { } else {
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getDisplayName().getString()); PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getDisplayName().getString());
@ -828,30 +851,37 @@
@Override @Override
public void a(PacketPlayInChat packetplayinchat) { public void a(PacketPlayInChat packetplayinchat) {
- PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.getWorldServer());
- if (this.player.getChatFlags() == EnumChatVisibility.HIDDEN) {
+ // CraftBukkit start - async chat + // CraftBukkit start - async chat
+ // SPIGOT-3638 + // SPIGOT-3638
+ if (this.minecraftServer.isStopped()) { + if (this.minecraftServer.isStopped()) {
+ return; + return;
+ } + }
+
+ boolean isSync = packetplayinchat.b().startsWith("/");
+ if (packetplayinchat.b().startsWith("/")) {
+ PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.getWorldServer());
+ }
+ // CraftBukkit end + // CraftBukkit end
String s = StringUtils.normalizeSpace(packetplayinchat.b());
if (s.startsWith("/")) {
PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.getWorldServer());
this.c(s);
} else {
- this.a(s, this::c);
+ this.c(s); // CraftBukkit - filter NYI
}
}
private void c(String s) {
- if (this.player.getChatFlags() == EnumChatVisibility.HIDDEN) {
+ if (this.player.dead || this.player.getChatFlags() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales + if (this.player.dead || this.player.getChatFlags() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend")).a(EnumChatFormat.RED), ChatMessageType.SYSTEM, SystemUtils.b)); this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend")).a(EnumChatFormat.RED), ChatMessageType.SYSTEM, SystemUtils.b));
} else { } else {
this.player.resetIdleTimer(); this.player.resetIdleTimer();
@@ -974,41 +1470,254 @@
+ boolean isSync = s.startsWith("/"); // CraftBukkit
for (int i = 0; i < s.length(); ++i) { for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
- this.disconnect(new ChatMessage("multiplayer.disconnect.illegal_characters")); - this.disconnect(new ChatMessage("multiplayer.disconnect.illegal_characters"));
+ // CraftBukkit start - threadsafety + // CraftBukkit start - threadsafety
+ if (!isSync) { + if (!s.startsWith("/")) {
+ Waitable waitable = new Waitable() { + Waitable waitable = new Waitable() {
+ @Override + @Override
+ protected Object evaluate() { + protected Object evaluate() {
@ -1107,7 +1137,7 @@
this.player.resetIdleTimer(); this.player.resetIdleTimer();
IJumpable ijumpable; IJumpable ijumpable;
@@ -1066,6 +1775,7 @@ @@ -1160,6 +1864,7 @@
@Override @Override
public void a(PacketPlayInUseEntity packetplayinuseentity) { public void a(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer());
@ -1115,7 +1145,7 @@
WorldServer worldserver = this.player.getWorldServer(); WorldServer worldserver = this.player.getWorldServer();
Entity entity = packetplayinuseentity.a((World) worldserver); Entity entity = packetplayinuseentity.a((World) worldserver);
@@ -1079,18 +1789,72 @@ @@ -1173,18 +1878,72 @@
ItemStack itemstack = enumhand != null ? this.player.b(enumhand).cloneItemStack() : ItemStack.b; ItemStack itemstack = enumhand != null ? this.player.b(enumhand).cloneItemStack() : ItemStack.b;
Optional<EnumInteractionResult> optional = Optional.empty(); Optional<EnumInteractionResult> optional = Optional.empty();
@ -1189,7 +1219,7 @@
} }
if (optional.isPresent() && ((EnumInteractionResult) optional.get()).a()) { if (optional.isPresent() && ((EnumInteractionResult) optional.get()).a()) {
@@ -1137,15 +1901,21 @@ @@ -1231,15 +1990,21 @@
@Override @Override
public void a(PacketPlayInCloseWindow packetplayinclosewindow) { public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
@ -1213,7 +1243,7 @@
NonNullList<ItemStack> nonnulllist = NonNullList.a(); NonNullList<ItemStack> nonnulllist = NonNullList.a();
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) { for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
@@ -1154,8 +1924,274 @@ @@ -1248,8 +2013,274 @@
this.player.a(this.player.activeContainer, nonnulllist); this.player.a(this.player.activeContainer, nonnulllist);
} else { } else {
@ -1489,7 +1519,7 @@
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) { if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true)); this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
this.player.e = true; this.player.e = true;
@@ -1195,6 +2231,7 @@ @@ -1289,6 +2320,7 @@
@Override @Override
public void a(PacketPlayInEnchantItem packetplayinenchantitem) { public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
@ -1497,7 +1527,7 @@
this.player.resetIdleTimer(); this.player.resetIdleTimer();
if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
this.player.activeContainer.a((EntityHuman) this.player, packetplayinenchantitem.c()); this.player.activeContainer.a((EntityHuman) this.player, packetplayinenchantitem.c());
@@ -1227,6 +2264,43 @@ @@ -1321,6 +2353,43 @@
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45; boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty(); boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@ -1541,7 +1571,7 @@
if (flag1 && flag2) { if (flag1 && flag2) {
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {
@@ -1248,6 +2322,7 @@ @@ -1342,6 +2411,7 @@
@Override @Override
public void a(PacketPlayInTransaction packetplayintransaction) { public void a(PacketPlayInTransaction packetplayintransaction) {
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
@ -1549,15 +1579,15 @@
int i = this.player.activeContainer.windowId; int i = this.player.activeContainer.windowId;
if (i == packetplayintransaction.b() && this.k.getOrDefault(i, (short) (packetplayintransaction.c() + 1)) == packetplayintransaction.c() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { if (i == packetplayintransaction.b() && this.k.getOrDefault(i, (short) (packetplayintransaction.c() + 1)) == packetplayintransaction.c() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
@@ -1259,6 +2334,7 @@ @@ -1360,6 +2430,7 @@
@Override }
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer()); private void a(PacketPlayInUpdateSign packetplayinupdatesign, List<String> list) {
+ if (this.player.isFrozen()) return; // CraftBukkit + if (this.player.isFrozen()) return; // CraftBukkit
this.player.resetIdleTimer(); this.player.resetIdleTimer();
WorldServer worldserver = this.player.getWorldServer(); WorldServer worldserver = this.player.getWorldServer();
BlockPosition blockposition = packetplayinupdatesign.b(); BlockPosition blockposition = packetplayinupdatesign.b();
@@ -1275,14 +2351,30 @@ @@ -1376,12 +2447,28 @@
if (!tileentitysign.d() || tileentitysign.f() != this.player) { if (!tileentitysign.d() || tileentitysign.f() != this.player) {
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString()); PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString());
@ -1565,8 +1595,6 @@
return; return;
} }
String[] astring = packetplayinupdatesign.c();
+ // CraftBukkit start + // CraftBukkit start
+ Player player = this.server.getPlayer(this.player); + Player player = this.server.getPlayer(this.player);
+ int x = packetplayinupdatesign.b().getX(); + int x = packetplayinupdatesign.b().getX();
@ -1574,9 +1602,9 @@
+ int z = packetplayinupdatesign.b().getZ(); + int z = packetplayinupdatesign.b().getZ();
+ String[] lines = new String[4]; + String[] lines = new String[4];
+ +
for (int i = 0; i < astring.length; ++i) { for (int i = 0; i < list.size(); ++i) {
- tileentitysign.a(i, new ChatComponentText(EnumChatFormat.a(astring[i]))); - tileentitysign.a(i, new ChatComponentText((String) list.get(i)));
+ lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a(astring[i])).getString()); + lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a((String) list.get(i))).getString());
} }
+ SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); + SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
+ this.server.getPluginManager().callEvent(event); + this.server.getPluginManager().callEvent(event);
@ -1589,7 +1617,7 @@
tileentitysign.update(); tileentitysign.update();
worldserver.notify(blockposition, iblockdata, iblockdata, 3); worldserver.notify(blockposition, iblockdata, iblockdata, 3);
@@ -1292,6 +2384,7 @@ @@ -1391,6 +2478,7 @@
@Override @Override
public void a(PacketPlayInKeepAlive packetplayinkeepalive) { public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
@ -1597,7 +1625,7 @@
if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) { if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) {
int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive); int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive);
@@ -1306,7 +2399,17 @@ @@ -1405,7 +2493,17 @@
@Override @Override
public void a(PacketPlayInAbilities packetplayinabilities) { public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
@ -1616,7 +1644,7 @@
} }
@Override @Override
@@ -1315,8 +2418,50 @@ @@ -1414,8 +2512,50 @@
this.player.a(packetplayinsettings); this.player.a(packetplayinsettings);
} }

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/RegionLimitedWorldAccess.java --- a/net/minecraft/server/RegionLimitedWorldAccess.java
+++ b/net/minecraft/server/RegionLimitedWorldAccess.java +++ b/net/minecraft/server/RegionLimitedWorldAccess.java
@@ -234,6 +234,13 @@ @@ -236,6 +236,13 @@
@Override @Override
public boolean addEntity(Entity entity) { public boolean addEntity(Entity entity) {

View File

@ -296,7 +296,7 @@
} }
} }
} }
@@ -505,12 +694,25 @@ @@ -509,12 +698,25 @@
@Nullable @Nullable
@Override @Override
@ -322,7 +322,7 @@
TileEntity tileentity = null; TileEntity tileentity = null;
if (this.tickingTileEntities) { if (this.tickingTileEntities) {
@@ -545,6 +747,13 @@ @@ -549,6 +751,13 @@
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) { public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
if (!isOutsideWorld(blockposition)) { if (!isOutsideWorld(blockposition)) {
if (tileentity != null && !tileentity.isRemoved()) { if (tileentity != null && !tileentity.isRemoved()) {
@ -336,7 +336,7 @@
if (this.tickingTileEntities) { if (this.tickingTileEntities) {
tileentity.setLocation(this, blockposition); tileentity.setLocation(this, blockposition);
Iterator iterator = this.tileEntityListPending.iterator(); Iterator iterator = this.tileEntityListPending.iterator();
@@ -569,7 +778,7 @@ @@ -573,7 +782,7 @@
} }
public void removeTileEntity(BlockPosition blockposition) { public void removeTileEntity(BlockPosition blockposition) {

View File

@ -4,13 +4,13 @@
WorldServer getMinecraftWorld(); WorldServer getMinecraftWorld();
default void addAllEntities(Entity entity) { default void addAllEntities(Entity entity) {
- entity.co().forEach(this::addEntity); - entity.cp().forEach(this::addEntity);
+ // CraftBukkit start + // CraftBukkit start
+ this.addAllEntities(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT); + this.addAllEntities(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
} }
+ +
+ default boolean addAllEntities(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { + default boolean addAllEntities(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
+ entity.co().forEach((e) -> this.addEntity(e, reason)); + entity.cp().forEach((e) -> this.addEntity(e, reason));
+ return !entity.dead; + return !entity.dead;
+ } + }
+ // CraftBukkit end + // CraftBukkit end

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/WorldServer.java --- a/net/minecraft/server/WorldServer.java
+++ b/net/minecraft/server/WorldServer.java +++ b/net/minecraft/server/WorldServer.java
@@ -35,6 +35,18 @@ @@ -39,6 +39,18 @@
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -19,7 +19,7 @@
public class WorldServer extends World implements GeneratorAccessSeed { public class WorldServer extends World implements GeneratorAccessSeed {
public static final BlockPosition a = new BlockPosition(100, 50, 0); public static final BlockPosition a = new BlockPosition(100, 50, 0);
@@ -46,7 +58,7 @@ @@ -50,7 +62,7 @@
private final ChunkProviderServer chunkProvider; private final ChunkProviderServer chunkProvider;
boolean tickingEntities; boolean tickingEntities;
private final MinecraftServer server; private final MinecraftServer server;
@ -28,7 +28,7 @@
public boolean savingDisabled; public boolean savingDisabled;
private boolean everyoneSleeping; private boolean everyoneSleeping;
private int emptyTime; private int emptyTime;
@@ -63,8 +75,23 @@ @@ -67,8 +79,23 @@
private final StructureManager structureManager; private final StructureManager structureManager;
private final boolean Q; private final boolean Q;
@ -54,7 +54,7 @@
this.nextTickListBlock = new TickListServer<>(this, (block) -> { this.nextTickListBlock = new TickListServer<>(this, (block) -> {
return block == null || block.getBlockData().isAir(); return block == null || block.getBlockData().isAir();
}, IRegistry.BLOCK::getKey, this::b); }, IRegistry.BLOCK::getKey, this::b);
@@ -76,10 +103,17 @@ @@ -80,10 +107,17 @@
this.Q = flag1; this.Q = flag1;
this.server = minecraftserver; this.server = minecraftserver;
this.mobSpawners = list; this.mobSpawners = list;
@ -71,9 +71,9 @@
}); });
+ // CraftBukkit end + // CraftBukkit end
this.portalTravelAgent = new PortalTravelAgent(this); this.portalTravelAgent = new PortalTravelAgent(this);
this.P();
this.Q(); this.Q();
@@ -91,14 +125,48 @@ this.R();
@@ -95,14 +129,48 @@
iworlddataserver.setGameType(minecraftserver.getGamemode()); iworlddataserver.setGameType(minecraftserver.getGamemode());
} }
@ -124,7 +124,7 @@
public void a(int i, int j, boolean flag, boolean flag1) { public void a(int i, int j, boolean flag, boolean flag1) {
this.worldDataServer.a(i); this.worldDataServer.a(i);
@@ -189,6 +257,7 @@ @@ -193,6 +261,7 @@
this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F); this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F);
} }
@ -132,7 +132,7 @@
if (this.lastRainLevel != this.rainLevel) { if (this.lastRainLevel != this.rainLevel) {
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel)), this.getDimensionKey()); this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel)), this.getDimensionKey());
} }
@@ -207,18 +276,47 @@ @@ -211,18 +280,47 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
} }
@ -185,8 +185,8 @@
if (this.getGameRules().getBoolean(GameRules.DO_WEATHER_CYCLE)) { if (this.getGameRules().getBoolean(GameRules.DO_WEATHER_CYCLE)) {
this.clearWeather(); this.clearWeather();
} }
@@ -240,7 +338,7 @@ @@ -244,7 +342,7 @@
this.aj(); this.ak();
this.ticking = false; this.ticking = false;
gameprofilerfiller.exitEnter("entities"); gameprofilerfiller.exitEnter("entities");
- boolean flag3 = !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty(); - boolean flag3 = !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty();
@ -194,7 +194,7 @@
if (flag3) { if (flag3) {
this.resetEmptyTime(); this.resetEmptyTime();
@@ -259,6 +357,7 @@ @@ -263,6 +361,7 @@
Entity entity = (Entity) entry.getValue(); Entity entity = (Entity) entry.getValue();
Entity entity1 = entity.getVehicle(); Entity entity1 = entity.getVehicle();
@ -202,7 +202,7 @@
if (!this.server.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) { if (!this.server.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die(); entity.die();
} }
@@ -266,6 +365,7 @@ @@ -270,6 +369,7 @@
if (!this.server.getSpawnNPCs() && entity instanceof NPC) { if (!this.server.getSpawnNPCs() && entity instanceof NPC) {
entity.die(); entity.die();
} }
@ -210,7 +210,7 @@
gameprofilerfiller.enter("checkDespawn"); gameprofilerfiller.enter("checkDespawn");
if (!entity.dead) { if (!entity.dead) {
@@ -340,7 +440,7 @@ @@ -344,7 +444,7 @@
} }
private void wakeupPlayers() { private void wakeupPlayers() {
@ -219,7 +219,7 @@
entityplayer.wakeup(false, false); entityplayer.wakeup(false, false);
}); });
} }
@@ -367,14 +467,14 @@ @@ -371,14 +471,14 @@
entityhorseskeleton.t(true); entityhorseskeleton.t(true);
entityhorseskeleton.setAgeRaw(0); entityhorseskeleton.setAgeRaw(0);
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@ -236,7 +236,7 @@
} }
} }
@@ -385,11 +485,11 @@ @@ -389,11 +489,11 @@
BiomeBase biomebase = this.getBiome(blockposition); BiomeBase biomebase = this.getBiome(blockposition);
if (biomebase.a(this, blockposition1)) { if (biomebase.a(this, blockposition1)) {
@ -250,7 +250,7 @@
} }
if (flag && this.getBiome(blockposition1).c() == BiomeBase.Precipitation.RAIN) { if (flag && this.getBiome(blockposition1).c() == BiomeBase.Precipitation.RAIN) {
@@ -436,7 +536,7 @@ @@ -440,7 +540,7 @@
protected BlockPosition a(BlockPosition blockposition) { protected BlockPosition a(BlockPosition blockposition) {
BlockPosition blockposition1 = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, blockposition); BlockPosition blockposition1 = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, blockposition);
AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockposition1, new BlockPosition(blockposition1.getX(), this.getBuildHeight(), blockposition1.getZ()))).g(3.0D); AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockposition1, new BlockPosition(blockposition1.getX(), this.getBuildHeight(), blockposition1.getZ()))).g(3.0D);
@ -259,7 +259,7 @@
return entityliving != null && entityliving.isAlive() && this.e(entityliving.getChunkCoordinates()); return entityliving != null && entityliving.isAlive() && this.e(entityliving.getChunkCoordinates());
}); });
@@ -465,7 +565,7 @@ @@ -469,7 +569,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next(); EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -268,7 +268,7 @@
++i; ++i;
} else if (entityplayer.isSleeping()) { } else if (entityplayer.isSleeping()) {
++j; ++j;
@@ -483,10 +583,22 @@ @@ -487,10 +587,22 @@
} }
private void clearWeather() { private void clearWeather() {
@ -293,7 +293,7 @@
} }
public void resetEmptyTime() { public void resetEmptyTime() {
@@ -527,6 +639,7 @@ @@ -531,6 +643,7 @@
}); });
gameprofilerfiller.c("tickNonPassenger"); gameprofilerfiller.c("tickNonPassenger");
entity.tick(); entity.tick();
@ -301,7 +301,7 @@
gameprofilerfiller.exit(); gameprofilerfiller.exit();
} }
@@ -615,6 +728,7 @@ @@ -619,6 +732,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProvider(); ChunkProviderServer chunkproviderserver = this.getChunkProvider();
if (!flag1) { if (!flag1) {
@ -309,7 +309,7 @@
if (iprogressupdate != null) { if (iprogressupdate != null) {
iprogressupdate.a(new ChatMessage("menu.savingLevel")); iprogressupdate.a(new ChatMessage("menu.savingLevel"));
} }
@@ -626,11 +740,19 @@ @@ -630,11 +744,19 @@
chunkproviderserver.save(flag); chunkproviderserver.save(flag);
} }
@ -323,14 +323,14 @@
+ // CraftBukkit end + // CraftBukkit end
} }
private void ai() { private void aj() {
if (this.dragonBattle != null) { if (this.dragonBattle != null) {
- this.server.getSaveData().a(this.dragonBattle.a()); - this.server.getSaveData().a(this.dragonBattle.a());
+ this.worldDataServer.a(this.dragonBattle.a()); // CraftBukkit + this.worldDataServer.a(this.dragonBattle.a()); // CraftBukkit
} }
this.getChunkProvider().getWorldPersistentData().a(); this.getChunkProvider().getWorldPersistentData().a();
@@ -691,11 +813,24 @@ @@ -695,11 +817,24 @@
@Override @Override
public boolean addEntity(Entity entity) { public boolean addEntity(Entity entity) {
@ -357,7 +357,7 @@
} }
public void addEntityTeleport(Entity entity) { public void addEntityTeleport(Entity entity) {
@@ -745,13 +880,18 @@ @@ -749,13 +884,18 @@
this.registerEntity(entityplayer); this.registerEntity(entityplayer);
} }
@ -378,7 +378,7 @@
IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer); IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer);
if (!(ichunkaccess instanceof Chunk)) { if (!(ichunkaccess instanceof Chunk)) {
@@ -780,7 +920,7 @@ @@ -784,7 +924,7 @@
if (entity1 == null) { if (entity1 == null) {
return false; return false;
} else { } else {
@ -387,7 +387,7 @@
return true; return true;
} }
} }
@@ -809,11 +949,16 @@ @@ -813,11 +953,16 @@
} }
public boolean addAllEntitiesSafely(Entity entity) { public boolean addAllEntitiesSafely(Entity entity) {
@ -397,7 +397,7 @@
+ +
+ public boolean addAllEntitiesSafely(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { + public boolean addAllEntitiesSafely(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
+ // CraftBukkit end + // CraftBukkit end
if (entity.co().anyMatch(this::isUUIDTaken)) { if (entity.cp().anyMatch(this::isUUIDTaken)) {
return false; return false;
} else { } else {
- this.addAllEntities(entity); - this.addAllEntities(entity);
@ -406,7 +406,7 @@
} }
} }
@@ -863,10 +1008,17 @@ @@ -867,10 +1012,17 @@
} }
this.getScoreboard().a(entity); this.getScoreboard().a(entity);
@ -424,7 +424,7 @@
} }
private void registerEntity(Entity entity) { private void registerEntity(Entity entity) {
@@ -887,9 +1039,16 @@ @@ -891,9 +1043,16 @@
this.entitiesByUUID.put(entity.getUniqueID(), entity); this.entitiesByUUID.put(entity.getUniqueID(), entity);
this.getChunkProvider().addEntity(entity); this.getChunkProvider().addEntity(entity);
@ -441,7 +441,7 @@
} }
} }
@@ -919,10 +1078,33 @@ @@ -923,10 +1082,33 @@
this.everyoneSleeping(); this.everyoneSleeping();
} }
@ -475,7 +475,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next(); EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -931,6 +1113,12 @@ @@ -935,6 +1117,12 @@
double d1 = (double) blockposition.getY() - entityplayer.locY(); double d1 = (double) blockposition.getY() - entityplayer.locY();
double d2 = (double) blockposition.getZ() - entityplayer.locZ(); double d2 = (double) blockposition.getZ() - entityplayer.locZ();
@ -488,7 +488,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
} }
@@ -991,10 +1179,20 @@ @@ -995,10 +1183,20 @@
@Override @Override
public Explosion createExplosion(@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 createExplosion(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
@ -509,7 +509,7 @@
if (explosion_effect == Explosion.Effect.NONE) { if (explosion_effect == Explosion.Effect.NONE) {
explosion.clearBlocks(); explosion.clearBlocks();
} }
@@ -1059,13 +1257,20 @@ @@ -1063,13 +1261,20 @@
} }
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
@ -532,7 +532,7 @@
++j; ++j;
} }
} }
@@ -1107,7 +1312,7 @@ @@ -1111,7 +1316,7 @@
@Nullable @Nullable
public BlockPosition a(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) { public BlockPosition a(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
@ -541,7 +541,7 @@
} }
@Nullable @Nullable
@@ -1145,7 +1350,13 @@ @@ -1149,7 +1354,13 @@
@Override @Override
public WorldMap a(String s) { public WorldMap a(String s) {
return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().b(() -> { return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().b(() -> {
@ -556,7 +556,7 @@
}, s); }, s);
} }
@@ -1456,6 +1667,11 @@ @@ -1460,6 +1671,11 @@
@Override @Override
public void update(BlockPosition blockposition, Block block) { public void update(BlockPosition blockposition, Block block) {
if (!this.isDebugWorld()) { if (!this.isDebugWorld()) {
@ -568,7 +568,7 @@
this.applyPhysics(blockposition, block); this.applyPhysics(blockposition, block);
} }
@@ -1470,12 +1686,12 @@ @@ -1474,12 +1690,12 @@
} }
public boolean isFlatWorld() { public boolean isFlatWorld() {
@ -583,7 +583,38 @@
} }
@Nullable @Nullable
@@ -1494,16 +1710,32 @@ @@ -1499,9 +1715,9 @@
@VisibleForTesting
public String F() {
- return String.format("players: %s, entities: %d [%s], block_entities: %d [%s], block_ticks: %d, fluid_ticks: %d, chunk_source: %s", this.players.size(), this.entitiesById.size(), a((Collection) this.entitiesById.values(), (entity) -> {
+ return String.format("players: %s, entities: %d [%s], block_entities: %d [%s], block_ticks: %d, fluid_ticks: %d, chunk_source: %s", this.players.size(), this.entitiesById.size(), a(this.entitiesById.values(), (entity) -> { // CraftBukkit - decompile error
return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType());
- }), this.tileEntityListTick.size(), a((Collection) this.tileEntityListTick, (tileentity) -> {
+ }), this.tileEntityListTick.size(), a(this.tileEntityListTick, (tileentity) -> { // CraftBukkit - decompile error
return IRegistry.BLOCK_ENTITY_TYPE.getKey(tileentity.getTileType());
}), this.getBlockTickList().a(), this.getFluidTickList().a(), this.P());
}
@@ -1509,7 +1725,7 @@
private static <T> String a(Collection<T> collection, Function<T, MinecraftKey> function) {
try {
Object2IntOpenHashMap<MinecraftKey> object2intopenhashmap = new Object2IntOpenHashMap();
- Iterator iterator = collection.iterator();
+ Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1518,7 +1734,8 @@
object2intopenhashmap.addTo(minecraftkey, 1);
}
- return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> {
+ // CraftBukkit - decompile error
+ return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<MinecraftKey>::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> {
return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue();
}).collect(Collectors.joining(","));
} catch (Exception exception) {
@@ -1527,16 +1744,32 @@
} }
public static void a(WorldServer worldserver) { public static void a(WorldServer worldserver) {

View File

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.16.3-R0.1-SNAPSHOT</version> <version>1.16.4-R0.1-SNAPSHOT</version>
<name>CraftBukkit</name> <name>CraftBukkit</name>
<url>https://www.spigotmc.org/</url> <url>https://www.spigotmc.org/</url>
@ -12,8 +12,8 @@
<skipTests>true</skipTests> <skipTests>true</skipTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<api.version>unknown</api.version> <api.version>unknown</api.version>
<minecraft.version>1.16.3</minecraft.version> <minecraft.version>1.16.4</minecraft.version>
<minecraft_version>1_16_R2</minecraft_version> <minecraft_version>1_16_R3</minecraft_version>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
</properties> </properties>

View File

@ -177,11 +177,11 @@ public class Main {
useConsole = false; useConsole = false;
} }
if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
Date buildDate = new Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L); Date buildDate = new Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L);
Calendar deadline = Calendar.getInstance(); Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -21); deadline.add(Calendar.DAY_OF_YEAR, -7);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***"); System.err.println("*** Error, this build is outdated ***");
System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");

View File

@ -19,13 +19,13 @@ public class CraftMinecartFurnace extends CraftMinecart implements PoweredMineca
@Override @Override
public int getFuel() { public int getFuel() {
return getHandle().e; return getHandle().fuel;
} }
@Override @Override
public void setFuel(int fuel) { public void setFuel(int fuel) {
Preconditions.checkArgument(fuel >= 0, "ticks cannot be negative"); Preconditions.checkArgument(fuel >= 0, "ticks cannot be negative");
getHandle().e = fuel; getHandle().fuel = fuel;
} }
@Override @Override

View File

@ -1279,9 +1279,7 @@ public class CraftEventFactory {
human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity()); human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity());
} }
public static ItemStack handleEditBookEvent(EntityPlayer player, EnumItemSlot slot, ItemStack itemInHand, ItemStack newBookItem) { public static ItemStack handleEditBookEvent(EntityPlayer player, int itemInHandIndex, ItemStack itemInHand, ItemStack newBookItem) {
int itemInHandIndex = (slot == EnumItemSlot.MAINHAND) ? player.inventory.itemInHandIndex : -1;
PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), itemInHandIndex, (BookMeta) CraftItemStack.getItemMeta(itemInHand), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == Items.WRITTEN_BOOK); PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), itemInHandIndex, (BookMeta) CraftItemStack.getItemMeta(itemInHand), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == Items.WRITTEN_BOOK);
player.world.getServer().getPluginManager().callEvent(editBookEvent); player.world.getServer().getPluginManager().callEvent(editBookEvent);

View File

@ -224,7 +224,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
* @return string * @return string
*/ */
public String getMappingsVersion() { public String getMappingsVersion() {
return "09f04031f41cb54f1077c6ac348cc220"; return "da85101b34b252659e3ddf10c0c57cc9";
} }
@Override @Override