more progress

This commit is contained in:
Spottedleaf
2020-06-25 04:00:35 -07:00
parent 5287c1ba7c
commit fbbf45ec42
35 changed files with 305 additions and 319 deletions

View File

@@ -38,5 +38,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final boolean isInBounds(BlockPosition blockposition) { return this.a(blockposition); } // Paper - OBFHELPER + public final boolean isInBounds(BlockPosition blockposition) { return this.a(blockposition); } // Paper - OBFHELPER
public boolean a(BlockPosition blockposition) { public boolean a(BlockPosition blockposition) {
return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f(); return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h();
} }

View File

@@ -30,21 +30,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce {
@Override @Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
+ if (!worldserver.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice + if (!worldserver.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice
if ((random.nextInt(3) == 0 || this.a(worldserver, blockposition, 4)) && worldserver.getLightLevel(blockposition) > 11 - (Integer) iblockdata.get(BlockIceFrost.a) - iblockdata.b((IBlockAccess) worldserver, blockposition) && this.e(iblockdata, (World) worldserver, blockposition)) { if ((random.nextInt(3) == 0 || this.a(worldserver, blockposition, 4)) && worldserver.getLightLevel(blockposition) > 11 - (Integer) iblockdata.get(BlockIceFrost.a) - iblockdata.b((IBlockAccess) worldserver, blockposition) && this.e(iblockdata, (World) worldserver, blockposition)) {
BlockPosition.PooledBlockPosition blockposition_pooledblockposition = BlockPosition.PooledBlockPosition.r(); BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
Throwable throwable = null; EnumDirection[] aenumdirection = EnumDirection.values();
@@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce {
IBlockData iblockdata1 = worldserver.getType(blockposition_pooledblockposition); IBlockData iblockdata1 = worldserver.getType(blockposition_mutableblockposition);
if (iblockdata1.getBlock() == this && !this.e(iblockdata1, (World) worldserver, blockposition_pooledblockposition)) { if (iblockdata1.a((Block) this) && !this.e(iblockdata1, (World) worldserver, blockposition_mutableblockposition)) {
- worldserver.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, 20, 40)); - worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, 20, 40));
+ worldserver.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay + worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
}
} }
} catch (Throwable throwable1) {
@@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce {
} }
} else { } else {

View File

@@ -28,8 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
blockposition = new BlockPosition(d0, this.locY(), d1); blockposition = new BlockPosition(d0, this.locY(), d1);
// CraftBukkit start // CraftBukkit start
- EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, blockposition, 128); - EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, 128);
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, blockposition, world.paperConfig.portalSearchRadius); // Paper - use portal search radius + EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, worldserver.paperConfig.portalSearchRadius); // Paper - use portal search radius
if (event == null) { if (event == null) {
return null; return null;
} }
@@ -40,11 +40,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start // CraftBukkit start
Location enter = this.getBukkitEntity().getLocation(); Location enter = this.getBukkitEntity().getLocation();
Location exit = (worldserver1 == null) ? null : new Location(worldserver1.getWorld(), d0, d1, d2, f1, f); Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), d0, d1, d2, f1, f);
- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, dimensionmanager.getType() == DimensionManager.THE_END ? 0 : 16); - PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, resourcekey == World.THE_END ? 0 : 16);
+ int configuredSearchRadius = (worldserver1 == null ? worldserver : worldserver1).paperConfig.portalSearchRadius; + PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, worldserver.paperConfig.portalSearchRadius, true, resourcekey == World.THE_END ? 0 : worldserver.paperConfig.portalCreateRadius);
+ int configuredCreateRadius = (worldserver1 == null ? worldserver : worldserver1).paperConfig.portalCreateRadius;
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, configuredSearchRadius, true, dimensionmanager.getType() == DimensionManager.THE_END ? 0 : configuredCreateRadius); // Paper - configurable portal search radius
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled() || event.getTo() == null) { if (event.isCancelled() || event.getTo() == null) {
return null; return null;
@@ -63,10 +61,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable @Nullable
@@ -0,0 +0,0 @@ public class PortalTravelAgent { @@ -0,0 +0,0 @@ public class PortalTravelAgent {
// CraftBukkit end // CraftBukkit end
VillagePlace villageplace = this.world.B(); VillagePlace villageplace = this.world.x();
- villageplace.a(this.world, blockposition, 128); - villageplace.a(this.world, blockposition, 128);
+ villageplace.a(this.world, blockposition, searchRadius); // Paper - This impacts the # of chunks searched for entries + villageplace.a(this.world, blockposition, searchRadius); // Paper - This impacts the # of chunks searched for entries
List<VillagePlaceRecord> list = (List) villageplace.b((villageplacetype) -> { List<VillagePlaceRecord> list = (List) villageplace.b((villageplacetype) -> {
return villageplacetype == VillagePlaceType.u; return villageplacetype == VillagePlaceType.v;
}, blockposition, searchRadius, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); // CraftBukkit - searchRadius }, blockposition, searchRadius, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); // CraftBukkit - searchRadius

View File

@@ -83,7 +83,7 @@ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ import java.util.function.BooleanSupplier; @@ -0,0 +0,0 @@ import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -124,14 +124,6 @@ diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.world.checkSession();
} catch (ExceptionWorldConflict exceptionworldconflict) {
PlayerChunkMap.LOGGER.error("Couldn't save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exceptionworldconflict); // Paper
return false;
}
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
return true; return true;
} catch (Exception exception) { } catch (Exception exception) {
@@ -173,15 +165,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
@@ -0,0 +0,0 @@ public final class SpawnerCreature { @@ -0,0 +0,0 @@ public final class SpawnerCreature {
entityinsentient = (EntityInsentient) entity; }
} catch (Exception exception) { } catch (Exception exception) {
SpawnerCreature.LOGGER.warn("Failed to create mob", exception); SpawnerCreature.LOGGER.warn("Failed to create mob", exception);
+ ServerInternalException.reportInternalException(exception); // Paper + ServerInternalException.reportInternalException(exception); // Paper
return; return null;
} }
}
@@ -0,0 +0,0 @@ public final class SpawnerCreature { @@ -0,0 +0,0 @@ public final class SpawnerCreature {
entity = biomebase_biomemeta.b.a(generatoraccess.getMinecraftWorld()); entity = biomebase_biomemeta.c.a(generatoraccess.getMinecraftWorld());
} catch (Exception exception) { } catch (Exception exception) {
SpawnerCreature.LOGGER.warn("Failed to create mob", exception); SpawnerCreature.LOGGER.warn("Failed to create mob", exception);
+ ServerInternalException.reportInternalException(exception); // Paper + ServerInternalException.reportInternalException(exception); // Paper
@@ -200,8 +192,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.Iterator; import java.util.Iterator;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -0,0 +0,0 @@ public class VillageSiege { @@ -0,0 +0,0 @@ public class VillageSiege implements MobSpawner {
entityzombie.prepare(worldserver, worldserver.getDamageScaler(new BlockPosition(entityzombie)), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); entityzombie.prepare(worldserver, worldserver.getDamageScaler(entityzombie.getChunkCoordinates()), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null);
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper + ServerInternalException.reportInternalException(exception); // Paper
@@ -212,16 +204,17 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ package net.minecraft.server; @@ -0,0 +0,0 @@
package net.minecraft.server;
import co.aikar.timings.Timing; +import co.aikar.timings.Timing;
import co.aikar.timings.Timings; +import co.aikar.timings.Timings;
+import com.destroystokyo.paper.event.server.ServerExceptionEvent; +import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerInternalException; +import com.destroystokyo.paper.exception.ServerInternalException;
+import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.serialization.Codec;
import java.io.IOException; import java.io.IOException;
import java.util.Collection;
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
gameprofilerfiller.exit(); gameprofilerfiller.exit();
} catch (Throwable throwable) { } catch (Throwable throwable) {

View File

@@ -10,9 +10,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/HandshakeListener.java --- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
this.b.close(chatmessage); // CraftBukkit end
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
private final MinecraftServer b;
- private final NetworkManager c;
+ private final NetworkManager c; final NetworkManager getNetworkManager() { return this.c; } // Paper - OBFHELPER
public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.b = minecraftserver;
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
this.c.close(chatmessage);
} else { } else {
this.b.setPacketListener(new LoginListener(this.a, this.b)); this.c.setPacketListener(new LoginListener(this.b, this.c));
+ // Paper start - handshake event + // Paper start - handshake event
+ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee; + boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee;
+ boolean handledByEvent = false; + boolean handledByEvent = false;
@@ -23,15 +32,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // If we've failed somehow, let the client know so and go no further. + // If we've failed somehow, let the client know so and go no further.
+ if (event.isFailed()) { + if (event.isFailed()) {
+ chatmessage = new ChatMessage(event.getFailMessage()); + chatmessage = new ChatMessage(event.getFailMessage());
+ this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); + this.getNetworkManager().sendPacket(new PacketLoginOutDisconnect(chatmessage));
+ this.b.close(chatmessage); + this.getNetworkManager().close(chatmessage);
+ return; + return;
+ } + }
+ +
+ packethandshakinginsetprotocol.hostname = event.getServerHostname(); + packethandshakinginsetprotocol.hostname = event.getServerHostname();
+ this.b.socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.b.getSocketAddress()).getPort()); + this.getNetworkManager().socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.getNetworkManager().getSocketAddress()).getPort());
+ this.b.spoofedUUID = event.getUniqueId(); + this.getNetworkManager().spoofedUUID = event.getUniqueId();
+ this.b.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class); + this.getNetworkManager().spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class);
+ handledByEvent = true; // Hooray, we did it! + handledByEvent = true; // Hooray, we did it!
+ } + }
+ } + }

View File

@@ -33,9 +33,9 @@ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java --- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile { @@ -0,0 +0,0 @@ public abstract class EntityArrow extends IProjectile {
protected void i() { protected void h() {
++this.despawnCounter; ++this.despawnCounter;
- if (this.despawnCounter >= ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)) { // Spigot - if (this.despawnCounter >= ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)) { // Spigot
+ if (this.despawnCounter >= (fromPlayer == PickupStatus.CREATIVE_ONLY ? world.paperConfig.creativeArrowDespawnRate : (fromPlayer == PickupStatus.DISALLOWED ? world.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init? + if (this.despawnCounter >= (fromPlayer == PickupStatus.CREATIVE_ONLY ? world.paperConfig.creativeArrowDespawnRate : (fromPlayer == PickupStatus.DISALLOWED ? world.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init?

View File

@@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final Map<String,EntityPlayer> playersByName = new java.util.HashMap<>(); private final Map<String,EntityPlayer> playersByName = new java.util.HashMap<>();
+ @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule + @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule
public PlayerList(MinecraftServer minecraftserver, int i) { public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, int i) {
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this); this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
} }
@@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
// CraftBukkit - Moved from above, added world // CraftBukkit - Moved from above, added world
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ()); PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), worldserver1.worldDataServer.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
} }
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
entityplayer.playerTick(); // SPIGOT-924 entityplayer.playerTick(); // SPIGOT-924

View File

@@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java --- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr @@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Integer> playerIdleTimeout;
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList; public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
public final GeneratorSettings generatorSettings;
+ public final String rconIp; // Paper - Add rcon ip + public final String rconIp; // Paper - Add rcon ip
+ +
@@ -19,9 +19,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public DedicatedServerProperties(Properties properties, OptionSet optionset) { public DedicatedServerProperties(Properties properties, OptionSet optionset) {
super(properties, optionset); super(properties, optionset);
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr @@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
}, 29999984);
this.playerIdleTimeout = this.b("player-idle-timeout", 0); this.playerIdleTimeout = this.b("player-idle-timeout", 0);
this.whiteList = this.b("white-list", false); this.whiteList = this.b("white-list", false);
this.generatorSettings = GeneratorSettings.a(properties);
+ // Paper start - Configurable rcon ip + // Paper start - Configurable rcon ip
+ final String rconIp = this.getSettingIfExists("rcon.ip"); + final String rconIp = this.getSettingIfExists("rcon.ip");
+ this.rconIp = rconIp == null ? this.serverIp : rconIp; + this.rconIp = rconIp == null ? this.serverIp : rconIp;
@@ -50,10 +50,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java +++ b/src/main/java/net/minecraft/server/RemoteControlListener.java
@@ -0,0 +0,0 @@ public class RemoteControlListener extends RemoteConnectionThread { @@ -0,0 +0,0 @@ public class RemoteControlListener extends RemoteConnectionThread {
this.h = dedicatedserverproperties.rconPort; this.e = dedicatedserverproperties.rconPort;
this.k = dedicatedserverproperties.rconPassword; this.h = dedicatedserverproperties.rconPassword;
- this.i = iminecraftserver.e_(); - this.f = iminecraftserver.h_();
+ this.i = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip + this.f = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip
if (this.i.isEmpty()) { if (this.f.isEmpty()) {
this.i = "0.0.0.0"; this.f = "0.0.0.0";
} }

View File

@@ -37,8 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (fromWorld == toWorld) { if (fromWorld == toWorld) {
entity.playerConnection.teleport(to); entity.playerConnection.teleport(to);
} else { } else {
- server.getHandle().moveToWorld(entity, toWorld.getWorldProvider().getDimensionManager(), true, to, true); - server.getHandle().moveToWorld(entity, toWorld, true, to, true);
+ server.getHandle().moveToWorld(entity, toWorld.getWorldProvider().getDimensionManager(), true, to, !toWorld.paperConfig.disableTeleportationSuffocationCheck); + server.getHandle().moveToWorld(entity, toWorld, true, to, !toWorld.paperConfig.disableTeleportationSuffocationCheck); // Paper
} }
return true; return true;
} }

View File

@@ -25,7 +25,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
blockposition = this.a(this.a(j, 0, k, 15)); blockposition = this.a(this.a(j, 0, k, 15));
if (this.isRainingAt(blockposition)) { if (this.isRainingAt(blockposition)) {
DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition); DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition);

View File

@@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
this.a(this.getRaisedHand(), itemstack); this.a(this.getRaisedHand(), itemstack);
// CraftBukkit end // CraftBukkit end
this.dH(); this.clearActiveItem();
+ // Paper start - if the replacement is anything but the default, update the client inventory + // Paper start - if the replacement is anything but the default, update the client inventory
+ if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) { + if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) {
+ ((EntityPlayer) this).getBukkitEntity().updateInventory(); + ((EntityPlayer) this).getBukkitEntity().updateInventory();

View File

@@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java --- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract { @@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
private BlockPosition q; private BlockPosition p;
private int r; private int q;
private float s; private float r;
- private final Pathfinder t; - private final Pathfinder s;
+ private final Pathfinder t; public Pathfinder getPathfinder() { return this.t; } // Paper - OBFHELPER + private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER
public NavigationAbstract(EntityInsentient entityinsentient, World world) { public NavigationAbstract(EntityInsentient entityinsentient, World world) {
this.g = Vec3D.a; this.g = Vec3D.a;
@@ -22,47 +22,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/Pathfinder.java --- a/src/main/java/net/minecraft/server/Pathfinder.java
+++ b/src/main/java/net/minecraft/server/Pathfinder.java +++ b/src/main/java/net/minecraft/server/Pathfinder.java
@@ -0,0 +0,0 @@ public class Pathfinder { @@ -0,0 +0,0 @@ public class Pathfinder {
private final Set<PathPoint> b = Sets.newHashSet();
private final PathPoint[] c = new PathPoint[32]; private final PathPoint[] a = new PathPoint[32];
private final int d; private final int b;
- private final PathfinderAbstract e; - private final PathfinderAbstract c;
+ private final PathfinderAbstract e; public PathfinderAbstract getPathfinder() { return this.e; } // Paper - OBFHELPER + private final PathfinderAbstract c; public PathfinderAbstract getPathfinder() { return this.c; } // Paper - OBFHELPER
private final Path d = new Path();
public Pathfinder(PathfinderAbstract pathfinderabstract, int i) { public Pathfinder(PathfinderAbstract pathfinderabstract, int i) {
this.e = pathfinderabstract;
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java --- a/src/main/java/net/minecraft/server/PathfinderNormal.java
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java +++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
@@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract { @@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract {
PathType pathtype = c(iblockaccess, i, j, k); for (int j1 = -1; j1 <= 1; ++j1) {
if (l != 0 || j1 != 0) {
blockposition_mutableblockposition.d(i + l, j + i1, k + j1);
- IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition);
+ // Paper start
+ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition_mutableblockposition);
+ if (iblockdata == null) {
+ pathtype = PathType.BLOCKED;
+ } else {
+ // Paper end
if (pathtype == PathType.OPEN && j >= 1) { if (iblockdata.a(Blocks.CACTUS)) {
- Block block = iblockaccess.getType(new BlockPosition(i, j - 1, k)).getBlock(); return PathType.DANGER_CACTUS;
+ Block block = iblockaccess.getBlockIfLoaded(new BlockPosition(i, j - 1, k)); // Paper
+ if (block == null) return PathType.BLOCKED; // Paper
PathType pathtype1 = c(iblockaccess, i, j - 1, k);
pathtype = pathtype1 != PathType.WALKABLE && pathtype1 != PathType.OPEN && pathtype1 != PathType.WATER && pathtype1 != PathType.LAVA ? PathType.WALKABLE : PathType.OPEN;
@@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract { @@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract {
for (int i1 = -1; i1 <= 1; ++i1) { if (fluid.a((Tag) TagsFluid.LAVA)) {
for (int j1 = -1; j1 <= 1; ++j1) { return PathType.LAVA;
if (l != 0 || j1 != 0) { }
- Block block = iblockaccess.getType(blockposition_pooledblockposition.d(l + i, i1 + j, j1 + k)).getBlock(); + } // Paper
- }
+ // Paper start }
+ Block block = iblockaccess.getBlockIfLoaded(blockposition_pooledblockposition.d(l + i, i1 + j, j1 + k)); }
+ if (block == null) {
+ pathtype = PathType.BLOCKED;
+ } else
+ // Paper end
if (block == Blocks.CACTUS) {
pathtype = PathType.DANGER_CACTUS;
} else if (block != Blocks.FIRE && block != Blocks.LAVA) {
@@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract { @@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract {
}
protected static PathType c(IBlockAccess iblockaccess, int i, int j, int k) { protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) {
BlockPosition blockposition = new BlockPosition(i, j, k);
- IBlockData iblockdata = iblockaccess.getType(blockposition); - IBlockData iblockdata = iblockaccess.getType(blockposition);
+ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper + IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper
+ if (iblockdata == null) return PathType.BLOCKED; // Paper + if (iblockdata == null) return PathType.BLOCKED; // Paper

View File

@@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-public class TileEntitySkull extends TileEntity implements ITickable { -public class TileEntitySkull extends TileEntity implements ITickable {
+public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable +public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable
public GameProfile gameProfile; @Nullable
private int b; private static UserCache userCache;
@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity implements ITickable { @@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity implements ITickable {
} }
@@ -24,5 +24,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- @Override - @Override
+ // Paper - remove override + // Paper - remove override
public void tick() { public void tick() {
Block block = this.getBlock().getBlock(); IBlockData iblockdata = this.getBlock();

View File

@@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
if (entity instanceof EntityInsentient) { if (entity instanceof EntityInsentient) {
this.navigators.remove(((EntityInsentient) entity).getNavigation()); this.navigators.remove(((EntityInsentient) entity).getNavigation());
} }
@@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entity.valid = false; // CraftBukkit entity.valid = false; // CraftBukkit
} }
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
entity.origin = entity.getBukkitEntity().getLocation(); entity.origin = entity.getBukkitEntity().getLocation();
} }
// Paper end // Paper end

View File

@@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public PathEntity a(Entity entity, int i) { public PathEntity a(Entity entity, int i) {
- return this.a(new BlockPosition(entity), i); - return this.a(entity.getChunkCoordinates(), i);
+ return this.a(new BlockPosition(entity), entity, i); // Paper - Forward target entity + return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
} }
private int t() { private int t() {
@@ -46,8 +46,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable @Nullable
public PathEntity a(Entity entity, int i) { public PathEntity a(Entity entity, int i) {
- return this.a(ImmutableSet.of(new BlockPosition(entity)), 16, true, i); - return this.a(ImmutableSet.of(entity.getChunkCoordinates()), 16, true, i);
+ return this.a(ImmutableSet.of(new BlockPosition(entity)), entity, 16, true, i); // Paper + return this.a(ImmutableSet.of(entity.getChunkCoordinates()), entity, 16, true, i); // Paper
} }
@Nullable @Nullable
@@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return null; return null;
} else if (this.a.locY() < 0.0D) { } else if (this.a.locY() < 0.0D) {
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract { @@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
} else if (this.c != null && !this.c.b() && set.contains(this.q)) { } else if (this.c != null && !this.c.b() && set.contains(this.p)) {
return this.c; return this.c;
} else { } else {
+ // Paper start - Pathfind event + // Paper start - Pathfind event
@@ -82,8 +82,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
this.b.getMethodProfiler().enter("pathfind"); this.b.getMethodProfiler().enter("pathfind");
float f = (float) this.p.getValue(); float f = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);
BlockPosition blockposition = flag ? (new BlockPosition(this.a)).up() : new BlockPosition(this.a); BlockPosition blockposition = flag ? this.a.getChunkCoordinates().up() : this.a.getChunkCoordinates();
diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NavigationFlying.java --- a/src/main/java/net/minecraft/server/NavigationFlying.java
@@ -92,8 +92,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public PathEntity a(Entity entity, int i) { public PathEntity a(Entity entity, int i) {
- return this.a(new BlockPosition(entity), i); - return this.a(entity.getChunkCoordinates(), i);
+ return this.a(new BlockPosition(entity), entity, i); // Paper - Forward target entity + return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
} }
@Override @Override

View File

@@ -16,28 +16,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private static final Map<IBlockAccess, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = new WeakHashMap(); - private static final Map<IBlockAccess, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = new WeakHashMap();
+ // Paper - Move the mapped list to World + // Paper - Move the mapped list to World
protected BlockRedstoneTorch(Block.Info block_info) { protected BlockRedstoneTorch(BlockBase.Info blockbase_info) {
super(block_info); super(blockbase_info, ParticleParamRedstone.a);
@@ -0,0 +0,0 @@ public class BlockRedstoneTorch extends BlockTorch { @@ -0,0 +0,0 @@ public class BlockRedstoneTorch extends BlockTorch {
} @Override
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random, boolean flag) { boolean flag = this.a((World) worldserver, blockposition, iblockdata);
- List list = (List) BlockRedstoneTorch.b.get(world); - List list = (List) BlockRedstoneTorch.b.get(worldserver);
+ // Paper start -
+ java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos = world.redstoneUpdateInfos; - while (list != null && !list.isEmpty() && worldserver.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) {
- while (list != null && !list.isEmpty() && world.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) {
- list.remove(0); - list.remove(0);
+ // Paper start
+ java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos = worldserver.redstoneUpdateInfos;
+ if (redstoneUpdateInfos != null) { + if (redstoneUpdateInfos != null) {
+ BlockRedstoneTorch.RedstoneUpdateInfo curr; + BlockRedstoneTorch.RedstoneUpdateInfo curr;
+ while ((curr = redstoneUpdateInfos.peek()) != null && world.getTime() - curr.getTime() > 60L) { + while ((curr = redstoneUpdateInfos.peek()) != null && worldserver.getTime() - curr.getTime() > 60L) {
+ redstoneUpdateInfos.poll(); + redstoneUpdateInfos.poll();
+ } + }
} }
+ // Paper end + // Paper end
// CraftBukkit start // CraftBukkit start
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); org.bukkit.plugin.PluginManager manager = worldserver.getServer().getPluginManager();
@@ -0,0 +0,0 @@ public class BlockRedstoneTorch extends BlockTorch { @@ -0,0 +0,0 @@ public class BlockRedstoneTorch extends BlockTorch {
} }

View File

@@ -11,7 +11,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// CraftBukkit start // CraftBukkit start
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot

View File

@@ -13,11 +13,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/DefinedStructure.java --- a/src/main/java/net/minecraft/server/DefinedStructure.java
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java +++ b/src/main/java/net/minecraft/server/DefinedStructure.java
@@ -0,0 +0,0 @@ public class DefinedStructure { @@ -0,0 +0,0 @@ public class DefinedStructure {
definedstructure_blockinfo.c.setInt("x", blockposition1.getX()); definedstructure_blockinfo.c.setLong("LootTableSeed", random.nextLong());
definedstructure_blockinfo.c.setInt("y", blockposition1.getY()); }
definedstructure_blockinfo.c.setInt("z", blockposition1.getZ());
+ tileentity.isLoadingStructure = true; // Paper + tileentity.isLoadingStructure = true; // Paper
tileentity.load(definedstructure_blockinfo.c); tileentity.load(definedstructure_blockinfo.b, definedstructure_blockinfo.c);
tileentity.a(definedstructureinfo.c()); tileentity.a(definedstructureinfo.c());
tileentity.a(definedstructureinfo.d()); tileentity.a(definedstructureinfo.d());
+ tileentity.isLoadingStructure = false; // Paper + tileentity.isLoadingStructure = false; // Paper
@@ -44,8 +44,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
try { try {
- IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); - IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s);
+ //IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - move down - the old format might throw a json error + //IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - move down - the old format might throw a json error
- if (oldSign) { - if (oldSign) {
+ if (oldSign && !isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted + if (oldSign && !isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted
@@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
continue; continue;
} }
// CraftBukkit end // CraftBukkit end
+ IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - after old sign + IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - after old sign
if (this.world instanceof WorldServer) { if (this.world instanceof WorldServer) {
try { try {

View File

@@ -21,18 +21,18 @@ diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java --- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -0,0 +0,0 @@ import com.mojang.brigadier.StringReader; @@ -0,0 +0,0 @@ import com.mojang.serialization.Codec;
import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.codecs.RecordCodecBuilder;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
+import java.util.Collections; +import java.util.Collections;
+import java.util.Comparator; +import java.util.Comparator;
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import java.util.Random; import java.util.Optional;
@@ -0,0 +0,0 @@ public final class ItemStack { @@ -0,0 +0,0 @@ public final class ItemStack {
return decimalformat; private ShapeDetectorBlock n;
} private boolean o;
+ // Paper start + // Paper start
+ private static final java.util.Comparator<? super NBTTagCompound> enchantSorter = java.util.Comparator.comparing(o -> o.getString("id")); + private static final java.util.Comparator<? super NBTTagCompound> enchantSorter = java.util.Comparator.comparing(o -> o.getString("id"));
@@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start - make defensive copy as this data may be coming from the save thread // CraftBukkit start - make defensive copy as this data may be coming from the save thread
this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone(); this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone();
+ processEnchantOrder(this.tag); // Paper + processEnchantOrder(this.tag); // Paper
this.getItem().a(this.tag); this.getItem().b(this.tag);
// CraftBukkit end // CraftBukkit end
} }
@@ -0,0 +0,0 @@ public final class ItemStack { @@ -0,0 +0,0 @@ public final class ItemStack {

View File

@@ -8,22 +8,21 @@ diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java --- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -0,0 +0,0 @@ import org.bukkit.inventory.MainHand;
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger LOGGER = LogManager.getLogger();
- public String locale = "en_us"; // CraftBukkit - lowercase
+ public String locale = null; // CraftBukkit - lowercase // Paper - default to null
public PlayerConnection playerConnection;
public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager;
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return s;
}
- public String locale = "en_us"; // CraftBukkit - add, lowercase
+ public String locale = null; // CraftBukkit - lowercase // Paper - default to null
public void a(PacketPlayInSettings packetplayinsettings) {
// CraftBukkit start
if (getMainHand() != packetplayinsettings.getMainHand()) {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT); PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT);
this.server.server.getPluginManager().callEvent(event); this.server.server.getPluginManager().callEvent(event);
} }
- if (!this.locale.equals(packetplayinsettings.b())) { - if (!this.locale.equals(packetplayinsettings.locale)) {
+ if (this.locale == null || !this.locale.equals(packetplayinsettings.b())) { // Paper - check for null + if (this.locale == null || !this.locale.equals(packetplayinsettings.locale)) { // Paper - check for null
PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.b()); PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.locale);
this.server.server.getPluginManager().callEvent(event); this.server.server.getPluginManager().callEvent(event);
} }
this.clientViewDistance = packetplayinsettings.viewDistance; this.clientViewDistance = packetplayinsettings.viewDistance;
@@ -31,14 +30,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - add PlayerLocaleChangeEvent + // Paper start - add PlayerLocaleChangeEvent
+ // Since the field is initialized to null, this event should always fire the first time the packet is received + // Since the field is initialized to null, this event should always fire the first time the packet is received
+ String oldLocale = this.locale; + String oldLocale = this.locale;
this.locale = packetplayinsettings.b(); + this.locale = packetplayinsettings.locale;
+ if (!this.locale.equals(oldLocale)) { + if (!this.locale.equals(oldLocale)) {
+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent(); + new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent();
+ } + }
+ // Paper end + // Paper end
this.ch = packetplayinsettings.d(); this.cf = packetplayinsettings.d();
this.ci = packetplayinsettings.e(); this.cg = packetplayinsettings.e();
this.getDataWatcher().set(EntityPlayer.bq, (byte) packetplayinsettings.f()); this.getDataWatcher().set(EntityPlayer.bp, (byte) packetplayinsettings.f());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -56,11 +55,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
// Paper start // Paper start
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}
- @Override
public Set<Player> getHiddenPlayers()
{
Set<Player> ret = new HashSet<Player>();

View File

@@ -34,9 +34,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/WorldMap.java --- a/src/main/java/net/minecraft/server/WorldMap.java
+++ b/src/main/java/net/minecraft/server/WorldMap.java +++ b/src/main/java/net/minecraft/server/WorldMap.java
@@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase {
private final Map<String, MapIconBanner> l = Maps.newHashMap(); private final Map<String, MapIconBanner> m = Maps.newHashMap();
public final Map<String, MapIcon> decorations = Maps.newLinkedHashMap(); public final Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
private final Map<String, WorldMapFrame> m = Maps.newHashMap(); private final Map<String, WorldMapFrame> n = Maps.newHashMap();
+ private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper + private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper
// CraftBukkit start // CraftBukkit start
@@ -50,12 +50,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
@@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase {
this.l.put(mapiconbanner.f(), mapiconbanner); this.m.put(mapiconbanner.f(), mapiconbanner);
this.a(mapiconbanner.c(), (GeneratorAccess) null, mapiconbanner.f(), (double) mapiconbanner.a().getX(), (double) mapiconbanner.a().getZ(), 180.0D, mapiconbanner.d()); this.a(mapiconbanner.c(), (GeneratorAccess) null, mapiconbanner.f(), (double) mapiconbanner.a().getX(), (double) mapiconbanner.a().getZ(), 180.0D, mapiconbanner.d());
} }
+ vanillaRender.buffer = colors; // Paper + this.vanillaRender.buffer = colors; // Paper
NBTTagList nbttaglist1 = nbttagcompound.getList("frames", 10); NBTTagList nbttaglist1 = nbttagcompound.getList("frames", 10);
@@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase {
this.b(); this.b();
@@ -105,7 +105,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
{ {
if ( iter.next().trackee == entity ) if ( iter.next().trackee == entity )
{ {

View File

@@ -550,8 +550,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
@Override @Override
protected void b(NBTTagCompound nbttagcompound) { protected void saveData(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.saveData(nbttagcompound);
+ this.lootableData.saveNbt(nbttagcompound); // Paper + this.lootableData.saveNbt(nbttagcompound); // Paper
if (this.lootTable != null) { if (this.lootTable != null) {
nbttagcompound.setString("LootTable", this.lootTable.toString()); nbttagcompound.setString("LootTable", this.lootTable.toString());
@@ -565,10 +565,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
@Override @Override
protected void a(NBTTagCompound nbttagcompound) { protected void loadData(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.loadData(nbttagcompound);
+ this.lootableData.loadNbt(nbttagcompound); // Paper + this.lootableData.loadNbt(nbttagcompound); // Paper
this.items = NonNullList.a(this.getSize(), ItemStack.a); this.items = NonNullList.a(this.getSize(), ItemStack.b);
if (nbttagcompound.hasKeyOfType("LootTable", 8)) { if (nbttagcompound.hasKeyOfType("LootTable", 8)) {
this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable")); this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable"));
this.lootTableSeed = nbttagcompound.getLong("LootTableSeed"); this.lootTableSeed = nbttagcompound.getLong("LootTableSeed");
@@ -585,9 +585,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper + if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper
LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable); LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable);
- this.lootTable = null; if (entityhuman instanceof EntityPlayer) {
@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
}
this.lootTable = null;
+ this.lootableData.processRefill(entityhuman); // Paper + this.lootableData.processRefill(entityhuman); // Paper
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this)).a(this.lootTableSeed); LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, this.getChunkCoordinates()).a(this.lootTableSeed);
if (entityhuman != null) { if (entityhuman != null) {
diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java
@@ -609,7 +613,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer { @@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer {
} }
protected boolean d(NBTTagCompound nbttagcompound) { protected boolean b(NBTTagCompound nbttagcompound) {
+ this.lootableData.loadNbt(nbttagcompound); // Paper + this.lootableData.loadNbt(nbttagcompound); // Paper
if (nbttagcompound.hasKeyOfType("LootTable", 8)) { if (nbttagcompound.hasKeyOfType("LootTable", 8)) {
this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable")); this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable"));
@@ -621,7 +625,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} }
protected boolean e(NBTTagCompound nbttagcompound) { protected boolean c(NBTTagCompound nbttagcompound) {
+ this.lootableData.saveNbt(nbttagcompound); // Paper + this.lootableData.saveNbt(nbttagcompound); // Paper
if (this.lootTable == null) { if (this.lootTable == null) {
return false; return false;
@@ -640,7 +644,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper + if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper
LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable); LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable);
- this.lootTable = null; if (entityhuman instanceof EntityPlayer) {
@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer {
}
this.lootTable = null;
+ this.lootableData.processRefill(entityhuman); // Paper + this.lootableData.processRefill(entityhuman); // Paper
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this.position)).a(this.lootTableSeed); LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this.position)).a(this.lootTableSeed);

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Thu, 28 Jul 2016 17:58:53 -0500
Subject: [PATCH] More informative vehicle moved wrongly message
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
flag1 = true;
- PlayerConnection.LOGGER.warn("{} moved wrongly!", entity.getDisplayName().getString());
+ PlayerConnection.LOGGER.warn(entity.getName() + " (vehicle of " + this.player.getName() + ") moved wrongly!"); // Paper - More informative
}
Location curPos = this.getPlayer().getLocation(); // Spigot

View File

@@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/BlockTallPlant.java --- a/src/main/java/net/minecraft/server/BlockTallPlant.java
+++ b/src/main/java/net/minecraft/server/BlockTallPlant.java +++ b/src/main/java/net/minecraft/server/BlockTallPlant.java
@@ -0,0 +0,0 @@ public class BlockTallPlant extends BlockPlant { @@ -0,0 +0,0 @@ public class BlockTallPlant extends BlockPlant {
@Override
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { protected static void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
// CraftBukkit start // CraftBukkit start
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { - if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) {
+ if (((WorldServer)world).hasPhysicsEvent && org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { // Paper + if (((WorldServer)world).hasPhysicsEvent && org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { // Paper
@@ -36,13 +36,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
while (iterator.hasNext()) { while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next(); WorldServer worldserver = (WorldServer) iterator.next();
+ worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper + worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit
this.methodProfiler.a(() -> { this.methodProfiler.a(() -> {
return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager()); return worldserver + " " + worldserver.getDimensionKey().a();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
@@ -69,11 +69,12 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
public final Convertable.ConversionSession convertable;
public final UUID uuid;
// CraftBukkit start
private int tickPosition;
+ boolean hasPhysicsEvent = true; // Paper + boolean hasPhysicsEvent = true; // Paper
+
// Add env and gen to constructor public Chunk getChunkIfLoaded(int x, int z) {
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { return this.chunkProvider.getChunkAt(x, z, false);
}

View File

@@ -10,16 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
if (this.bA == 1) { if (this.deathAnimationTicks == 1 && !this.isSilent()) {
// CraftBukkit start - Use relative location for far away sounds // CraftBukkit start - Use relative location for far away sounds
// this.world.b(1028, new BlockPosition(this), 0); // this.world.b(1028, this.getChunkCoordinates(), 0);
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; - int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) { - for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
+ // Paper start + //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
+ //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API + for (EntityPlayer player : (List<EntityPlayer>) ((WorldServer)world).getPlayers()) {
+ for (EntityPlayer player : ((WorldServer)world).getPlayers()) {
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
+ // Paper end
double deltaX = this.locX() - player.locX(); double deltaX = this.locX() - player.locX();
double deltaZ = this.locZ() - player.locZ(); double deltaZ = this.locZ() - player.locZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
@@ -28,16 +26,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityWither.java --- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java +++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity { @@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
if (!this.isSilent()) {
// CraftBukkit start - Use relative location for far away sounds // CraftBukkit start - Use relative location for far away sounds
// this.world.b(1023, new BlockPosition(this), 0); // this.world.b(1023, new BlockPosition(this), 0);
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; - int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) { - for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
+ // Paper start + //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
+ //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API + for (EntityPlayer player : (List<EntityPlayer>)this.world.getPlayers()) {
+ for (EntityPlayer player : ((WorldServer)world).getPlayers()) { + final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch double deltaX = this.locX() - player.locX();
+ // Paper end double deltaZ = this.locZ() - player.locZ();
double deltaX = this.locX() - player.locX(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
double deltaZ = this.locZ() - player.locZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;

View File

@@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.getUserCache().c(false); // Paper + this.getUserCache().c(false); // Paper
} }
// Spigot end // Spigot end
}
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/UserCache.java --- a/src/main/java/net/minecraft/server/UserCache.java

View File

@@ -17,20 +17,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> { @@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
private final int b; private int b;
@Deprecated private int e;
private final int c;
+ // Paper start + // Paper start
+ public boolean isValidLocation() { + public boolean isValidLocation() {
+ return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256; + return getX() >= -30000000 && getZ() >= -30000000 && getX() < 30000000 && getZ() < 30000000 && getY() >= 0 && getY() < 256;
+ } + }
+ public boolean isInvalidYLocation() { + public boolean isInvalidYLocation() {
+ return b < 0 || b >= 256; + return b < 0 || b >= 256;
+ } + }
+ // Paper end + // Paper end
+
public BaseBlockPosition(int i, int j, int k) { public BaseBlockPosition(int i, int j, int k) {
this.a = i; this.a = i;
this.b = j;
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
@@ -64,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public IBlockData getBlockData_unused(int i, int j, int k) { + public IBlockData getBlockData_unused(int i, int j, int k) {
+ // Paper end + // Paper end
if (this.world.P() == WorldType.DEBUG_ALL_BLOCK_STATES) { if (this.world.isDebugWorld()) {
IBlockData iblockdata = null; IBlockData iblockdata = null;
diff --git a/src/main/java/net/minecraft/server/ChunkEmpty.java b/src/main/java/net/minecraft/server/ChunkEmpty.java diff --git a/src/main/java/net/minecraft/server/ChunkEmpty.java b/src/main/java/net/minecraft/server/ChunkEmpty.java
@@ -110,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public ChunkSection(int i) { public ChunkSection(int i) {
this(i, (short) 0, (short) 0, (short) 0); this(i, (short) 0, (short) 0, (short) 0);
@@ -0,0 +0,0 @@ public class ChunkSection { @@ -0,0 +0,0 @@ public class ChunkSection {
this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData());
} }
- public IBlockData getType(int i, int j, int k) { - public IBlockData getType(int i, int j, int k) {
@@ -198,10 +199,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public static boolean isValidLocation(BlockPosition blockposition) { public static boolean isValidLocation(BlockPosition blockposition) {
- return !isOutsideWorld(blockposition) && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000; - return !isOutsideWorld(blockposition) && e(blockposition);
+ return blockposition.isValidLocation(); + return blockposition.isValidLocation();
} }
public static boolean k(BlockPosition blockposition) {
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
public static boolean isOutsideWorld(BlockPosition blockposition) { public static boolean isOutsideWorld(BlockPosition blockposition) {
- return b(blockposition.getY()); - return b(blockposition.getY());
+ return blockposition.isInvalidYLocation(); + return blockposition.isInvalidYLocation();

View File

@@ -38,11 +38,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
} }
public boolean bM() { public boolean bU() {
+ // Paper start + // Paper start
+ return this.pushedByWater(); + return this.pushedByWater();
+ } + }
+
+ public boolean pushedByWater() { + public boolean pushedByWater() {
+ // Paper end + // Paper end
return true; return true;
@@ -64,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ // Send position and velocity updates to nearby players on every tick while the TNT is in water. + // Send position and velocity updates to nearby players on every tick while the TNT is in water.
+ // This does pretty well at keeping their clients in sync with the server. + // This does pretty well at keeping their clients in sync with the server.
+ PlayerChunkMap.EntityTracker ete = this.tracker; + PlayerChunkMap.EntityTracker ete = ((WorldServer)this.world).getChunkProvider().playerChunkMap.trackedEntities.get(this.getId());
+ if (ete != null) { + if (ete != null) {
+ PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(this); + PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(this);
+ PacketPlayOutEntityTeleport positionPacket = new PacketPlayOutEntityTeleport(this); + PacketPlayOutEntityTeleport positionPacket = new PacketPlayOutEntityTeleport(this);
@@ -82,7 +81,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private void explode() { private void explode() {
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
public Packet<?> L() { public Packet<?> O() {
return new PacketPlayOutSpawnEntity(this); return new PacketPlayOutSpawnEntity(this);
} }
+ +

View File

@@ -10,34 +10,34 @@ diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java --- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -0,0 +0,0 @@ public class BlockFire extends Block { @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
BlockStateBoolean blockstateboolean = (BlockStateBoolean) BlockFire.g.get(enumdirection); BlockStateBoolean blockstateboolean = (BlockStateBoolean) BlockFire.p.get(enumdirection);
if (blockstateboolean != null) { if (blockstateboolean != null) {
- iblockdata1 = (IBlockData) iblockdata1.set(blockstateboolean, this.h(iblockaccess.getType(blockposition.shift(enumdirection)))); - iblockdata1 = (IBlockData) iblockdata1.set(blockstateboolean, this.e(iblockaccess.getType(blockposition.shift(enumdirection))));
+ iblockdata1 = (IBlockData) iblockdata1.set(blockstateboolean, this.h(iblockaccess.getTypeIfLoaded(blockposition.shift(enumdirection)))); // Paper - prevent chunk loads + iblockdata1 = (IBlockData) iblockdata1.set(blockstateboolean, this.e(iblockaccess.getTypeIfLoaded(blockposition.shift(enumdirection)))); // Paper - prevent chunk loads
} }
} }
@@ -0,0 +0,0 @@ public class BlockFire extends Block { @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
} }
blockposition_mutableblockposition.g(blockposition).e(l, j1, i1); blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, l, j1, i1);
+ if (!worldserver.isLoaded(blockposition_mutableblockposition)) continue; // Paper + if (!worldserver.isLoaded(blockposition_mutableblockposition)) continue; // Paper
int l1 = this.a((IWorldReader) worldserver, (BlockPosition) blockposition_mutableblockposition); int l1 = this.a((IWorldReader) worldserver, (BlockPosition) blockposition_mutableblockposition);
if (l1 > 0) { if (l1 > 0) {
@@ -0,0 +0,0 @@ public class BlockFire extends Block { @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
} }
private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition private void trySpread(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
- int k = this.i(world.getType(blockposition)); - int k = this.getBurnChance(world.getType(blockposition));
+ // Paper start + // Paper start
+ final IBlockData iblockdata = world.getTypeIfLoaded(blockposition); + final IBlockData iblockdata = world.getTypeIfLoaded(blockposition);
+ if (iblockdata == null) { + if (iblockdata == null) {
+ return; + return;
+ } + }
+ int k = this.i(iblockdata); + int k = this.getBurnChance(iblockdata);
+ // Paper end + // Paper end
if (random.nextInt(i) < k) { if (random.nextInt(i) < k) {
@@ -46,36 +46,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start // CraftBukkit start
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
@@ -0,0 +0,0 @@ public class BlockFire extends Block { @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
EnumDirection enumdirection = aenumdirection[j]; EnumDirection enumdirection = aenumdirection[j];
- if (this.h(iblockaccess.getType(blockposition.shift(enumdirection)))) { - if (this.e(iblockaccess.getType(blockposition.shift(enumdirection)))) {
+ if (this.h(iblockaccess.getTypeIfLoaded(blockposition.shift(enumdirection)))) { // Paper - prevent chunk loads + if (this.e(iblockaccess.getTypeIfLoaded(blockposition.shift(enumdirection)))) { // Paper - prevent chunk loads
return true; return true;
} }
} }
@@ -0,0 +0,0 @@ public class BlockFire extends Block { @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
for (int k = 0; k < j; ++k) { for (int k = 0; k < j; ++k) {
EnumDirection enumdirection = aenumdirection[k]; EnumDirection enumdirection = aenumdirection[k];
- IBlockData iblockdata = iworldreader.getType(blockposition.shift(enumdirection)); - IBlockData iblockdata = iworldreader.getType(blockposition.shift(enumdirection));
-
+ // Paper start + // Paper start
+ IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition.shift(enumdirection)); + IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition.shift(enumdirection));
+ if (iblockdata == null) { + if (iblockdata == null) {
+ continue; + continue;
+ } + }
+ // Paper end + // Paper end
i = Math.max(this.r(iblockdata), i);
i = Math.max(this.getFlameChance(iblockdata), i);
} }
@@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
@@ -0,0 +0,0 @@ public class BlockFire extends Block { @Override
} protected boolean e(IBlockData iblockdata) {
- return this.getFlameChance(iblockdata) > 0;
public boolean h(IBlockData iblockdata) { + return iblockdata != null && this.getFlameChance(iblockdata) > 0; // Paper - iblockdata can be nullable if chunk is unloaded now
- return this.r(iblockdata) > 0;
+ return iblockdata != null && this.r(iblockdata) > 0; // Paper - iblockdata can be nullable if chunk is unloaded now
} }
@Override @Override

View File

@@ -15,40 +15,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class DataBits { @@ -0,0 +0,0 @@ public class DataBits {
} }
public DataBits(int i, int j, long[] along) {
- Validate.inclusiveBetween(1L, 32L, (long) i);
+ //Validate.inclusiveBetween(1L, 32L, (long) i); // Paper
this.d = j;
this.b = i;
this.a = along;
@@ -0,0 +0,0 @@ public class DataBits {
}
public int a(int i, int j) { public int a(int i, int j) {
- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); - Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i);
- Validate.inclusiveBetween(0L, this.c, (long) j); - Validate.inclusiveBetween(0L, this.d, (long) j);
+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper + //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
+ //Validate.inclusiveBetween(0L, this.c, (long) j); // Paper + //Validate.inclusiveBetween(0L, this.d, (long) j); // Paper
int k = i * this.b; int k = this.b(i);
int l = k >> 6; long l = this.b[k];
int i1 = (i + 1) * this.b - 1 >> 6; int i1 = (i - k * this.f) * this.c;
@@ -0,0 +0,0 @@ public class DataBits { @@ -0,0 +0,0 @@ public class DataBits {
} }
public void b(int i, int j) { public void b(int i, int j) {
- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); - Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i);
- Validate.inclusiveBetween(0L, this.c, (long) j); - Validate.inclusiveBetween(0L, this.d, (long) j);
+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper + //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
+ //Validate.inclusiveBetween(0L, this.c, (long) j); // Paper + //Validate.inclusiveBetween(0L, this.d, (long) j); // Paper
int k = i * this.b; int k = this.b(i);
int l = k >> 6; long l = this.b[k];
int i1 = (i + 1) * this.b - 1 >> 6; int i1 = (i - k * this.f) * this.c;
@@ -0,0 +0,0 @@ public class DataBits { @@ -0,0 +0,0 @@ public class DataBits {
} }
public int a(int i) { public int a(int i) {
- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); - Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i);
+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper + //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
int j = i * this.b; int j = this.b(i);
int k = j >> 6; long k = this.b[j];
int l = (i + 1) * this.b - 1 >> 6; int l = (i - j * this.f) * this.c;

View File

@@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public static final ResourceKey<World> THE_NETHER = ResourceKey.a(IRegistry.ae, new MinecraftKey("the_nether"));
protected static final Logger LOGGER = LogManager.getLogger(); public static final ResourceKey<World> THE_END = ResourceKey.a(IRegistry.ae, new MinecraftKey("the_end"));
private static final EnumDirection[] a = EnumDirection.values(); private static final EnumDirection[] a = EnumDirection.values();
- public final List<TileEntity> tileEntityList = Lists.newArrayList(); - public final List<TileEntity> tileEntityList = Lists.newArrayList();
+ //public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list + //public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
@@ -70,7 +70,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
} }
bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size())); bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size()));
@@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTickList().a())); bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTickList().a()));
bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getFluidTickList().a())); bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getFluidTickList().a()));
bufferedwriter.write("distance_manager: " + playerchunkmap.e().c() + "\n"); bufferedwriter.write("distance_manager: " + playerchunkmap.e().c() + "\n");
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
private void a(Writer writer) throws IOException { private void a(Writer writer) throws IOException {
CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("type").a(writer); CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("type").a(writer);

View File

@@ -24,11 +24,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java --- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java +++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java
@@ -0,0 +0,0 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven @@ -0,0 +0,0 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven
this.bx = flag;
@Override
public boolean a(EntityHuman entityhuman) {
- return super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD;
+ return world.paperConfig.allowLeashingUndeadHorse ? super.a(entityhuman) : super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD; // Paper
} }
+ // Paper start
+ @Override
+ public boolean canLeash(EntityHuman entityhuman) {
+ return world.paperConfig.allowLeashingUndeadHorse ? super.a(entityhuman) : super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD; // Paper
+ }
+ // Paper end
+
@Override @Override
protected void t(float f) {
if (f > 6.0F && this.fa()) {
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
}
public boolean a(EntityHuman entityhuman) {
+ // Paper start - allow overriding
+ return this.canLeash(entityhuman);
+ }
+ public boolean canLeash(EntityHuman entityhuman) {
+ // Paper end - allow overriding
return !this.isLeashed() && !(this instanceof IMonster);
}

View File

@@ -32,11 +32,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.y = Vec3D.a; this.x = Vec3D.a;
this.av = 1.0F; this.at = 1.0F;
this.aw = 1.0F; this.au = 1.0F;
- this.random = new Random(); - this.random = new Random();
+ this.random = SHARED_RANDOM; // Paper + this.random = SHARED_RANDOM; // Paper
this.fireTicks = -this.getMaxFireTicks(); this.fireTicks = -this.getMaxFireTicks();
this.M = new Object2DoubleArrayMap(2);
this.justCreated = true; this.justCreated = true;
this.uniqueID = MathHelper.a(this.random);

View File

@@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
@Override @Override
public void a(NBTTagCompound nbttagcompound) { public void loadData(NBTTagCompound nbttagcompound) {
- this.setAbsorptionHearts(nbttagcompound.getFloat("AbsorptionAmount")); - this.setAbsorptionHearts(nbttagcompound.getFloat("AbsorptionAmount"));
+ // Paper start - jvm keeps optimizing the setter + // Paper start - jvm keeps optimizing the setter
+ float absorptionAmount = nbttagcompound.getFloat("AbsorptionAmount"); + float absorptionAmount = nbttagcompound.getFloat("AbsorptionAmount");
@@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.setAbsorptionHearts(absorptionAmount); + this.setAbsorptionHearts(absorptionAmount);
+ // Paper end + // Paper end
if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isClientSide) { if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isClientSide) {
GenericAttributes.a(this.getAttributeMap(), nbttagcompound.getList("Attributes", 10)); this.getAttributeMap().a(nbttagcompound.getList("Attributes", 10));
} }
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
} }

View File

@@ -11,20 +11,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import org.spigotmc.SlackActivityAccountant; // Spigot @@ -0,0 +0,0 @@ import org.spigotmc.SlackActivityAccountant; // Spigot
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable { public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
+ private static MinecraftServer SERVER; // Paper + private static MinecraftServer SERVER; // Paper
public static final Logger LOGGER = LogManager.getLogger(); public static final Logger LOGGER = LogManager.getLogger();
public static final File b = new File("usercache.json"); public static final File b = new File("usercache.json");
private static final CompletableFuture<Unit> i = CompletableFuture.completedFuture(Unit.INSTANCE); public static final WorldSettings c = new WorldSettings("Demo World", EnumGamemode.SURVIVAL, false, EnumDifficulty.NORMAL, false, new GameRules(), DataPackConfiguration.a);
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory, String s) {
public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository<ResourcePackLoader> resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
super("Server"); super("Server");
this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread);
+ SERVER = this; // Paper - better singleton + SERVER = this; // Paper - better singleton
this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new); this.m = new GameProfilerSwitcher(SystemUtils.a, this::ag);
this.craftingManager = new CraftingManager(); this.methodProfiler = GameProfilerDisabled.a;
this.tagRegistry = new TagRegistry(); this.serverPing = new ServerPing();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Deprecated @Deprecated
@@ -33,4 +33,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return SERVER; // Paper + return SERVER; // Paper
} }
// CraftBukkit end // CraftBukkit end
}