mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
more progress
This commit is contained in:
parent
5287c1ba7c
commit
fbbf45ec42
@ -38,5 +38,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
+ public final boolean isInBounds(BlockPosition blockposition) { return this.a(blockposition); } // Paper - OBFHELPER
|
||||
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();
|
||||
}
|
||||
|
@ -30,21 +30,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce {
|
||||
|
||||
@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 ((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();
|
||||
Throwable throwable = null;
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
EnumDirection[] aenumdirection = EnumDirection.values();
|
||||
@@ -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)) {
|
||||
- worldserver.getBlockTickList().a(blockposition_pooledblockposition, 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
|
||||
}
|
||||
if (iblockdata1.a((Block) this) && !this.e(iblockdata1, (World) worldserver, blockposition_mutableblockposition)) {
|
||||
- worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, 20, 40));
|
||||
+ 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 {
|
||||
|
@ -28,8 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
blockposition = new BlockPosition(d0, this.locY(), d1);
|
||||
// CraftBukkit start
|
||||
- EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, blockposition, 128);
|
||||
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, blockposition, world.paperConfig.portalSearchRadius); // Paper - use portal search radius
|
||||
- EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, 128);
|
||||
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, worldserver.paperConfig.portalSearchRadius); // Paper - use portal search radius
|
||||
if (event == null) {
|
||||
return null;
|
||||
}
|
||||
@ -40,11 +40,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
// CraftBukkit start
|
||||
Location enter = this.getBukkitEntity().getLocation();
|
||||
Location exit = (worldserver1 == null) ? null : new Location(worldserver1.getWorld(), d0, d1, d2, f1, f);
|
||||
- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, dimensionmanager.getType() == DimensionManager.THE_END ? 0 : 16);
|
||||
+ int configuredSearchRadius = (worldserver1 == null ? worldserver : worldserver1).paperConfig.portalSearchRadius;
|
||||
+ 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
|
||||
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, resourcekey == World.THE_END ? 0 : 16);
|
||||
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, worldserver.paperConfig.portalSearchRadius, true, resourcekey == World.THE_END ? 0 : worldserver.paperConfig.portalCreateRadius);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled() || event.getTo() == null) {
|
||||
return null;
|
||||
@ -63,10 +61,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Nullable
|
||||
@@ -0,0 +0,0 @@ public class PortalTravelAgent {
|
||||
// CraftBukkit end
|
||||
VillagePlace villageplace = this.world.B();
|
||||
VillagePlace villageplace = this.world.x();
|
||||
|
||||
- villageplace.a(this.world, blockposition, 128);
|
||||
+ villageplace.a(this.world, blockposition, searchRadius); // Paper - This impacts the # of chunks searched for entries
|
||||
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
|
||||
|
@ -83,7 +83,7 @@ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/m
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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.Supplier;
|
||||
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
|
||||
--- a/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 {
|
||||
return true;
|
||||
} catch (Exception exception) {
|
||||
@ -173,15 +165,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
|
||||
entityinsentient = (EntityInsentient) entity;
|
||||
} catch (Exception exception) {
|
||||
SpawnerCreature.LOGGER.warn("Failed to create mob", exception);
|
||||
+ ServerInternalException.reportInternalException(exception); // Paper
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
SpawnerCreature.LOGGER.warn("Failed to create mob", exception);
|
||||
+ ServerInternalException.reportInternalException(exception); // Paper
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
SpawnerCreature.LOGGER.warn("Failed to create mob", exception);
|
||||
+ ServerInternalException.reportInternalException(exception); // Paper
|
||||
@ -200,8 +192,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import java.util.Iterator;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class VillageSiege {
|
||||
entityzombie.prepare(worldserver, worldserver.getDamageScaler(new BlockPosition(entityzombie)), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
@@ -0,0 +0,0 @@ public class VillageSiege implements MobSpawner {
|
||||
entityzombie.prepare(worldserver, worldserver.getDamageScaler(entityzombie.getChunkCoordinates()), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
+ 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
|
||||
--- a/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.Timings;
|
||||
+import co.aikar.timings.Timing;
|
||||
+import co.aikar.timings.Timings;
|
||||
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
||||
+import com.destroystokyo.paper.exception.ServerInternalException;
|
||||
+import com.google.common.base.MoreObjects;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.serialization.Codec;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
gameprofilerfiller.exit();
|
||||
} catch (Throwable throwable) {
|
||||
|
@ -10,9 +10,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/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 {
|
||||
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 {
|
||||
this.b.setPacketListener(new LoginListener(this.a, this.b));
|
||||
this.c.setPacketListener(new LoginListener(this.b, this.c));
|
||||
+ // Paper start - handshake event
|
||||
+ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee;
|
||||
+ 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 (event.isFailed()) {
|
||||
+ chatmessage = new ChatMessage(event.getFailMessage());
|
||||
+ this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
+ this.b.close(chatmessage);
|
||||
+ this.getNetworkManager().sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
+ this.getNetworkManager().close(chatmessage);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ packethandshakinginsetprotocol.hostname = event.getServerHostname();
|
||||
+ this.b.socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.b.getSocketAddress()).getPort());
|
||||
+ this.b.spoofedUUID = event.getUniqueId();
|
||||
+ this.b.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class);
|
||||
+ this.getNetworkManager().socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.getNetworkManager().getSocketAddress()).getPort());
|
||||
+ this.getNetworkManager().spoofedUUID = event.getUniqueId();
|
||||
+ this.getNetworkManager().spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class);
|
||||
+ handledByEvent = true; // Hooray, we did it!
|
||||
+ }
|
||||
+ }
|
||||
|
@ -33,9 +33,9 @@ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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;
|
||||
- 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?
|
||||
|
@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
private final Map<String,EntityPlayer> playersByName = new java.util.HashMap<>();
|
||||
+ @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);
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
}
|
||||
@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
// 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 {
|
||||
entityplayer.playerTick(); // SPIGOT-924
|
||||
|
@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/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
|
||||
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Integer> playerIdleTimeout;
|
||||
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
|
||||
public final GeneratorSettings generatorSettings;
|
||||
|
||||
+ public final String rconIp; // Paper - Add rcon ip
|
||||
+
|
||||
@ -19,9 +19,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public DedicatedServerProperties(Properties properties, OptionSet optionset) {
|
||||
super(properties, optionset);
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
|
||||
}, 29999984);
|
||||
this.playerIdleTimeout = this.b("player-idle-timeout", 0);
|
||||
this.whiteList = this.b("white-list", false);
|
||||
this.generatorSettings = GeneratorSettings.a(properties);
|
||||
+ // Paper start - Configurable rcon ip
|
||||
+ final String rconIp = this.getSettingIfExists("rcon.ip");
|
||||
+ this.rconIp = rconIp == null ? this.serverIp : rconIp;
|
||||
@ -50,10 +50,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java
|
||||
@@ -0,0 +0,0 @@ public class RemoteControlListener extends RemoteConnectionThread {
|
||||
|
||||
this.h = dedicatedserverproperties.rconPort;
|
||||
this.k = dedicatedserverproperties.rconPassword;
|
||||
- this.i = iminecraftserver.e_();
|
||||
+ this.i = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip
|
||||
if (this.i.isEmpty()) {
|
||||
this.i = "0.0.0.0";
|
||||
this.e = dedicatedserverproperties.rconPort;
|
||||
this.h = dedicatedserverproperties.rconPassword;
|
||||
- this.f = iminecraftserver.h_();
|
||||
+ this.f = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip
|
||||
if (this.f.isEmpty()) {
|
||||
this.f = "0.0.0.0";
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (fromWorld == toWorld) {
|
||||
entity.playerConnection.teleport(to);
|
||||
} else {
|
||||
- server.getHandle().moveToWorld(entity, toWorld.getWorldProvider().getDimensionManager(), true, to, true);
|
||||
+ server.getHandle().moveToWorld(entity, toWorld.getWorldProvider().getDimensionManager(), true, to, !toWorld.paperConfig.disableTeleportationSuffocationCheck);
|
||||
- server.getHandle().moveToWorld(entity, toWorld, true, to, true);
|
||||
+ server.getHandle().moveToWorld(entity, toWorld, true, to, !toWorld.paperConfig.disableTeleportationSuffocationCheck); // Paper
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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));
|
||||
if (this.isRainingAt(blockposition)) {
|
||||
DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition);
|
||||
|
@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
this.a(this.getRaisedHand(), itemstack);
|
||||
// CraftBukkit end
|
||||
this.dH();
|
||||
this.clearActiveItem();
|
||||
+ // 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)) {
|
||||
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
|
||||
|
@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/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 {
|
||||
private BlockPosition q;
|
||||
private int r;
|
||||
private float s;
|
||||
- private final Pathfinder t;
|
||||
+ private final Pathfinder t; public Pathfinder getPathfinder() { return this.t; } // Paper - OBFHELPER
|
||||
private BlockPosition p;
|
||||
private int q;
|
||||
private float r;
|
||||
- private final Pathfinder s;
|
||||
+ private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER
|
||||
|
||||
public NavigationAbstract(EntityInsentient entityinsentient, World world) {
|
||||
this.g = Vec3D.a;
|
||||
@ -22,47 +22,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/Pathfinder.java
|
||||
+++ b/src/main/java/net/minecraft/server/Pathfinder.java
|
||||
@@ -0,0 +0,0 @@ public class Pathfinder {
|
||||
private final Set<PathPoint> b = Sets.newHashSet();
|
||||
private final PathPoint[] c = new PathPoint[32];
|
||||
private final int d;
|
||||
- private final PathfinderAbstract e;
|
||||
+ private final PathfinderAbstract e; public PathfinderAbstract getPathfinder() { return this.e; } // Paper - OBFHELPER
|
||||
|
||||
private final PathPoint[] a = new PathPoint[32];
|
||||
private final int b;
|
||||
- private final PathfinderAbstract c;
|
||||
+ private final PathfinderAbstract c; public PathfinderAbstract getPathfinder() { return this.c; } // Paper - OBFHELPER
|
||||
private final Path d = new Path();
|
||||
|
||||
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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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 {
|
||||
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) {
|
||||
- Block block = iblockaccess.getType(new BlockPosition(i, j - 1, k)).getBlock();
|
||||
+ 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;
|
||||
if (iblockdata.a(Blocks.CACTUS)) {
|
||||
return PathType.DANGER_CACTUS;
|
||||
@@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
for (int i1 = -1; i1 <= 1; ++i1) {
|
||||
for (int j1 = -1; j1 <= 1; ++j1) {
|
||||
if (l != 0 || j1 != 0) {
|
||||
- Block block = iblockaccess.getType(blockposition_pooledblockposition.d(l + i, i1 + j, j1 + k)).getBlock();
|
||||
-
|
||||
+ // 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) {
|
||||
if (fluid.a((Tag) TagsFluid.LAVA)) {
|
||||
return PathType.LAVA;
|
||||
}
|
||||
+ } // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
}
|
||||
|
||||
protected static PathType c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
||||
protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
||||
- IBlockData iblockdata = iblockaccess.getType(blockposition);
|
||||
+ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper
|
||||
+ if (iblockdata == null) return PathType.BLOCKED; // Paper
|
||||
|
@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
-public class TileEntitySkull extends TileEntity implements ITickable {
|
||||
+public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable
|
||||
|
||||
public GameProfile gameProfile;
|
||||
private int b;
|
||||
@Nullable
|
||||
private static UserCache userCache;
|
||||
@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity implements ITickable {
|
||||
|
||||
}
|
||||
@ -24,5 +24,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- @Override
|
||||
+ // Paper - remove override
|
||||
public void tick() {
|
||||
Block block = this.getBlock().getBlock();
|
||||
IBlockData iblockdata = this.getBlock();
|
||||
|
||||
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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) {
|
||||
this.navigators.remove(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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();
|
||||
}
|
||||
// Paper end
|
||||
|
@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
public PathEntity a(Entity entity, int i) {
|
||||
- return this.a(new BlockPosition(entity), i);
|
||||
+ return this.a(new BlockPosition(entity), entity, i); // Paper - Forward target entity
|
||||
- return this.a(entity.getChunkCoordinates(), i);
|
||||
+ return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
|
||||
}
|
||||
|
||||
private int t() {
|
||||
@ -46,8 +46,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Nullable
|
||||
public PathEntity a(Entity entity, int i) {
|
||||
- return this.a(ImmutableSet.of(new BlockPosition(entity)), 16, true, i);
|
||||
+ return this.a(ImmutableSet.of(new BlockPosition(entity)), entity, 16, true, i); // Paper
|
||||
- return this.a(ImmutableSet.of(entity.getChunkCoordinates()), 16, true, i);
|
||||
+ return this.a(ImmutableSet.of(entity.getChunkCoordinates()), entity, 16, true, i); // Paper
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return null;
|
||||
} else if (this.a.locY() < 0.0D) {
|
||||
@@ -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;
|
||||
} else {
|
||||
+ // Paper start - Pathfind event
|
||||
@ -82,8 +82,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.b.getMethodProfiler().enter("pathfind");
|
||||
float f = (float) this.p.getValue();
|
||||
BlockPosition blockposition = flag ? (new BlockPosition(this.a)).up() : new BlockPosition(this.a);
|
||||
float f = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);
|
||||
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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationFlying.java
|
||||
@ -92,8 +92,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
public PathEntity a(Entity entity, int i) {
|
||||
- return this.a(new BlockPosition(entity), i);
|
||||
+ return this.a(new BlockPosition(entity), entity, i); // Paper - Forward target entity
|
||||
- return this.a(entity.getChunkCoordinates(), i);
|
||||
+ return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,28 +16,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- private static final Map<IBlockAccess, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = new WeakHashMap();
|
||||
+ // Paper - Move the mapped list to World
|
||||
|
||||
protected BlockRedstoneTorch(Block.Info block_info) {
|
||||
super(block_info);
|
||||
protected BlockRedstoneTorch(BlockBase.Info blockbase_info) {
|
||||
super(blockbase_info, ParticleParamRedstone.a);
|
||||
@@ -0,0 +0,0 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
}
|
||||
|
||||
public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random, boolean flag) {
|
||||
- List list = (List) BlockRedstoneTorch.b.get(world);
|
||||
+ // Paper start
|
||||
+ java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos = world.redstoneUpdateInfos;
|
||||
|
||||
- while (list != null && !list.isEmpty() && world.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) {
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
boolean flag = this.a((World) worldserver, blockposition, iblockdata);
|
||||
- List list = (List) BlockRedstoneTorch.b.get(worldserver);
|
||||
-
|
||||
- while (list != null && !list.isEmpty() && worldserver.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) {
|
||||
- list.remove(0);
|
||||
+ // Paper start
|
||||
+ java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos = worldserver.redstoneUpdateInfos;
|
||||
+ if (redstoneUpdateInfos != null) {
|
||||
+ 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();
|
||||
+ }
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
// 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 {
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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
|
||||
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
|
||||
|
@ -13,11 +13,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/DefinedStructure.java
|
||||
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java
|
||||
@@ -0,0 +0,0 @@ public class DefinedStructure {
|
||||
definedstructure_blockinfo.c.setInt("x", blockposition1.getX());
|
||||
definedstructure_blockinfo.c.setInt("y", blockposition1.getY());
|
||||
definedstructure_blockinfo.c.setInt("z", blockposition1.getZ());
|
||||
definedstructure_blockinfo.c.setLong("LootTableSeed", random.nextLong());
|
||||
}
|
||||
|
||||
+ tileentity.isLoadingStructure = true; // Paper
|
||||
tileentity.load(definedstructure_blockinfo.c);
|
||||
tileentity.load(definedstructure_blockinfo.b, definedstructure_blockinfo.c);
|
||||
tileentity.a(definedstructureinfo.c());
|
||||
tileentity.a(definedstructureinfo.d());
|
||||
+ tileentity.isLoadingStructure = false; // Paper
|
||||
@ -44,8 +44,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
try {
|
||||
- IChatBaseComponent ichatbasecomponent = 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);
|
||||
+ //IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - move down - the old format might throw a json error
|
||||
|
||||
- if (oldSign) {
|
||||
+ 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;
|
||||
}
|
||||
// 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) {
|
||||
try {
|
||||
|
@ -21,18 +21,18 @@ diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/n
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
@@ -0,0 +0,0 @@ import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
+import java.util.Collections;
|
||||
+import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Optional;
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
return decimalformat;
|
||||
}
|
||||
private ShapeDetectorBlock n;
|
||||
private boolean o;
|
||||
|
||||
+ // Paper start
|
||||
+ 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
|
||||
this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone();
|
||||
+ processEnchantOrder(this.tag); // Paper
|
||||
this.getItem().a(this.tag);
|
||||
this.getItem().b(this.tag);
|
||||
// CraftBukkit end
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
|
@ -8,22 +8,21 @@ diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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 {
|
||||
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);
|
||||
this.server.server.getPluginManager().callEvent(event);
|
||||
}
|
||||
- if (!this.locale.equals(packetplayinsettings.b())) {
|
||||
+ if (this.locale == null || !this.locale.equals(packetplayinsettings.b())) { // Paper - check for null
|
||||
PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.b());
|
||||
- if (!this.locale.equals(packetplayinsettings.locale)) {
|
||||
+ if (this.locale == null || !this.locale.equals(packetplayinsettings.locale)) { // Paper - check for null
|
||||
PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.locale);
|
||||
this.server.server.getPluginManager().callEvent(event);
|
||||
}
|
||||
this.clientViewDistance = packetplayinsettings.viewDistance;
|
||||
@ -31,14 +30,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper start - add PlayerLocaleChangeEvent
|
||||
+ // Since the field is initialized to null, this event should always fire the first time the packet is received
|
||||
+ String oldLocale = this.locale;
|
||||
this.locale = packetplayinsettings.b();
|
||||
+ this.locale = packetplayinsettings.locale;
|
||||
+ if (!this.locale.equals(oldLocale)) {
|
||||
+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.ch = packetplayinsettings.d();
|
||||
this.ci = packetplayinsettings.e();
|
||||
this.getDataWatcher().set(EntityPlayer.bq, (byte) packetplayinsettings.f());
|
||||
this.cf = packetplayinsettings.d();
|
||||
this.cg = packetplayinsettings.e();
|
||||
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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@ -56,11 +55,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
}
|
||||
|
||||
- @Override
|
||||
public Set<Player> getHiddenPlayers()
|
||||
{
|
||||
Set<Player> ret = new HashSet<Player>();
|
||||
|
@ -34,9 +34,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/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 {
|
||||
private final Map<String, MapIconBanner> l = Maps.newHashMap();
|
||||
private final Map<String, MapIconBanner> m = Maps.newHashMap();
|
||||
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
|
||||
|
||||
// CraftBukkit start
|
||||
@ -50,12 +50,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase {
|
||||
this.l.put(mapiconbanner.f(), mapiconbanner);
|
||||
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.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.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 {
|
||||
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
|
||||
--- a/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 )
|
||||
{
|
||||
|
@ -550,8 +550,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
|
||||
@Override
|
||||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
protected void saveData(NBTTagCompound nbttagcompound) {
|
||||
super.saveData(nbttagcompound);
|
||||
+ this.lootableData.saveNbt(nbttagcompound); // Paper
|
||||
if (this.lootTable != null) {
|
||||
nbttagcompound.setString("LootTable", this.lootTable.toString());
|
||||
@ -565,10 +565,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
|
||||
@Override
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
protected void loadData(NBTTagCompound nbttagcompound) {
|
||||
super.loadData(nbttagcompound);
|
||||
+ 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)) {
|
||||
this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable"));
|
||||
this.lootTableSeed = nbttagcompound.getLong("LootTableSeed");
|
||||
@ -585,9 +585,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper
|
||||
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
|
||||
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) {
|
||||
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 {
|
||||
}
|
||||
|
||||
protected boolean d(NBTTagCompound nbttagcompound) {
|
||||
protected boolean b(NBTTagCompound nbttagcompound) {
|
||||
+ this.lootableData.loadNbt(nbttagcompound); // Paper
|
||||
if (nbttagcompound.hasKeyOfType("LootTable", 8)) {
|
||||
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
|
||||
if (this.lootTable == null) {
|
||||
return false;
|
||||
@ -640,7 +644,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper
|
||||
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
|
||||
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this.position)).a(this.lootTableSeed);
|
||||
|
||||
|
@ -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
|
||||
|
@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/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 {
|
||||
@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
|
||||
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) {
|
||||
+ 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
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
+ 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(() -> {
|
||||
return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager());
|
||||
|
||||
this.methodProfiler.a(() -> {
|
||||
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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- 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
|
||||
--- a/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
|
||||
|
||||
// Add env and gen to constructor
|
||||
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) {
|
||||
+
|
||||
public Chunk getChunkIfLoaded(int x, int z) {
|
||||
return this.chunkProvider.getChunkAt(x, z, false);
|
||||
}
|
||||
|
@ -10,16 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/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 {
|
||||
if (this.bA == 1) {
|
||||
if (this.deathAnimationTicks == 1 && !this.isSilent()) {
|
||||
// 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;
|
||||
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ // Paper start
|
||||
+ //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 : ((WorldServer)world).getPlayers()) {
|
||||
+ //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
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>) ((WorldServer)world).getPlayers()) {
|
||||
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
+ // Paper end
|
||||
double deltaX = this.locX() - player.locX();
|
||||
double deltaZ = this.locZ() - player.locZ();
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
@ -28,16 +26,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/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 {
|
||||
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.world.b(1023, new BlockPosition(this), 0);
|
||||
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ // Paper start
|
||||
+ //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 : ((WorldServer)world).getPlayers()) {
|
||||
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
+ // Paper end
|
||||
double deltaX = this.locX() - player.locX();
|
||||
double deltaZ = this.locZ() - player.locZ();
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
if (!this.isSilent()) {
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.world.b(1023, new BlockPosition(this), 0);
|
||||
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ //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
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>)this.world.getPlayers()) {
|
||||
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
double deltaX = this.locX() - player.locX();
|
||||
double deltaZ = this.locZ() - player.locZ();
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
|
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ this.getUserCache().c(false); // Paper
|
||||
}
|
||||
// Spigot end
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/UserCache.java
|
||||
|
@ -17,20 +17,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/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> {
|
||||
private final int b;
|
||||
@Deprecated
|
||||
private final int c;
|
||||
private int b;
|
||||
private int e;
|
||||
|
||||
+ // Paper start
|
||||
+ 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() {
|
||||
+ return b < 0 || b >= 256;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
+
|
||||
public BaseBlockPosition(int i, int j, int k) {
|
||||
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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- 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) {
|
||||
+ // Paper end
|
||||
if (this.world.P() == WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||
if (this.world.isDebugWorld()) {
|
||||
IBlockData iblockdata = null;
|
||||
|
||||
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) {
|
||||
this(i, (short) 0, (short) 0, (short) 0);
|
||||
@@ -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) {
|
||||
@ -198,10 +199,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public static boolean k(BlockPosition blockposition) {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
}
|
||||
|
||||
public static boolean isOutsideWorld(BlockPosition blockposition) {
|
||||
- return b(blockposition.getY());
|
||||
+ return blockposition.isInvalidYLocation();
|
||||
|
@ -38,11 +38,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
}
|
||||
|
||||
public boolean bM() {
|
||||
public boolean bU() {
|
||||
+ // Paper start
|
||||
+ return this.pushedByWater();
|
||||
+ }
|
||||
+
|
||||
+ public boolean pushedByWater() {
|
||||
+ // Paper end
|
||||
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.
|
||||
+ // 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) {
|
||||
+ PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(this);
|
||||
+ PacketPlayOutEntityTeleport positionPacket = new PacketPlayOutEntityTeleport(this);
|
||||
@ -82,7 +81,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
private void explode() {
|
||||
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
|
||||
public Packet<?> L() {
|
||||
public Packet<?> O() {
|
||||
return new PacketPlayOutSpawnEntity(this);
|
||||
}
|
||||
+
|
||||
|
@ -10,34 +10,34 @@ diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/n
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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 {
|
||||
BlockStateBoolean blockstateboolean = (BlockStateBoolean) BlockFire.g.get(enumdirection);
|
||||
@@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
|
||||
BlockStateBoolean blockstateboolean = (BlockStateBoolean) BlockFire.p.get(enumdirection);
|
||||
|
||||
if (blockstateboolean != null) {
|
||||
- iblockdata1 = (IBlockData) iblockdata1.set(blockstateboolean, this.h(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.getType(blockposition.shift(enumdirection))));
|
||||
+ 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
|
||||
int l1 = this.a((IWorldReader) worldserver, (BlockPosition) blockposition_mutableblockposition);
|
||||
|
||||
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
|
||||
- int k = this.i(world.getType(blockposition));
|
||||
private void trySpread(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
|
||||
- int k = this.getBurnChance(world.getType(blockposition));
|
||||
+ // Paper start
|
||||
+ final IBlockData iblockdata = world.getTypeIfLoaded(blockposition);
|
||||
+ if (iblockdata == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ int k = this.i(iblockdata);
|
||||
+ int k = this.getBurnChance(iblockdata);
|
||||
+ // Paper end
|
||||
|
||||
if (random.nextInt(i) < k) {
|
||||
@ -46,36 +46,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
// CraftBukkit start
|
||||
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) {
|
||||
EnumDirection enumdirection = aenumdirection[j];
|
||||
|
||||
- if (this.h(iblockaccess.getType(blockposition.shift(enumdirection)))) {
|
||||
+ if (this.h(iblockaccess.getTypeIfLoaded(blockposition.shift(enumdirection)))) { // Paper - prevent chunk loads
|
||||
- if (this.e(iblockaccess.getType(blockposition.shift(enumdirection)))) {
|
||||
+ if (this.e(iblockaccess.getTypeIfLoaded(blockposition.shift(enumdirection)))) { // Paper - prevent chunk loads
|
||||
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) {
|
||||
EnumDirection enumdirection = aenumdirection[k];
|
||||
- IBlockData iblockdata = iworldreader.getType(blockposition.shift(enumdirection));
|
||||
-
|
||||
+ // Paper start
|
||||
+ IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition.shift(enumdirection));
|
||||
+ if (iblockdata == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // 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 {
|
||||
}
|
||||
|
||||
public boolean h(IBlockData iblockdata) {
|
||||
- return this.r(iblockdata) > 0;
|
||||
+ return iblockdata != null && this.r(iblockdata) > 0; // Paper - iblockdata can be nullable if chunk is unloaded now
|
||||
@Override
|
||||
protected boolean e(IBlockData iblockdata) {
|
||||
- return this.getFlameChance(iblockdata) > 0;
|
||||
+ return iblockdata != null && this.getFlameChance(iblockdata) > 0; // Paper - iblockdata can be nullable if chunk is unloaded now
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,40 +15,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -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) {
|
||||
- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i);
|
||||
- Validate.inclusiveBetween(0L, this.c, (long) j);
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper
|
||||
+ //Validate.inclusiveBetween(0L, this.c, (long) j); // Paper
|
||||
int k = i * this.b;
|
||||
int l = k >> 6;
|
||||
int i1 = (i + 1) * this.b - 1 >> 6;
|
||||
- Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i);
|
||||
- Validate.inclusiveBetween(0L, this.d, (long) j);
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
|
||||
+ //Validate.inclusiveBetween(0L, this.d, (long) j); // Paper
|
||||
int k = this.b(i);
|
||||
long l = this.b[k];
|
||||
int i1 = (i - k * this.f) * this.c;
|
||||
@@ -0,0 +0,0 @@ public class DataBits {
|
||||
}
|
||||
|
||||
public void b(int i, int j) {
|
||||
- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i);
|
||||
- Validate.inclusiveBetween(0L, this.c, (long) j);
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper
|
||||
+ //Validate.inclusiveBetween(0L, this.c, (long) j); // Paper
|
||||
int k = i * this.b;
|
||||
int l = k >> 6;
|
||||
int i1 = (i + 1) * this.b - 1 >> 6;
|
||||
- Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i);
|
||||
- Validate.inclusiveBetween(0L, this.d, (long) j);
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
|
||||
+ //Validate.inclusiveBetween(0L, this.d, (long) j); // Paper
|
||||
int k = this.b(i);
|
||||
long l = this.b[k];
|
||||
int i1 = (i - k * this.f) * this.c;
|
||||
@@ -0,0 +0,0 @@ public class DataBits {
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i);
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper
|
||||
int j = i * this.b;
|
||||
int k = j >> 6;
|
||||
int l = (i + 1) * this.b - 1 >> 6;
|
||||
- Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i);
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
|
||||
int j = this.b(i);
|
||||
long k = this.b[j];
|
||||
int l = (i - j * this.f) * this.c;
|
||||
|
@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/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 {
|
||||
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final ResourceKey<World> THE_NETHER = ResourceKey.a(IRegistry.ae, new MinecraftKey("the_nether"));
|
||||
public static final ResourceKey<World> THE_END = ResourceKey.a(IRegistry.ae, new MinecraftKey("the_end"));
|
||||
private static final EnumDirection[] a = EnumDirection.values();
|
||||
- public final List<TileEntity> tileEntityList = Lists.newArrayList();
|
||||
+ //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
|
||||
--- a/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()));
|
||||
@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTickList().a()));
|
||||
bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getFluidTickList().a()));
|
||||
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 {
|
||||
CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("type").a(writer);
|
||||
|
@ -24,11 +24,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/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
|
||||
|
||||
@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
|
||||
this.bx = flag;
|
||||
}
|
||||
|
||||
+ // 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
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -32,11 +32,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public CraftEntity getBukkitEntity() {
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
this.y = Vec3D.a;
|
||||
this.av = 1.0F;
|
||||
this.aw = 1.0F;
|
||||
this.x = Vec3D.a;
|
||||
this.at = 1.0F;
|
||||
this.au = 1.0F;
|
||||
- this.random = new Random();
|
||||
+ this.random = SHARED_RANDOM; // Paper
|
||||
this.fireTicks = -this.getMaxFireTicks();
|
||||
this.M = new Object2DoubleArrayMap(2);
|
||||
this.justCreated = true;
|
||||
this.uniqueID = MathHelper.a(this.random);
|
||||
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
- this.setAbsorptionHearts(nbttagcompound.getFloat("AbsorptionAmount"));
|
||||
+ // Paper start - jvm keeps optimizing the setter
|
||||
+ float absorptionAmount = nbttagcompound.getFloat("AbsorptionAmount");
|
||||
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ this.setAbsorptionHearts(absorptionAmount);
|
||||
+ // Paper end
|
||||
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 {
|
||||
}
|
||||
|
@ -11,20 +11,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -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
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
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
|
||||
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");
|
||||
this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread);
|
||||
+ SERVER = this; // Paper - better singleton
|
||||
this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new);
|
||||
this.craftingManager = new CraftingManager();
|
||||
this.tagRegistry = new TagRegistry();
|
||||
this.m = new GameProfilerSwitcher(SystemUtils.a, this::ag);
|
||||
this.methodProfiler = GameProfilerDisabled.a;
|
||||
this.serverPing = new ServerPing();
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
||||
@Deprecated
|
||||
@ -33,4 +33,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return SERVER; // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user