Archiviert
13
0

NOT FINISHED!!! More progress on 1.13-pre7

This work is unfinished, keep your paws off this branch!
Dieser Commit ist enthalten in:
Shane Freeder 2018-07-16 16:34:55 +01:00
Ursprung 878e963fc6
Commit 63214cb795
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F61EA5A085289C
36 geänderte Dateien mit 229 neuen und 1229 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,11 @@
From d97bed2c5c938d245595b74e0cdda94a68a6bc27 Mon Sep 17 00:00:00 2001 From 5c858f71d8de97fd30722aadac29e55925f707c1 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 23:45:08 -0600 Date: Tue, 1 Mar 2016 23:45:08 -0600
Subject: [PATCH] Entity Origin API Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 12b86ab75..2288df268 100644 index 20248de7e..6bb4cf48e 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -160,6 +160,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -160,6 +160,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -118,10 +118,10 @@ index fd64b75ed..3f0b6ac26 100644
flag = true; flag = true;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 1e3675e4f..0daa15f1b 100644 index f4edde236..9882fe466 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -781,4 +781,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -777,4 +777,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return spigot; return spigot;
} }
// Spigot end // Spigot end
@ -135,5 +135,5 @@ index 1e3675e4f..0daa15f1b 100644
+ // Paper end + // Paper end
} }
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,14 +1,14 @@
From b3b76f21bc0e86a173661b9fa351c886b89394e3 Mon Sep 17 00:00:00 2001 From 434dc56dd20d8354389d021209ca13482f41c1de Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc> From: kashike <kashike@vq.lc>
Date: Thu, 21 Apr 2016 23:51:55 -0700 Date: Thu, 21 Apr 2016 23:51:55 -0700
Subject: [PATCH] Add ability to configure frosted_ice properties Subject: [PATCH] Add ability to configure frosted_ice properties
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6ea608ba9..d96311f6b 100644 index ff9929a05..0c50cb4bd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -293,4 +293,14 @@ public class PaperWorldConfig { @@ -243,4 +243,14 @@ public class PaperWorldConfig {
private void useVanillaScoreboardColoring() { private void useVanillaScoreboardColoring() {
useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false); useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false);
} }
@ -24,25 +24,28 @@ index 6ea608ba9..d96311f6b 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java
index 950863fb9..a8dbbf20a 100644 index 1d5c24c7a..77cf6b8e9 100644
--- a/src/main/java/net/minecraft/server/BlockIceFrost.java --- a/src/main/java/net/minecraft/server/BlockIceFrost.java
+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java +++ b/src/main/java/net/minecraft/server/BlockIceFrost.java
@@ -19,10 +19,14 @@ public class BlockIceFrost extends BlockIce { @@ -12,6 +12,7 @@ public class BlockIceFrost extends BlockIce {
} }
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
+ if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice + if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice
if ((random.nextInt(3) == 0 || this.c(world, blockposition) < 4) && world.getLightLevel(blockposition) > 11 - ((Integer) iblockdata.get(BlockIceFrost.a)).intValue() - iblockdata.c()) { if ((random.nextInt(3) == 0 || this.a(world, blockposition, 4)) && world.getLightLevel(blockposition) > 11 - ((Integer) iblockdata.get(BlockIceFrost.a)).intValue() - iblockdata.b(world, blockposition) && this.c(iblockdata, world, blockposition)) {
this.a(world, blockposition, iblockdata, random, true); BlockPosition.b blockposition_b = BlockPosition.b.r();
} else { Throwable throwable = null;
- world.a(blockposition, (Block) this, MathHelper.nextInt(random, 20, 40)); @@ -27,7 +28,9 @@ public class BlockIceFrost extends BlockIce {
+ // Paper start - use configurable min/max delay IBlockData iblockdata1 = world.getType(blockposition_b);
+ //world.a(blockposition, (Block) this, MathHelper.nextInt(random, 20, 40));
+ world.a(blockposition, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax));
+ // Paper end
}
} if (iblockdata1.getBlock() == this && !this.c(iblockdata1, world, blockposition_b)) {
- world.I().a(blockposition_b, this, MathHelper.nextInt(random, 20, 40));
+ // Paper start - use configurable min/max delay
+ world.I().a(blockposition_b, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax));
+ // Paper end
}
}
} catch (Throwable throwable1) {
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,23 +1,23 @@
From eb11e43a94909435f4ce4020d2eded1eb0b8cdb1 Mon Sep 17 00:00:00 2001 From e27e2dd897b4f710aad5f7ac293ca48ffad02fcb Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 18:20:05 -0500 Date: Fri, 22 Apr 2016 18:20:05 -0500
Subject: [PATCH] Vehicle Event Cancellation Changes Subject: [PATCH] Vehicle Event Cancellation Changes
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 88faa4601..aece54d26 100644 index fecf29710..115504bf6 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -70,7 +70,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -80,7 +80,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public boolean i; public boolean j;
public final List<Entity> passengers; public final List<Entity> passengers;
protected int j; protected int k;
- private Entity au; - private Entity ax;
+ private Entity au;public void setVehicle(Entity entity) { this.au = entity; } // Paper // OBFHELPER + private Entity ax;public void setVehicle(Entity entity) { this.au = entity; } // Paper // OBFHELPER
public boolean attachedToPlayer; public boolean attachedToPlayer;
public World world; public World world;
public double lastX; public double lastX;
@@ -2004,6 +2004,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -2110,6 +2110,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else { } else {
// CraftBukkit start // CraftBukkit start
@ -25,7 +25,7 @@ index 88faa4601..aece54d26 100644
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle(); CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
Entity orig = craft == null ? null : craft.getHandle(); Entity orig = craft == null ? null : craft.getHandle();
if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
@@ -2019,7 +2020,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -2125,7 +2126,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
} }
} }
// CraftBukkit end // CraftBukkit end
@ -38,8 +38,8 @@ index 88faa4601..aece54d26 100644
+ // Paper end + // Paper end
+ +
this.passengers.remove(entity); this.passengers.remove(entity);
entity.j = 60; entity.k = 60;
} }
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,22 +0,0 @@
From ac45d8457a0c7eae58e0b9feebedd4e415bd383e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 13 Apr 2016 00:30:10 -0400
Subject: [PATCH] Don't tick Skulls - unused code
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
index a796c08ab..dd2665881 100644
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
@@ -24,7 +24,7 @@ import com.mojang.authlib.ProfileLookupCallback;
import java.util.concurrent.Callable;
// Spigot end
-public class TileEntitySkull extends TileEntity implements ITickable {
+public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable
private int a;
public int rotation;
--
2.18.0

Datei anzeigen

@ -1,4 +1,4 @@
From ce05afd0428918d9eab5599842bc9f2a485120f9 Mon Sep 17 00:00:00 2001 From 2d68b62e5d00ca7d2ad4c9773f33304070f53f75 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 28 Apr 2016 00:57:27 -0400 Date: Thu, 28 Apr 2016 00:57:27 -0400
Subject: [PATCH] remove null possibility for getServer singleton Subject: [PATCH] remove null possibility for getServer singleton
@ -6,26 +6,26 @@ Subject: [PATCH] remove null possibility for getServer singleton
to stop IDE complaining about potential NPE to stop IDE complaining about potential NPE
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b6c4d98fd..45d3dbde2 100644 index c5670fe8d..e11289217 100644
--- 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
@@ -53,6 +53,7 @@ import co.aikar.timings.MinecraftTimings; // Paper @@ -68,6 +68,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
public abstract class MinecraftServer implements ICommandListener, Runnable, IAsyncTaskHandler, IMojangStatistics { public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable {
+ 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 a = new File("usercache.json"); public static final File a = new File("usercache.json");
public Convertable convertable; public Convertable convertable;
@@ -124,6 +125,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -152,6 +153,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
// Spigot end // Spigot end
public MinecraftServer(OptionSet options, Proxy proxy, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
+ SERVER = this; // Paper - better singleton + SERVER = this; // Paper - better singleton
io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable this.commandDispatcher = commanddispatcher; // CraftBukkit
this.e = proxy; this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA);
this.V = yggdrasilauthenticationservice; this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new);
@@ -1636,7 +1638,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -1742,7 +1744,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
// CraftBukkit start // CraftBukkit start
@Deprecated @Deprecated
public static MinecraftServer getServer() { public static MinecraftServer getServer() {
@ -35,5 +35,5 @@ index b6c4d98fd..45d3dbde2 100644
// CraftBukkit end // CraftBukkit end
} }
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,136 +0,0 @@
From 10c2e6d3aef1221db2bc29f97cedc0b3c44bddf8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 13 Apr 2016 02:10:49 -0400
Subject: [PATCH] Configurable Player Collision
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index ec4643384..430b5d0cd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -220,4 +220,9 @@ public class PaperConfig {
private static void regionFileCacheSize() {
regionFileCacheSize = getInt("settings.region-file-cache-size", 256);
}
+
+ public static boolean enablePlayerCollisions = true;
+ private static void enablePlayerCollisions() {
+ enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true);
+ }
}
diff --git a/src/main/java/net/minecraft/server/CommandScoreboard.java b/src/main/java/net/minecraft/server/CommandScoreboard.java
index b08274d93..0607e55d3 100644
--- a/src/main/java/net/minecraft/server/CommandScoreboard.java
+++ b/src/main/java/net/minecraft/server/CommandScoreboard.java
@@ -183,6 +183,13 @@ public class CommandScoreboard extends CommandAbstract {
throw new ExceptionUsage("commands.scoreboard.teams.option.usage", new Object[0]);
}
+ // Paper start - Block setting options on our collideRule team as it is not persistent
+ if (astring[2].equals(MinecraftServer.getServer().getPlayerList().collideRuleTeamName)) {
+ icommandlistener.sendMessage(new ChatMessage("You cannot set team options on the collideRule team"));
+ return;
+ }
+ // Paper end
+
this.c(icommandlistener, astring, 2, minecraftserver);
}
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2300ee10b..b6c4d98fd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -332,6 +332,20 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.v.setPlayerFileData(this.worldServer);
this.a(this.getDifficulty());
this.l();
+
+ // Paper start - Handle collideRule team for player collision toggle
+ final Scoreboard scoreboard = this.getWorld().getScoreboard();
+ final java.util.Collection<String> toRemove = scoreboard.getTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(ScoreboardTeam::getName).collect(java.util.stream.Collectors.toList());
+ for (String teamName : toRemove) {
+ scoreboard.removeTeam(scoreboard.getTeam(teamName)); // Clean up after ourselves
+ }
+
+ if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) {
+ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + this.getWorld().random.nextInt(), 16);
+ ScoreboardTeam collideTeam = scoreboard.createTeam(this.getPlayerList().collideRuleTeamName);
+ collideTeam.setCanSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all
+ }
+ // Paper end
}
protected void l() {
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
index 549d4e89d..df11764e0 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
@@ -96,7 +96,7 @@ public class PacketPlayOutScoreboardTeam implements Packet<PacketListenerPlayOut
packetdataserializer.a(this.d);
packetdataserializer.writeByte(this.j);
packetdataserializer.a(this.e);
- packetdataserializer.a(this.f);
+ packetdataserializer.a(!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions ? "never" : this.f); // Paper
packetdataserializer.writeByte(this.g);
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index baf288210..950dbdc50 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -74,6 +74,7 @@ public abstract class PlayerList {
// CraftBukkit start
private CraftServer cserver;
private final Map<String,EntityPlayer> playersByName = new org.spigotmc.CaseInsensitiveMap<EntityPlayer>();
+ @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule
public PlayerList(MinecraftServer minecraftserver) {
this.cserver = minecraftserver.server = new CraftServer(minecraftserver, this);
@@ -234,6 +235,12 @@ public abstract class PlayerList {
}
entityplayer.syncInventory();
+ // Paper start - Add to collideRule team if needed
+ final Scoreboard scoreboard = this.getServer().getWorld().getScoreboard();
+ if (this.collideRuleTeamName != null && scoreboard.getTeam(collideRuleTeamName) != null && entityplayer.getTeam() == null) {
+ scoreboard.addPlayerToTeam(entityplayer.getName(), collideRuleTeamName);
+ }
+ // Paper end
// CraftBukkit - Moved from above, added world
PlayerList.f.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at ([" + entityplayer.world.worldData.getName() + "]" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
}
@@ -425,6 +432,16 @@ public abstract class PlayerList {
entityplayer.playerTick();// SPIGOT-924
// CraftBukkit end
+ // Paper start - Remove from collideRule team if needed
+ if (this.collideRuleTeamName != null) {
+ final Scoreboard scoreBoard = this.server.getWorld().getScoreboard();
+ final ScoreboardTeam team = scoreBoard.getTeam(this.collideRuleTeamName);
+ if (entityplayer.getTeam() == team && team != null) {
+ scoreBoard.removePlayerFromTeam(entityplayer.getName(), team);
+ }
+ }
+ // Paper end
+
this.savePlayerFile(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getVehicle();
@@ -1352,7 +1369,13 @@ public abstract class PlayerList {
player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
}
// CraftBukkit end
-
+ // Paper start - Remove collideRule team if it exists
+ if (this.collideRuleTeamName != null) {
+ final Scoreboard scoreboard = this.getServer().getWorld().getScoreboard();
+ final ScoreboardTeam team = scoreboard.getTeam(this.collideRuleTeamName);
+ if (team != null) scoreboard.removeTeam(team);
+ }
+ // Paper end
}
// CraftBukkit start
--
2.18.0

Datei anzeigen

@ -1,4 +1,4 @@
From ed9719aea67d9235b946eeb5e93922c4ceda3707 Mon Sep 17 00:00:00 2001 From 2cfae6d7882500d8af89756f8353d22d148098f1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 29 Apr 2016 20:02:00 -0400 Date: Fri, 29 Apr 2016 20:02:00 -0400
Subject: [PATCH] Improve Maps (in item frames) performance and bug fixes Subject: [PATCH] Improve Maps (in item frames) performance and bug fixes
@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed. Additionally, numerous issues to player position tracking on maps has been fixed.
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 467c5bf1a..0f1d99636 100644 index 1aa32bf11..36a961cb7 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java --- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -548,6 +548,12 @@ public abstract class EntityHuman extends EntityLiving { @@ -610,6 +610,12 @@ public abstract class EntityHuman extends EntityLiving {
return null; return null;
} }
// CraftBukkit end // CraftBukkit end
@ -30,10 +30,10 @@ index 467c5bf1a..0f1d99636 100644
ItemStack itemstack1 = this.a(entityitem); ItemStack itemstack1 = this.a(entityitem);
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 4c6eb6ed1..759dacba7 100644 index 6ae576a2e..af1981967 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -90,11 +90,11 @@ public class EntityTrackerEntry { @@ -90,7 +90,7 @@ public class EntityTrackerEntry {
} }
// PAIL : rename // PAIL : rename
@ -42,16 +42,11 @@ index 4c6eb6ed1..759dacba7 100644
EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker; EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker;
ItemStack itemstack = entityitemframe.getItem(); ItemStack itemstack = entityitemframe.getItem();
- if (this.a % 10 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.a % 10 logic here so item frames do not enter the other blocks
+ if (itemstack != null && itemstack.getItem() instanceof ItemWorldMap) { // Paper - moved back up
WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, this.tracker.world);
Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit
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 5f92355db..eca4903ed 100644 index 3b3cc69de..4588df4b1 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
@@ -1223,6 +1223,7 @@ public abstract class World implements IBlockAccess { @@ -1075,6 +1075,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
{ {
if ( iter.next().trackee == entity ) if ( iter.next().trackee == entity )
{ {
@ -60,18 +55,18 @@ index 5f92355db..eca4903ed 100644
} }
} }
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
index 1096b5c1f..59173605e 100644 index 445a016b7..4c64f90be 100644
--- 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
@@ -28,6 +28,7 @@ public class WorldMap extends PersistentBase { @@ -29,6 +29,7 @@ public class WorldMap extends PersistentBase {
public List<WorldMap.WorldMapHumanTracker> i = Lists.newArrayList(); public final Map<EntityHuman, WorldMap.WorldMapHumanTracker> j = Maps.newHashMap(); // Spigot private -> public
public final Map<EntityHuman, WorldMap.WorldMapHumanTracker> k = Maps.newHashMap(); // Spigot private -> public private final Map<String, MapIconBanner> k = Maps.newHashMap();
public Map<UUID, MapIcon> decorations = Maps.newLinkedHashMap(); // Spigot public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
+ 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
public final CraftMapView mapView; public final CraftMapView mapView;
@@ -40,6 +41,7 @@ public class WorldMap extends PersistentBase { @@ -41,6 +42,7 @@ public class WorldMap extends PersistentBase {
// CraftBukkit start // CraftBukkit start
mapView = new CraftMapView(this); mapView = new CraftMapView(this);
server = (CraftServer) org.bukkit.Bukkit.getServer(); server = (CraftServer) org.bukkit.Bukkit.getServer();
@ -79,23 +74,23 @@ index 1096b5c1f..59173605e 100644
// CraftBukkit end // CraftBukkit end
} }
@@ -114,6 +116,7 @@ public class WorldMap extends PersistentBase { @@ -105,6 +107,7 @@ public class WorldMap extends PersistentBase {
} this.k.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 + vanillaRender.buffer = colors; // Paper
} }
@@ -149,6 +152,7 @@ public class WorldMap extends PersistentBase { @@ -148,6 +151,7 @@ public class WorldMap extends PersistentBase {
return nbttagcompound; return nbttagcompound;
} }
+ public void updateSeenPlayers(EntityHuman entityhuman, ItemStack itemstack) { a(entityhuman, itemstack); } // Paper - OBFHELPER + public void updateSeenPlayers(EntityHuman entityhuman, ItemStack itemstack) { a(entityhuman, itemstack); } // Paper - OBFHELPER
public void a(EntityHuman entityhuman, ItemStack itemstack) { public void a(EntityHuman entityhuman, ItemStack itemstack) {
if (!this.k.containsKey(entityhuman)) { if (!this.j.containsKey(entityhuman)) {
WorldMap.WorldMapHumanTracker worldmap_worldmaphumantracker = new WorldMap.WorldMapHumanTracker(entityhuman); WorldMap.WorldMapHumanTracker worldmap_worldmaphumantracker = new WorldMap.WorldMapHumanTracker(entityhuman);
@@ -314,6 +318,21 @@ public class WorldMap extends PersistentBase { @@ -361,6 +365,21 @@ public class WorldMap extends PersistentBase {
public class WorldMapHumanTracker { public class WorldMapHumanTracker {
@ -117,7 +112,7 @@ index 1096b5c1f..59173605e 100644
public final EntityHuman trackee; public final EntityHuman trackee;
private boolean d = true; private boolean d = true;
private int e; private int e;
@@ -330,9 +349,12 @@ public class WorldMap extends PersistentBase { @@ -377,9 +396,12 @@ public class WorldMap extends PersistentBase {
@Nullable @Nullable
public Packet<?> a(ItemStack itemstack) { public Packet<?> a(ItemStack itemstack) {
// CraftBukkit start // CraftBukkit start
@ -145,5 +140,5 @@ index 256a13178..5768cd512 100644
public RenderData() { public RenderData() {
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,49 +0,0 @@
From 4680099c5915c8bc2ad1f64d3e1899efe5430da8 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 13 Apr 2016 20:21:38 -0700
Subject: [PATCH] Add handshake event to allow plugins to handle client
handshaking logic themselves
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index c3c9c3c1f..309ab18df 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -72,8 +72,33 @@ public class HandshakeListener implements PacketHandshakingInListener {
this.b.close(chatmessage);
} else {
this.b.setPacketListener(new LoginListener(this.a, this.b));
+ // Paper start - handshake event
+ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee;
+ boolean handledByEvent = false;
+ // Try and handle the handshake through the event
+ if (com.destroystokyo.paper.event.player.PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) { // Hello? Can you hear me?
+ com.destroystokyo.paper.event.player.PlayerHandshakeEvent event = new com.destroystokyo.paper.event.player.PlayerHandshakeEvent(packethandshakinginsetprotocol.hostname, !proxyLogicEnabled);
+ if (event.callEvent()) {
+ // 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);
+ return;
+ }
+
+ packethandshakinginsetprotocol.hostname = event.getServerHostname();
+ this.b.l = 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);
+ handledByEvent = true; // Hooray, we did it!
+ }
+ }
+ // Don't try and handle default logic if it's been handled by the event.
+ if (!handledByEvent && proxyLogicEnabled) {
+ // Paper end
// Spigot Start
- if (org.spigotmc.SpigotConfig.bungee) {
+ //if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
String[] split = packethandshakinginsetprotocol.hostname.split("\00");
if ( split.length == 3 || split.length == 4 ) {
packethandshakinginsetprotocol.hostname = split[0];
--
2.18.0

Datei anzeigen

@ -1,4 +1,4 @@
From e390dbccabd0c678c953bc4769e771a54e4c38bb Mon Sep 17 00:00:00 2001 From 1ccbd86167f75dcdfa7824285a9b772ae1b8dcfb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 1 May 2016 21:19:14 -0400 Date: Sun, 1 May 2016 21:19:14 -0400
Subject: [PATCH] LootTable API & Replenishable Lootables Feature Subject: [PATCH] LootTable API & Replenishable Lootables Feature
@ -11,10 +11,10 @@ This feature is good for long term worlds so that newer players
do not suffer with "Every chest has been looted" do not suffer with "Every chest has been looted"
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d96311f6b..067cb233e 100644 index 0c50cb4bd..38de48ebc 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -303,4 +303,26 @@ public class PaperWorldConfig { @@ -253,4 +253,26 @@ public class PaperWorldConfig {
this.frostedIceDelayMax = this.getInt("frosted-ice.delay.max", this.frostedIceDelayMax); this.frostedIceDelayMax = this.getInt("frosted-ice.delay.max", this.frostedIceDelayMax);
log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax); log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax);
} }
@ -231,7 +231,7 @@ index 000000000..668097620
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java
new file mode 100644 new file mode 100644
index 000000000..de2eff17e index 000000000..9a65603bc
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java
@@ -0,0 +1,182 @@ @@ -0,0 +1,182 @@
@ -364,7 +364,7 @@ index 000000000..de2eff17e
+ this.lootedPlayers = new HashMap<>(list.size()); + this.lootedPlayers = new HashMap<>(list.size());
+ } + }
+ for (int i = 0; i < size; i++) { + for (int i = 0; i < size; i++) {
+ final NBTTagCompound cmp = list.get(i); + final NBTTagCompound cmp = list.getCompound(i);
+ lootedPlayers.put(cmp.getUUID("UUID"), cmp.getLong("Time")); + lootedPlayers.put(cmp.getUUID("UUID"), cmp.getLong("Time"));
+ } + }
+ } + }
@ -418,7 +418,7 @@ index 000000000..de2eff17e
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
index d6afa4aa6..50d7d34b8 100644 index dc329dcc5..d3bf88585 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java --- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java +++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
@@ -6,17 +6,21 @@ import javax.annotation.Nullable; @@ -6,17 +6,21 @@ import javax.annotation.Nullable;
@ -445,7 +445,7 @@ index d6afa4aa6..50d7d34b8 100644
// CraftBukkit start // CraftBukkit start
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>(); public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
@@ -164,12 +168,13 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @@ -159,12 +163,13 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
protected void b(NBTTagCompound nbttagcompound) { protected void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
@ -460,7 +460,7 @@ index d6afa4aa6..50d7d34b8 100644
ContainerUtil.a(nbttagcompound, this.items); ContainerUtil.a(nbttagcompound, this.items);
} }
@@ -177,11 +182,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @@ -172,11 +177,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
protected void a(NBTTagCompound nbttagcompound) { protected void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
@ -474,20 +474,20 @@ index d6afa4aa6..50d7d34b8 100644
ContainerUtil.b(nbttagcompound, this.items); ContainerUtil.b(nbttagcompound, this.items);
} }
@@ -230,10 +236,10 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @@ -225,10 +231,10 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
} }
public void f(@Nullable EntityHuman entityhuman) { public void f(@Nullable EntityHuman entityhuman) {
- if (this.c != null) { - if (this.c != null && this.world.getMinecraftServer() != null) {
+ if (lootableData.shouldReplenish(entityhuman)) { // Paper + if (lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper
LootTable loottable = this.world.getLootTableRegistry().a(this.c); LootTable loottable = this.world.getMinecraftServer().aP().a(this.c);
- this.c = null; - this.c = null;
+ lootableData.processRefill(entityhuman); // Paper + lootableData.processRefill(entityhuman); // Paper
Random random; Random random;
if (this.d == 0L) { if (this.d == 0L) {
@@ -258,12 +264,52 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @@ -253,12 +259,51 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
this.items.clear(); this.items.clear();
} }
@ -497,9 +497,8 @@ index d6afa4aa6..50d7d34b8 100644
this.d = i; this.d = i;
} }
+ + public MinecraftKey getLootTableKey() { return Q_(); } // Paper - OBFHELPER
+ public MinecraftKey getLootTableKey() { return b(); } // Paper - OBFHELPER public MinecraftKey Q_() {
public MinecraftKey b() {
return this.c; return this.c;
} }
+ +
@ -541,10 +540,10 @@ index d6afa4aa6..50d7d34b8 100644
+ // Paper end + // Paper end
} }
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
index a97ad2037..618521304 100644 index ce710d219..9c8bebe4b 100644
--- a/src/main/java/net/minecraft/server/TileEntityLootable.java --- a/src/main/java/net/minecraft/server/TileEntityLootable.java
+++ b/src/main/java/net/minecraft/server/TileEntityLootable.java +++ b/src/main/java/net/minecraft/server/TileEntityLootable.java
@@ -1,44 +1,50 @@ @@ -1,12 +1,16 @@
package net.minecraft.server; package net.minecraft.server;
+import com.destroystokyo.paper.loottable.CraftLootableInventoryData; // Paper +import com.destroystokyo.paper.loottable.CraftLootableInventoryData; // Paper
@ -557,18 +556,20 @@ index a97ad2037..618521304 100644
-public abstract class TileEntityLootable extends TileEntityContainer implements ILootable { -public abstract class TileEntityLootable extends TileEntityContainer implements ILootable {
+public abstract class TileEntityLootable extends TileEntityContainer implements ILootable, CraftLootableInventory { // Paper +public abstract class TileEntityLootable extends TileEntityContainer implements ILootable, CraftLootableInventory { // Paper
protected MinecraftKey m; protected MinecraftKey g;
- protected long n; - protected long h;
+ protected long n; public long getLootTableSeed() { return n; } // Paper - OBFHELPER + protected long h; public long getLootTableSeed() { return h; } // Paper - OBFHELPER
protected String o; protected IChatBaseComponent i;
public TileEntityLootable() {} protected TileEntityLootable(TileEntityTypes<?> tileentitytypes) {
@@ -23,16 +27,18 @@ public abstract class TileEntityLootable extends TileEntityContainer implements
}
protected boolean c(NBTTagCompound nbttagcompound) { protected boolean d(NBTTagCompound nbttagcompound) {
+ lootableData.loadNbt(nbttagcompound); // Paper + lootableData.loadNbt(nbttagcompound); // Paper
if (nbttagcompound.hasKeyOfType("LootTable", 8)) { if (nbttagcompound.hasKeyOfType("LootTable", 8)) {
this.m = new MinecraftKey(nbttagcompound.getString("LootTable")); this.g = new MinecraftKey(nbttagcompound.getString("LootTable"));
this.n = nbttagcompound.getLong("LootTableSeed"); this.h = nbttagcompound.getLong("LootTableSeed");
- return true; - return true;
+ return false; // Paper - always load the items, table may still remain + return false; // Paper - always load the items, table may still remain
} else { } else {
@ -576,49 +577,47 @@ index a97ad2037..618521304 100644
} }
} }
protected boolean d(NBTTagCompound nbttagcompound) { protected boolean e(NBTTagCompound nbttagcompound) {
+ lootableData.saveNbt(nbttagcompound); // Paper + lootableData.saveNbt(nbttagcompound); // Paper
if (this.m != null) { if (this.g == null) {
nbttagcompound.setString("LootTable", this.m.toString()); return false;
if (this.n != 0L) { } else {
nbttagcompound.setLong("LootTableSeed", this.n); @@ -41,15 +47,15 @@ public abstract class TileEntityLootable extends TileEntityContainer implements
nbttagcompound.setLong("LootTableSeed", this.h);
} }
- return true; - return true;
+ return false; // Paper - always save the items, table may still remain + return false; // Paper - always save the items, table may still remain
} else {
return false;
} }
} }
public void d(@Nullable EntityHuman entityhuman) { public void d(@Nullable EntityHuman entityhuman) {
- if (this.m != null) { - if (this.g != null && this.world.getMinecraftServer() != null) {
+ if (lootableData.shouldReplenish(entityhuman)) { // Paper + if (lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper
LootTable loottable = this.world.getLootTableRegistry().a(this.m); LootTable loottable = this.world.getMinecraftServer().aP().a(this.g);
- this.m = null; - this.g = null;
+ lootableData.processRefill(entityhuman); // Paper + lootableData.processRefill(entityhuman); // Paper
Random random; Random random;
if (this.n == 0L) { if (this.h == 0L) {
@@ -58,10 +64,12 @@ public abstract class TileEntityLootable extends TileEntityContainer implements @@ -70,10 +76,12 @@ public abstract class TileEntityLootable extends TileEntityContainer implements
} }
+ public MinecraftKey getLootTableKey() { return b(); } // Paper - OBFHELPER + public MinecraftKey getLootTableKey() { return Q_(); } // Paper - OBFHELPER
public MinecraftKey b() { public MinecraftKey Q_() {
return this.m; return this.g;
} }
+ public void setLootTable(MinecraftKey key, long seed) { a(key, seed);} // Paper - OBFHELPER + public void setLootTable(MinecraftKey key, long seed) { a(key, seed);} // Paper - OBFHELPER
public void a(MinecraftKey minecraftkey, long i) { public void a(MinecraftKey minecraftkey, long i) {
this.m = minecraftkey; this.g = minecraftkey;
this.n = i; this.h = i;
@@ -134,4 +142,42 @@ public abstract class TileEntityLootable extends TileEntityContainer implements @@ -152,4 +160,41 @@ public abstract class TileEntityLootable extends TileEntityContainer implements
}
protected abstract NonNullList<ItemStack> q(); protected abstract NonNullList<ItemStack> q();
+
protected abstract void a(NonNullList<ItemStack> nonnulllist);
+ // Paper start - LootTable API + // Paper start - LootTable API
+ private final CraftLootableInventoryData lootableData = new CraftLootableInventoryData(this); + private final CraftLootableInventoryData lootableData = new CraftLootableInventoryData(this);
+ +
@ -652,16 +651,16 @@ index a97ad2037..618521304 100644
+ @Override + @Override
+ public void clearLootTable() { + public void clearLootTable() {
+ //noinspection RedundantCast + //noinspection RedundantCast
+ this.m = (MinecraftKey) null; + this.g = (MinecraftKey) null;
+ } + }
+ // Paper end + // Paper end
+ +
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 8328ed005..266f87d7f 100644 index ac9b4297b..0558cafe3 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -60,7 +60,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState @@ -61,7 +61,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
} }
// gets the wrapped TileEntity // gets the wrapped TileEntity
@ -671,17 +670,18 @@ index 8328ed005..266f87d7f 100644
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
index 85f3bb272..733c04ef7 100644 index 6a54f2a16..a94c78512 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
@@ -1,5 +1,6 @@ @@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block; package org.bukkit.craftbukkit.block;
import net.minecraft.server.BlockChest;
+import com.destroystokyo.paper.loottable.CraftLootableBlockInventory; // Paper +import com.destroystokyo.paper.loottable.CraftLootableBlockInventory; // Paper
import net.minecraft.server.BlockPosition; import net.minecraft.server.BlockPosition;
import net.minecraft.server.TileEntityChest; import net.minecraft.server.Blocks;
import net.minecraft.server.ITileInventory;
@@ -11,7 +12,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventory; @@ -15,7 +16,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest; import org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
@ -791,5 +791,5 @@ index e9963e21c..acb4dee04 100644
CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) { CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) {
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,14 +1,14 @@
From a49583a3643759dfa8082967cbb3ff44021d6394 Mon Sep 17 00:00:00 2001 From 02a8ef4ee2f4d3efc01255a137a232fa5f974352 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 19 Jan 2016 00:13:19 -0500 Date: Tue, 19 Jan 2016 00:13:19 -0500
Subject: [PATCH] Do not load chunks for pathfinding Subject: [PATCH] Do not load chunks for pathfinding
diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java
index 08b986fd7..786d1dd22 100644 index 6d153e431..07444a86a 100644
--- a/src/main/java/net/minecraft/server/ChunkCache.java --- a/src/main/java/net/minecraft/server/ChunkCache.java
+++ b/src/main/java/net/minecraft/server/ChunkCache.java +++ b/src/main/java/net/minecraft/server/ChunkCache.java
@@ -25,7 +25,7 @@ public class ChunkCache implements IBlockAccess { @@ -27,7 +27,7 @@ public class ChunkCache implements IIBlockAccess {
for (l = this.a; l <= j; ++l) { for (l = this.a; l <= j; ++l) {
for (i1 = this.b; i1 <= k; ++i1) { for (i1 = this.b; i1 <= k; ++i1) {
@ -18,5 +18,5 @@ index 08b986fd7..786d1dd22 100644
} }
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,4 +1,4 @@
From 2c29fda252395dc3caf19e77deea3ef876473ace Mon Sep 17 00:00:00 2001 From e138c0afb73cd67fdc728c5fb0d20bc9f82b578a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 17 Jun 2013 01:24:00 -0400 Date: Mon, 17 Jun 2013 01:24:00 -0400
Subject: [PATCH] Entity Tracking Improvements Subject: [PATCH] Entity Tracking Improvements
@ -7,10 +7,10 @@ If any part of a Vehicle/Passenger relationship is visible to a player,
send all passenger/vehicles to the player in the chain. send all passenger/vehicles to the player in the chain.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d1f07bbbd..945f06c93 100644 index 115504bf6..509254b35 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -53,6 +53,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -57,6 +57,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
protected CraftEntity bukkitEntity; protected CraftEntity bukkitEntity;
@ -19,7 +19,7 @@ index d1f07bbbd..945f06c93 100644
if (bukkitEntity == null) { if (bukkitEntity == null) {
bukkitEntity = CraftEntity.getEntity(world.getServer(), this); bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 759dacba7..efc4c79ab 100644 index af1981967..e054ae905 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -49,6 +49,7 @@ public class EntityTrackerEntry { @@ -49,6 +49,7 @@ public class EntityTrackerEntry {
@ -90,7 +90,7 @@ index 759dacba7..efc4c79ab 100644
double d0 = entityplayer.locX - (double) this.xLoc / 4096.0D; double d0 = entityplayer.locX - (double) this.xLoc / 4096.0D;
double d1 = entityplayer.locZ - (double) this.zLoc / 4096.0D; double d1 = entityplayer.locZ - (double) this.zLoc / 4096.0D;
int i = Math.min(this.e, this.f); int i = Math.min(this.e, this.f);
@@ -593,6 +636,7 @@ public class EntityTrackerEntry { @@ -597,6 +640,7 @@ public class EntityTrackerEntry {
this.trackedPlayers.remove(entityplayer); this.trackedPlayers.remove(entityplayer);
this.tracker.c(entityplayer); this.tracker.c(entityplayer);
entityplayer.c(this.tracker); entityplayer.c(this.tracker);
@ -99,5 +99,5 @@ index 759dacba7..efc4c79ab 100644
} }
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,60 +0,0 @@
From 868e6d9441457ad084678875f8c583f27d306916 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 14 Apr 2016 21:01:39 -0400
Subject: [PATCH] Fix Bugs with Spigot Mob Spawn Logic
Spigot drastically altered vanilla mob spawn logic and caused a few issues.
1) Used only spawnable chunks vs entire world for entity counting, resulting in ignoring
other entities in the world, and causing the world to go over its intended limit.
Specially with servers using smaller mob spawn ranges than view distance, as well as affects spawning API
2) Spigot was using 16x16 division instead of vanilla 17x17 division.
This patch returns mob counting to use all loaded chunks, and 17x17 division.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index e07ef14ed..aca1457b0 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -716,7 +716,7 @@ public class Chunk {
i = this.entitySlices.length - 1;
}
- this.entitySlices[i].remove(entity);
+ if (!this.entitySlices[i].remove(entity)) { return; } // Paper
// Paper start - update counts
if (entity instanceof EntityItem) {
itemCounts[i]--;
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 45a83ae99..ed22607d9 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -23,6 +23,15 @@ public final class SpawnerCreature {
// Spigot start - get entity count only from chunks being processed in b
private int getEntityCount(WorldServer server, Class oClass)
{
+ // Paper start - use entire world, not just active chunks. Spigot broke vanilla expectations.
+ if (true) {
+ int sum = 0;
+ for (Chunk c : server.getChunkProviderServer().chunks.values()) {
+ sum += c.entityCount.get(oClass);
+ }
+ return sum;
+ }
+ // Paper end
int i = 0;
Iterator<Long> it = this.b.iterator();
while ( it.hasNext() )
@@ -126,7 +135,7 @@ public final class SpawnerCreature {
int l1 = limit * i / a; // CraftBukkit - use per-world limits
*/ // Paper end
- if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 256) {
+ if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 289) { // Paper - use 17x17 like vanilla (a at top of file)
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
Iterator iterator1 = this.b.iterator();
--
2.18.0

Datei anzeigen

@ -1,23 +0,0 @@
From 5381880d6b4b91e8b8cf2377ba8a09a7eb5d4cc0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 16 Apr 2016 00:39:33 -0400
Subject: [PATCH] Configurable RCON IP address
For servers with multiple IP's, ability to bind to a specific interface.
diff --git a/src/main/java/net/minecraft/server/RemoteControlListener.java b/src/main/java/net/minecraft/server/RemoteControlListener.java
index a6a0d5a29..efcafe77f 100644
--- a/src/main/java/net/minecraft/server/RemoteControlListener.java
+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java
@@ -24,7 +24,7 @@ public class RemoteControlListener extends RemoteConnectionThread {
super(iminecraftserver, "RCON Listener");
this.h = iminecraftserver.a("rcon.port", 0);
this.l = iminecraftserver.a("rcon.password", "");
- this.j = iminecraftserver.d_();
+ this.j = iminecraftserver.a("rcon.ip", iminecraftserver.d_()); // Paper
this.i = iminecraftserver.e_();
if (0 == this.h) {
this.h = this.i + 10;
--
2.18.0

Datei anzeigen

@ -1,4 +1,4 @@
From 046d1dbd3f9ea1948d7d1c66e188f5d1f142b382 Mon Sep 17 00:00:00 2001 From 0564a6de9dfcd2be9f73d342a46a610210e4ae32 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 7 May 2016 23:33:08 -0400 Date: Sat, 7 May 2016 23:33:08 -0400
Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat
@ -19,10 +19,10 @@ index 430b5d0cd..011cbf5e3 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/PersistentScoreboard.java b/src/main/java/net/minecraft/server/PersistentScoreboard.java diff --git a/src/main/java/net/minecraft/server/PersistentScoreboard.java b/src/main/java/net/minecraft/server/PersistentScoreboard.java
index c9c01fad9..89c8d045b 100644 index 81afa3195..ed3d5c889 100644
--- a/src/main/java/net/minecraft/server/PersistentScoreboard.java --- a/src/main/java/net/minecraft/server/PersistentScoreboard.java
+++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java +++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java
@@ -184,6 +184,7 @@ public class PersistentScoreboard extends PersistentBase { @@ -175,6 +175,7 @@ public class PersistentScoreboard extends PersistentBase {
while (iterator.hasNext()) { while (iterator.hasNext()) {
ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next(); ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next();
@ -31,5 +31,5 @@ index c9c01fad9..89c8d045b 100644
nbttagcompound.setString("Name", scoreboardteam.getName()); nbttagcompound.setString("Name", scoreboardteam.getName());
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,4 +1,4 @@
From 43debbd620fdfdcda18b02c5826c4b1bfeea5979 Mon Sep 17 00:00:00 2001 From 73a66676b80b85ce66c2fb365c6c361a219a0491 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 12 May 2016 02:03:56 -0400 Date: Thu, 12 May 2016 02:03:56 -0400
Subject: [PATCH] Fix Chunk Unload Queue Issues Subject: [PATCH] Fix Chunk Unload Queue Issues
@ -9,23 +9,23 @@ has not resolved all the bugs with the changes.
This patch fixes known issues and really should be applied by Spigot team. This patch fixes known issues and really should be applied by Spigot team.
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 ba3ee64f8..857df2937 100644 index aaa65582b..8ecdf7a5b 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -75,7 +75,7 @@ public class Chunk { @@ -58,7 +58,7 @@ public class Chunk implements IChunkAccess {
private long w; private long A; public long getInhabitedTime() { return A; } // Paper - OBFHELPER
private int x; private int B;
private final ConcurrentLinkedQueue<BlockPosition> y; private final ConcurrentLinkedQueue<BlockPosition> C;
- public boolean d; - public boolean d;
+ public boolean d; public void setShouldUnload(boolean unload) { this.d = unload; } public boolean isUnloading() { return d; } // Paper - OBFHELPER + public boolean d; public void setShouldUnload(boolean unload) { this.d = unload; } public boolean isUnloading() { return d; } // Paper - OBFHELPER
protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot private ChunkStatus D;
private int E;
// Paper start private final AtomicInteger F;
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 1771a1794..5cc192bbd 100644 index bb96a7392..7825dc91b 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
@@ -299,6 +299,7 @@ public class ChunkProviderServer implements IChunkProvider { @@ -302,6 +302,7 @@ public class ChunkProviderServer implements IChunkProvider {
if (chunk != null && chunk.d) { if (chunk != null && chunk.d) {
// CraftBukkit start - move unload logic to own method // CraftBukkit start - move unload logic to own method
@ -34,5 +34,5 @@ index 1771a1794..5cc192bbd 100644
continue; continue;
} }
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,47 +0,0 @@
From 419c239883797136eb0bbde7cdb5bfd8841d37e6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 17 Apr 2016 17:27:09 -0400
Subject: [PATCH] Prevent Fire from loading chunks
This causes the nether to spam unload/reload chunks, plus overall
bad behavior.
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index a3a5c853c..6832a19af 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -164,6 +164,7 @@ public class BlockFire extends Block {
}
BlockPosition blockposition1 = blockposition.a(j, l, k);
+ if (!world.isLoaded(blockposition1)) continue; // Paper
int j1 = this.d(world, blockposition1);
if (j1 > 0) {
@@ -232,10 +233,13 @@ public class BlockFire extends Block {
}
private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
+ // Paper start
+ final IBlockData iblockdata = world.getTypeIfLoaded(blockposition);
+ if (iblockdata == null) return;
int k = this.e(world.getType(blockposition).getBlock());
if (random.nextInt(i) < k) {
- IBlockData iblockdata = world.getType(blockposition);
+ //IBlockData iblockdata = world.getType(blockposition); // Paper
// CraftBukkit start
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
@@ -294,6 +298,8 @@ public class BlockFire extends Block {
for (int k = 0; k < j; ++k) {
EnumDirection enumdirection = aenumdirection[k];
+ final IBlockData type = world.getTypeIfLoaded(blockposition.shift(enumdirection)); // Paper
+ if (type == null) continue; // Paper
i = Math.max(this.f(world.getType(blockposition.shift(enumdirection)).getBlock()), i);
}
--
2.18.0

Datei anzeigen

@ -1,75 +0,0 @@
From bbc97e4f39fba21a155703397d8ddbce77535318 Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com>
Date: Tue, 19 Apr 2016 14:09:31 -0500
Subject: [PATCH] Implement PlayerLocaleChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index ed3546ccc..4b6976b19 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -31,7 +31,7 @@ import org.bukkit.inventory.MainHand;
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger bV = LogManager.getLogger();
- public String locale = "en_us"; // CraftBukkit - lowercase
+ public String locale = null; // PAIL: private -> public // Paper - default to null
public PlayerConnection playerConnection;
public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager;
@@ -1238,12 +1238,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT);
this.server.server.getPluginManager().callEvent(event);
}
- if (!this.locale.equals(packetplayinsettings.a())) {
+
+ // 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.a();
+ if (!this.locale.equals(oldLocale)) {
+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent();
+ }
+
+ // Compat with Bukkit
+ oldLocale = oldLocale != null ? oldLocale : "en_us";
+ // Paper end
+
+ if (!oldLocale.equals(packetplayinsettings.a())) {
PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.a());
this.server.server.getPluginManager().callEvent(event);
}
// CraftBukkit end
- this.locale = packetplayinsettings.a();
this.cl = packetplayinsettings.c();
this.cm = packetplayinsettings.d();
this.getDataWatcher().set(EntityPlayer.br, Byte.valueOf((byte) packetplayinsettings.e()));
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6e2773cbb..532b211c4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1637,8 +1637,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public String getLocale() {
- return getHandle().locale;
-
+ // Paper start - Locale change event
+ final String locale = getHandle().locale;
+ return locale != null ? locale : "en_us";
+ // Paper end
}
public void setAffectsSpawning(boolean affects) {
@@ -1775,7 +1777,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public String getLocale()
{
- return getHandle().locale;
+ return CraftPlayer.this.getLocale(); // Paper
}
@Override
--
2.18.0

Datei anzeigen

@ -1,4 +1,4 @@
From 031e6fb04b93ac290d753cf7777fd87830f14e9e Mon Sep 17 00:00:00 2001 From 8d20e9bc7ae7d6fa474f5afa0823368327d65fd4 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 12 May 2016 23:02:58 -0500 Date: Thu, 12 May 2016 23:02:58 -0500
Subject: [PATCH] System property for disabling watchdoge Subject: [PATCH] System property for disabling watchdoge
@ -18,5 +18,5 @@ index 0c106ea9c..57a4748a3 100644
Logger log = Bukkit.getServer().getLogger(); Logger log = Bukkit.getServer().getLogger();
log.log( Level.SEVERE, "The server has stopped responding!" ); log.log( Level.SEVERE, "The server has stopped responding!" );
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,45 +0,0 @@
From 66452482b3e19d2cb4b1c67a60345302bc8fc29f Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 01:43:11 -0500
Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
Don't even get me started
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index a92b89d7c..4b6bb38ae 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -773,10 +773,16 @@ public abstract class EntityLiving extends Entity {
}
public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) {
+ // Paper start - Forward
+ heal(f, regainReason, false);
+ }
+
+ public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason, boolean isFastRegen) {
+ // Paper end
float f1 = this.getHealth();
if (f1 > 0.0F) {
- EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper - Add isFastRegen
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index d42db9b45..c715138ee 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -65,7 +65,7 @@ public class FoodMetaData {
if (this.foodTickTimer >= 10) {
float f = Math.min(this.saturationLevel, 6.0F);
- entityhuman.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
+ entityhuman.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED, true); // CraftBukkit - added RegainReason // Paper - This is fast regen
this.a(f);
this.foodTickTimer = 0;
}
--
2.18.0

Datei anzeigen

@ -1,11 +1,11 @@
From 12df16929d8bd8779a79431e03c8246128398d59 Mon Sep 17 00:00:00 2001 From 72b6d02ca1dc326e89a88ea9fbd0333e3df1f20e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 13 May 2016 01:38:06 -0400 Date: Fri, 13 May 2016 01:38:06 -0400
Subject: [PATCH] Optimize EAR Subject: [PATCH] Optimize EAR
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 3265a6c25..47865c027 100644 index 1aade75f3..a9b84fdec 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java --- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -2,6 +2,8 @@ package org.spigotmc; @@ -2,6 +2,8 @@ package org.spigotmc;
@ -26,13 +26,14 @@ index 3265a6c25..47865c027 100644
import net.minecraft.server.EntityFireball; import net.minecraft.server.EntityFireball;
import net.minecraft.server.EntityFireworks; import net.minecraft.server.EntityFireworks;
import net.minecraft.server.EntityHuman; import net.minecraft.server.EntityHuman;
@@ -21,16 +23,15 @@ import net.minecraft.server.EntityLiving; @@ -21,17 +23,16 @@ import net.minecraft.server.EntityLiving;
import net.minecraft.server.EntityMonster; import net.minecraft.server.EntityMonster;
import net.minecraft.server.EntityProjectile; import net.minecraft.server.EntityProjectile;
import net.minecraft.server.EntitySheep; import net.minecraft.server.EntitySheep;
-import net.minecraft.server.EntitySlice; -import net.minecraft.server.EntitySlice;
import net.minecraft.server.EntitySlime; import net.minecraft.server.EntitySlime;
import net.minecraft.server.EntityTNTPrimed; import net.minecraft.server.EntityTNTPrimed;
import net.minecraft.server.EntityThrownTrident;
import net.minecraft.server.EntityVillager; import net.minecraft.server.EntityVillager;
import net.minecraft.server.EntityWeather; import net.minecraft.server.EntityWeather;
import net.minecraft.server.EntityWither; import net.minecraft.server.EntityWither;
@ -44,7 +45,7 @@ index 3265a6c25..47865c027 100644
public class ActivationRange public class ActivationRange
{ {
@@ -108,6 +109,7 @@ public class ActivationRange @@ -110,6 +111,7 @@ public class ActivationRange
maxRange = Math.max( maxRange, miscActivationRange ); maxRange = Math.max( maxRange, miscActivationRange );
maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange ); maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );
@ -52,7 +53,7 @@ index 3265a6c25..47865c027 100644
for ( EntityHuman player : world.players ) for ( EntityHuman player : world.players )
{ {
@@ -126,9 +128,9 @@ public class ActivationRange @@ -128,9 +130,9 @@ public class ActivationRange
{ {
for ( int j1 = k; j1 <= l; ++j1 ) for ( int j1 = k; j1 <= l; ++j1 )
{ {
@ -65,5 +66,5 @@ index 3265a6c25..47865c027 100644
} }
} }
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,4 +1,4 @@
From 98047b4440fafc8e21ca5562b707725067676c80 Mon Sep 17 00:00:00 2001 From 554c388f9f637afab8f6c877cf81c456037d505a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 16 May 2016 20:47:41 -0400 Date: Mon, 16 May 2016 20:47:41 -0400
Subject: [PATCH] Optimize UserCache / Thread Safe Subject: [PATCH] Optimize UserCache / Thread Safe
@ -10,20 +10,20 @@ Additionally, move Saving of the User cache to be done async, incase
the user never changed the default setting for Spigot's save on stop only. the user never changed the default setting for Spigot's save on stop only.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 45d3dbde2..ab7933079 100644 index e11289217..49b2c27c6 100644
--- 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
@@ -528,7 +528,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -631,7 +631,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
// Spigot start // Spigot start
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
LOGGER.info("Saving usercache.json"); LOGGER.info("Saving usercache.json");
- this.Y.c(); - this.getUserCache().c();
+ this.Y.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 487fc11f1..4fb17a801 100644 index 0e168ad34..f8b7d695c 100644
--- a/src/main/java/net/minecraft/server/UserCache.java --- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -109,7 +109,7 @@ public class UserCache { @@ -109,7 +109,7 @@ public class UserCache {
@ -35,8 +35,8 @@ index 487fc11f1..4fb17a801 100644
UUID uuid = gameprofile.getId(); UUID uuid = gameprofile.getId();
if (date == null) { if (date == null) {
@@ -123,8 +123,9 @@ public class UserCache { @@ -122,8 +122,9 @@ public class UserCache {
String s = gameprofile.getName().toLowerCase(Locale.ROOT);
UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date, null); UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date, null);
- if (this.e.containsKey(uuid)) { - if (this.e.containsKey(uuid)) {
@ -46,7 +46,7 @@ index 487fc11f1..4fb17a801 100644
this.d.remove(usercache_usercacheentry1.a().getName().toLowerCase(Locale.ROOT)); this.d.remove(usercache_usercacheentry1.a().getName().toLowerCase(Locale.ROOT));
this.f.remove(gameprofile); this.f.remove(gameprofile);
@@ -137,7 +138,7 @@ public class UserCache { @@ -136,7 +137,7 @@ public class UserCache {
} }
@Nullable @Nullable
@ -55,17 +55,10 @@ index 487fc11f1..4fb17a801 100644
String s1 = s.toLowerCase(Locale.ROOT); String s1 = s.toLowerCase(Locale.ROOT);
UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(s1); UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(s1);
@@ -166,14 +167,15 @@ public class UserCache { @@ -165,8 +166,9 @@ public class UserCache {
return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); return usercache_usercacheentry == null ? null : usercache_usercacheentry.a();
} }
- public String[] a() {
+ public synchronized String[] a() { // Paper - synchronize
ArrayList arraylist = Lists.newArrayList(this.d.keySet());
return (String[]) arraylist.toArray(new String[arraylist.size()]);
}
+ @Nullable public GameProfile getProfile(UUID uuid) { return a(uuid); } // Paper - OBFHELPER + @Nullable public GameProfile getProfile(UUID uuid) { return a(uuid); } // Paper - OBFHELPER
@Nullable @Nullable
- public GameProfile a(UUID uuid) { - public GameProfile a(UUID uuid) {
@ -73,7 +66,7 @@ index 487fc11f1..4fb17a801 100644
UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.e.get(uuid); UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.e.get(uuid);
return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); return usercache_usercacheentry == null ? null : usercache_usercacheentry.a();
@@ -228,8 +230,15 @@ public class UserCache { @@ -221,8 +223,15 @@ public class UserCache {
} }
@ -89,7 +82,7 @@ index 487fc11f1..4fb17a801 100644
BufferedWriter bufferedwriter = null; BufferedWriter bufferedwriter = null;
try { try {
@@ -243,6 +252,14 @@ public class UserCache { @@ -236,6 +245,14 @@ public class UserCache {
} finally { } finally {
IOUtils.closeQuietly(bufferedwriter); IOUtils.closeQuietly(bufferedwriter);
} }
@ -105,5 +98,5 @@ index 487fc11f1..4fb17a801 100644
} }
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,4 +1,4 @@
From db6311ce32e96a9747aeb851cde530df2d5c21a4 Mon Sep 17 00:00:00 2001 From d942862dba8093d6d712a08f72e134d53ced4e58 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 16 May 2016 23:19:16 -0400 Date: Mon, 16 May 2016 23:19:16 -0400
Subject: [PATCH] Avoid blocking on Network Manager creation Subject: [PATCH] Avoid blocking on Network Manager creation
@ -6,42 +6,41 @@ Subject: [PATCH] Avoid blocking on Network Manager creation
Per Paper issue 294 Per Paper issue 294
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java
index 567edb300..4a629aaa1 100644 index be8d07f41..ad49673c1 100644
--- a/src/main/java/net/minecraft/server/ServerConnection.java --- a/src/main/java/net/minecraft/server/ServerConnection.java
+++ b/src/main/java/net/minecraft/server/ServerConnection.java +++ b/src/main/java/net/minecraft/server/ServerConnection.java
@@ -60,6 +60,15 @@ public class ServerConnection { @@ -40,6 +40,15 @@ public class ServerConnection {
public volatile boolean d; public volatile boolean c;
private final List<ChannelFuture> g = Collections.synchronizedList(Lists.newArrayList()); private final List<ChannelFuture> f = Collections.synchronizedList(Lists.newArrayList());
private final List<NetworkManager> h = Collections.synchronizedList(Lists.newArrayList()); private final List<NetworkManager> g = Collections.synchronizedList(Lists.newArrayList());
+ // Paper start - prevent blocking on adding a new network manager while the server is ticking + // Paper start - prevent blocking on adding a new network manager while the server is ticking
+ private final List<NetworkManager> pending = Collections.synchronizedList(Lists.<NetworkManager>newArrayList()); + private final List<NetworkManager> pending = Collections.synchronizedList(Lists.<NetworkManager>newArrayList());
+ private void addPending() { + private void addPending() {
+ synchronized (pending) { + synchronized (pending) {
+ this.h.addAll(pending); // Paper - OBFHELPER - List of network managers + this.g.addAll(pending); // Paper - OBFHELPER - List of network managers
+ pending.clear(); + pending.clear();
+ } + }
+ } + }
+ // Paper end + // Paper end
public ServerConnection(MinecraftServer minecraftserver) { public ServerConnection(MinecraftServer minecraftserver) {
this.f = minecraftserver; this.e = minecraftserver;
@@ -94,7 +103,7 @@ public class ServerConnection { @@ -75,6 +84,7 @@ public class ServerConnection {
channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND));
NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND);
- ServerConnection.this.h.add(networkmanager); ServerConnection.this.g.add(networkmanager);
+ pending.add(networkmanager); // Paper + pending.add(networkmanager); // Paper
channel.pipeline().addLast("packet_handler", networkmanager); channel.pipeline().addLast("packet_handler", networkmanager);
networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.f, networkmanager)); networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.e, networkmanager));
} }
@@ -123,6 +132,7 @@ public class ServerConnection { @@ -103,6 +113,7 @@ public class ServerConnection {
synchronized (this.h) { synchronized (this.g) {
// Spigot Start // Spigot Start
+ addPending(); // Paper + addPending(); // Paper
// This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order
if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 ) if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 )
{ {
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,11 +1,11 @@
From d45df5fa649ad40f1cb1057bc29f5f23aed74c96 Mon Sep 17 00:00:00 2001 From f1d0ebbcfd08ddec06753cc6fc2d008f2c8c57ca Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 22 May 2016 20:20:55 -0500 Date: Sun, 22 May 2016 20:20:55 -0500
Subject: [PATCH] Optional TNT doesn't move in water Subject: [PATCH] Optional TNT doesn't move in water
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 067cb233e..06acdaaf0 100644 index 38de48ebc..321da3be3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -2,7 +2,6 @@ package com.destroystokyo.paper; @@ -2,7 +2,6 @@ package com.destroystokyo.paper;
@ -16,7 +16,7 @@ index 067cb233e..06acdaaf0 100644
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig; import org.spigotmc.SpigotWorldConfig;
@@ -325,4 +324,14 @@ public class PaperWorldConfig { @@ -275,4 +274,14 @@ public class PaperWorldConfig {
); );
} }
} }
@ -32,25 +32,26 @@ index 067cb233e..06acdaaf0 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index c105dd9b0..334441ed7 100644 index 509254b35..1aa4519a6 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1114,6 +1114,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -1182,6 +1182,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
} }
public boolean aq() { public boolean aq() {
+ // Paper start
+ return this.doWaterMovement(); + return this.doWaterMovement();
+ } + }
+ +
+ public boolean doWaterMovement() { + public boolean doWaterMovement() {
+ // Paper end + // Paper end
if (this.bJ() instanceof EntityBoat) { return this.isInWater() || this.q();
this.inWater = false;
} else if (this.world.a(this.getBoundingBox().grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D), Material.WATER, this)) {
@@ -2587,6 +2592,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
} }
public boolean bo() { @@ -2724,6 +2730,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public boolean bw() {
+ return this.pushedByWater(); + return this.pushedByWater();
+ } + }
+ +
@ -60,7 +61,7 @@ index c105dd9b0..334441ed7 100644
} }
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index bb0904f86..50811852a 100644 index 87f3205f8..8c1d25979 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -147,4 +147,49 @@ public class EntityTNTPrimed extends Entity { @@ -147,4 +147,49 @@ public class EntityTNTPrimed extends Entity {
@ -114,5 +115,5 @@ index bb0904f86..50811852a 100644
+ // Paper end + // Paper end
} }
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,4 +1,4 @@
From 892b93e90757a501afa2715e83dcc8ecdd626cd5 Mon Sep 17 00:00:00 2001 From fd74417cf92dd20fe65e116cef1b7ba61ad81f6c Mon Sep 17 00:00:00 2001
From: Martin Panzer <postremus1996@googlemail.com> From: Martin Panzer <postremus1996@googlemail.com>
Date: Mon, 23 May 2016 12:12:37 +0200 Date: Mon, 23 May 2016 12:12:37 +0200
Subject: [PATCH] Faster redstone torch rapid clock removal Subject: [PATCH] Faster redstone torch rapid clock removal
@ -6,12 +6,12 @@ Subject: [PATCH] Faster redstone torch rapid clock removal
Only resize the the redstone torch list once, since resizing arrays / lists is costly Only resize the the redstone torch list once, since resizing arrays / lists is costly
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
index 5b0028a78..429f26ed5 100644 index 6a54da4d6..ebd47196b 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -94,9 +94,17 @@ public class BlockRedstoneTorch extends BlockTorch { @@ -63,9 +63,17 @@ public class BlockRedstoneTorch extends BlockTorch {
boolean flag = this.g(world, blockposition, iblockdata); public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random, boolean flag) {
List list = (List) BlockRedstoneTorch.g.get(world); List list = (List) BlockRedstoneTorch.b.get(world);
- while (list != null && !list.isEmpty() && world.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);
@ -29,15 +29,15 @@ index 5b0028a78..429f26ed5 100644
// CraftBukkit start // CraftBukkit start
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
@@ -179,7 +187,7 @@ public class BlockRedstoneTorch extends BlockTorch { @@ -169,7 +177,7 @@ public class BlockRedstoneTorch extends BlockTorch {
static class RedstoneUpdateInfo { public static class RedstoneUpdateInfo {
BlockPosition a; private final BlockPosition a;
- long b; - private final long b;
+ long b; final long getTime() { return this.b; } // Paper - OBFHELPER + private final long b; final long getTime() { return this.b; } // Paper - OBFHELPER
public RedstoneUpdateInfo(BlockPosition blockposition, long i) { public RedstoneUpdateInfo(BlockPosition blockposition, long i) {
this.a = blockposition; this.a = blockposition;
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,4 +1,4 @@
From 5cdfaa0f565fc0d8893a906291c4501a2a8149a6 Mon Sep 17 00:00:00 2001 From 3f8a86086738570a1913027002282e9644e5a40c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 27 May 2016 21:41:26 -0400 Date: Fri, 27 May 2016 21:41:26 -0400
Subject: [PATCH] Ensure Chunks never ever load async Subject: [PATCH] Ensure Chunks never ever load async
@ -27,20 +27,18 @@ index 7b7a3d01b..9aaca21a7 100644
public static void queueChunkLoad(World world, ChunkRegionLoader loader, ChunkProviderServer provider, int x, int z, Runnable runnable) { public static void queueChunkLoad(World world, ChunkRegionLoader loader, ChunkProviderServer provider, int x, int z, Runnable runnable) {
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
index b5efb9c3f..ef9529add 100644 index 52a8c48fa..a4fcdbe04 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
@@ -35,8 +35,8 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu @@ -35,7 +35,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
// sync stuff // sync stuff
public void callStage2(QueuedChunk queuedChunk, Chunk chunk) throws RuntimeException { public void callStage2(QueuedChunk queuedChunk, Chunk chunk) throws RuntimeException {
- if (chunk == null) { - if (chunk == null) {
- // If the chunk loading failed just do it synchronously (may generate)
+ if (chunk == null || queuedChunk.provider.chunks.containsKey(ChunkCoordIntPair.a(queuedChunk.x, queuedChunk.z))) { // Paper - also call original if it was already loaded + if (chunk == null || queuedChunk.provider.chunks.containsKey(ChunkCoordIntPair.a(queuedChunk.x, queuedChunk.z))) { // Paper - also call original if it was already loaded
+ // If the chunk loading failed (or was already loaded for some reason) just do it synchronously (may generate) // If the chunk loading failed just do it synchronously (may generate)
queuedChunk.provider.originalGetChunkAt(queuedChunk.x, queuedChunk.z); // queuedChunk.provider.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
return; return;
}
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,11 +1,11 @@
From 71c1c688661b7c21b77d689b8550105d570f49ba Mon Sep 17 00:00:00 2001 From c5c43856ddc210fc3dea226e2790e609a3ad4f94 Mon Sep 17 00:00:00 2001
From: Martin Panzer <postremus1996@googlemail.com> From: Martin Panzer <postremus1996@googlemail.com>
Date: Sat, 28 May 2016 16:54:03 +0200 Date: Sat, 28 May 2016 16:54:03 +0200
Subject: [PATCH] Add server-name parameter Subject: [PATCH] Add server-name parameter
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index f95da9e26..d565a720f 100644 index d9059129d..aad208f47 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -134,6 +134,14 @@ public class Main { @@ -134,6 +134,14 @@ public class Main {
@ -24,5 +24,5 @@ index f95da9e26..d565a720f 100644
}; };
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,4 +1,4 @@
From 123b1e86e327f1cd628aaa8e9110b27b2147b3a5 Mon Sep 17 00:00:00 2001 From 0d6099080531c44b5b9c4c310bf9a18c2da8b4c6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 31 May 2016 22:53:50 -0400 Date: Tue, 31 May 2016 22:53:50 -0400
Subject: [PATCH] Only send Dragon/Wither Death sounds to same world Subject: [PATCH] Only send Dragon/Wither Death sounds to same world
@ -6,11 +6,11 @@ Subject: [PATCH] Only send Dragon/Wither Death sounds to same world
Also fix view distance lookup Also fix view distance lookup
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 0f94d2f0a..a8cc6b61a 100644 index 24cce6c03..e5f064577 100644
--- 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
@@ -573,8 +573,12 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo @@ -573,8 +573,12 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
if (this.bH == 1) { if (this.bO == 1) {
// CraftBukkit start - Use relative location for far away sounds // CraftBukkit start - Use relative location for far away sounds
// this.world.a(1028, new BlockPosition(this), 0); // this.world.a(1028, new BlockPosition(this), 0);
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; - int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
@ -25,10 +25,10 @@ index 0f94d2f0a..a8cc6b61a 100644
double deltaZ = this.locZ - player.locZ; double deltaZ = this.locZ - player.locZ;
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index 97cf75b9f..967852605 100644 index e9d9ec239..28f524468 100644
--- 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
@@ -210,8 +210,12 @@ public class EntityWither extends EntityMonster implements IRangedEntity { @@ -199,8 +199,12 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
// CraftBukkit start - Use relative location for far away sounds // CraftBukkit start - Use relative location for far away sounds
// this.world.a(1023, new BlockPosition(this), 0); // this.world.a(1023, new BlockPosition(this), 0);
@ -44,5 +44,5 @@ index 97cf75b9f..967852605 100644
double deltaZ = this.locZ - player.locZ; double deltaZ = this.locZ - player.locZ;
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
-- --
2.18.0 2.17.1

Datei anzeigen

@ -1,105 +0,0 @@
From f9b319d2f07b629d7f0ffc68dc21d8226366fb58 Mon Sep 17 00:00:00 2001
From: Martin Panzer <postremus1996@googlemail.com>
Date: Fri, 3 Jun 2016 23:13:39 +0200
Subject: [PATCH] Fix FallingBlocks being stuck on fences
Fallingblocks would previously only check if directly beneath them a block exists. They also
hover on top of the 1.5 block tall hitbox of fences during these check. This
resulted in them always thinking they would be on air.
We now first check, if if we are already on the ground.
if not, we check if the falling block is inside of the hitbox of the block at y - 1.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 06acdaaf0..600e603bd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -334,4 +334,9 @@ public class PaperWorldConfig {
preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
}
+
+ public boolean altFallingBlockOnGround;
+ private void altFallingBlockOnGround() {
+ altFallingBlockOnGround = getBoolean("use-alternate-fallingblock-onGround-detection", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
index 674395756..1086e3117 100644
--- a/src/main/java/net/minecraft/server/BlockFalling.java
+++ b/src/main/java/net/minecraft/server/BlockFalling.java
@@ -71,6 +71,12 @@ public class BlockFalling extends Block {
return block == Blocks.FIRE || material == Material.AIR || material == Material.WATER || material == Material.LAVA;
}
+ // Paper start - OBFHELPER
+ public static boolean canMoveThrough(IBlockData blockdata) {
+ return BlockFalling.x(blockdata);
+ }
+ // Paper end
+
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
public void a_(World world, BlockPosition blockposition) {}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index abdc2dea9..59acc9088 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -3,6 +3,7 @@ package net.minecraft.server;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import javax.annotation.Nullable;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
@@ -120,10 +121,10 @@ public class EntityFallingBlock extends Entity {
}
} else {
IBlockData iblockdata = this.world.getType(blockposition);
-
- if (!flag1 && BlockFalling.x(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) {
+
+ if (!isOnGround()) {
this.onGround = false;
- // return; // CraftBukkit
+ if (this.world.paperConfig.altFallingBlockOnGround) return; // Paper
}
this.motX *= 0.699999988079071D;
@@ -179,6 +180,32 @@ public class EntityFallingBlock extends Entity {
}
}
+ // Paper start
+ private boolean isOnGround() {
+ BlockPosition where = new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ);
+ boolean cannotMoveThrough = !BlockFalling.canMoveThrough(this.world.getType(where));
+ if (!this.world.paperConfig.altFallingBlockOnGround) return cannotMoveThrough;
+
+ if (cannotMoveThrough) {
+ return true;
+ }
+
+ IBlockData blockData = this.world.getType(where.down());
+ if (BlockFalling.canMoveThrough(blockData)) {
+ return false;
+ }
+
+ List<AxisAlignedBB> list = new ArrayList<>();
+ addCollisions(blockData, getWorld(), where, this.getBoundingBox(), list, this);
+ return list.size() > 0;
+ }
+
+ // OBFHELPER
+ private void addCollisions(IBlockData blockData, World world, BlockPosition where, AxisAlignedBB collider, List<AxisAlignedBB> list, Entity entity) {
+ blockData.a(world, where, collider, list, entity, false);
+ }
+ // Paper end
+
public void e(float f, float f1) {
Block block = this.block.getBlock();
--
2.18.0

Datei anzeigen

@ -1,383 +0,0 @@
From b882250f89918c9a9e256def49d0d5b92d7e8916 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Sat, 18 Jun 2016 01:01:37 -0500
Subject: [PATCH] Make entities look for hoppers
Every tick hoppers try and find an block-inventory to extract from.
If no tile entity is above the hopper (which there often isn't) it will do a bounding box search for minecart chests and minecart hoppers.
If it can't find an inventory, it will then look for a dropped item, which is another bounding box search.
This patch eliminates that expensive check by having dropped items and minecart hoppers/chests look for hoppers instead.
Hoppers are tile entities meaning you can do a simple tile entity lookup to find the nearest hopper in range.
Pushing out of hoppers causes a bouding box lookup, which this patch replaces with a tile entity lookup.
This patch may causes a decrease in the performance of dropped items, which is why it can be disabled in the configuration.
diff --git a/src/main/java/com/destroystokyo/paper/HopperPusher.java b/src/main/java/com/destroystokyo/paper/HopperPusher.java
new file mode 100644
index 000000000..52457e3d8
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/HopperPusher.java
@@ -0,0 +1,60 @@
+package com.destroystokyo.paper;
+
+import net.minecraft.server.AxisAlignedBB;
+import net.minecraft.server.BlockPosition;
+import net.minecraft.server.MCUtil;
+import net.minecraft.server.TileEntityHopper;
+import net.minecraft.server.World;
+
+public interface HopperPusher {
+
+ default TileEntityHopper findHopper() {
+ BlockPosition pos = new BlockPosition(getX(), getY(), getZ());
+ int startX = pos.getX() - 1;
+ int endX = pos.getX() + 1;
+ int startY = Math.max(0, pos.getY() - 1);
+ int endY = Math.min(255, pos.getY() + 1);
+ int startZ = pos.getZ() - 1;
+ int endZ = pos.getZ() + 1;
+ BlockPosition.PooledBlockPosition adjacentPos = BlockPosition.PooledBlockPosition.aquire();
+ for (int x = startX; x <= endX; x++) {
+ for (int y = startY; y <= endY; y++) {
+ for (int z = startZ; z <= endZ; z++) {
+ adjacentPos.setValues(x, y, z);
+ TileEntityHopper hopper = MCUtil.getHopper(getWorld(), adjacentPos);
+ if (hopper == null) continue; // Avoid playing with the bounding boxes, if at all possible
+ AxisAlignedBB hopperBoundingBox = hopper.getHopperLookupBoundingBox();
+ /*
+ * Check if the entity's bounding box intersects with the hopper's lookup box.
+ * This operation doesn't work both ways!
+ * Make sure you check if the entity's box intersects the hopper's box, not vice versa!
+ */
+ AxisAlignedBB boundingBox = this.getBoundingBox().shrink(0.1); // Imitate vanilla behavior
+ if (boundingBox.intersects(hopperBoundingBox)) {
+ return hopper;
+ }
+ }
+ }
+ }
+ adjacentPos.free();
+ return null;
+ }
+
+ boolean acceptItem(TileEntityHopper hopper);
+
+ default boolean tryPutInHopper() {
+ if (!getWorld().paperConfig.isHopperPushBased) return false;
+ TileEntityHopper hopper = findHopper();
+ return hopper != null && hopper.canAcceptItems() && acceptItem(hopper);
+ }
+
+ AxisAlignedBB getBoundingBox();
+
+ World getWorld();
+
+ double getX();
+
+ double getY();
+
+ double getZ();
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 600e603bd..ce43e7bb7 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -339,4 +339,9 @@ public class PaperWorldConfig {
private void altFallingBlockOnGround() {
altFallingBlockOnGround = getBoolean("use-alternate-fallingblock-onGround-detection", false);
}
+
+ public boolean isHopperPushBased;
+ private void isHopperPushBased() {
+ isHopperPushBased = getBoolean("hopper.push-based", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java
index 1eb9c2da8..c88b76a79 100644
--- a/src/main/java/net/minecraft/server/AxisAlignedBB.java
+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java
@@ -235,6 +235,7 @@ public class AxisAlignedBB {
}
}
+ public final boolean intersects(AxisAlignedBB intersecting) { return this.c(intersecting); } // Paper - OBFHELPER
public boolean c(AxisAlignedBB axisalignedbb) {
return this.a(axisalignedbb.a, axisalignedbb.b, axisalignedbb.c, axisalignedbb.d, axisalignedbb.e, axisalignedbb.f);
}
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 008ed206d..b3c1f550c 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -250,6 +250,7 @@ public class BlockPosition extends BaseBlockPosition {
super(i, j, k);
}
+ public static BlockPosition.PooledBlockPosition aquire() { return s(); } // Paper - OBFHELPER
public static BlockPosition.PooledBlockPosition s() {
return e(0, 0, 0);
}
@@ -276,6 +277,7 @@ public class BlockPosition extends BaseBlockPosition {
return new BlockPosition.PooledBlockPosition(i, j, k);
}
+ public void free() { t(); } // Paper - OBFHELPER
public void t() {
List list = BlockPosition.PooledBlockPosition.g;
@@ -393,6 +395,7 @@ public class BlockPosition extends BaseBlockPosition {
return this.d;
}
+ public void setValues(int x, int y, int z) { c(x, y, z); } // Paper - OBFHELPER
public BlockPosition.MutableBlockPosition c(int i, int j, int k) {
this.b = i;
this.c = j;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index cb9ef622c..c675a6e16 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -80,6 +80,19 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
public double locX;
public double locY;
public double locZ;
+ // Paper start - getters to implement HopperPusher
+ public double getX() {
+ return locX;
+ }
+
+ public double getY() {
+ return locY;
+ }
+
+ public double getZ() {
+ return locZ;
+ }
+ // Paper end
public double motX;
public double motY;
public double motZ;
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 4d3aef96b..6593fc633 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -8,8 +8,15 @@ import org.apache.logging.log4j.Logger;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
// CraftBukkit end
+import com.destroystokyo.paper.HopperPusher; // Paper
-public class EntityItem extends Entity {
+// Paper start - implement HopperPusher
+public class EntityItem extends Entity implements HopperPusher {
+ @Override
+ public boolean acceptItem(TileEntityHopper hopper) {
+ return TileEntityHopper.putDropInInventory(null, hopper, this);
+ }
+// Paper end
private static final Logger b = LogManager.getLogger();
private static final DataWatcherObject<ItemStack> c = DataWatcher.a(EntityItem.class, DataWatcherRegistry.f);
@@ -59,6 +66,7 @@ public class EntityItem extends Entity {
this.die();
} else {
super.B_();
+ if (tryPutInHopper()) return; // Paper
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
@@ -146,6 +154,7 @@ public class EntityItem extends Entity {
// Spigot start - copied from above
@Override
public void inactiveTick() {
+ if (tryPutInHopper()) return; // Paper
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
index 50d7d34b8..15f392d23 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
@@ -7,6 +7,7 @@ import javax.annotation.Nullable;
import java.util.List;
import org.bukkit.Location;
+import com.destroystokyo.paper.HopperPusher; // Paper
import com.destroystokyo.paper.loottable.CraftLootableInventoryData; // Paper
import com.destroystokyo.paper.loottable.CraftLootableInventory; // Paper
import com.destroystokyo.paper.loottable.LootableInventory; // Paper
@@ -15,7 +16,25 @@ import org.bukkit.entity.HumanEntity;
import org.bukkit.inventory.InventoryHolder;
// CraftBukkit end
-public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements ITileInventory, ILootable, CraftLootableInventory { // Paper
+// Paper start - push into hoppers
+public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements ITileInventory, ILootable, CraftLootableInventory, HopperPusher { // Paper - CraftLootableInventory
+ @Override
+ public boolean acceptItem(TileEntityHopper hopper) {
+ return TileEntityHopper.acceptItem(hopper, this);
+ }
+
+ @Override
+ public void B_() {
+ super.B_();
+ tryPutInHopper();
+ }
+
+ @Override
+ public void inactiveTick() {
+ super.inactiveTick();
+ tryPutInHopper();
+ }
+ // Paper end
private NonNullList<ItemStack> items;
private boolean b;
diff --git a/src/main/java/net/minecraft/server/IHopper.java b/src/main/java/net/minecraft/server/IHopper.java
index 804215a1c..e830d8390 100644
--- a/src/main/java/net/minecraft/server/IHopper.java
+++ b/src/main/java/net/minecraft/server/IHopper.java
@@ -4,9 +4,9 @@ public interface IHopper extends IInventory {
World getWorld();
- double E();
+ double E(); default double getX() { return E(); } // Paper - OBFHELPER
- double F();
+ double F(); default double getY() { return F(); } // Paper - OBFHELPER
- double G();
+ double G(); default double getZ() { return G(); } // Paper - OBFHELPER
}
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
index 985513511..e9315f2d5 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -126,6 +126,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
}
private boolean o() {
+ mayAcceptItems = false; // Paper - at the beginning of a tick, assume we can't accept items
if (this.world != null && !this.world.isClientSide) {
if (!this.J() && BlockHopper.f(this.v())) {
boolean flag = false;
@@ -135,6 +136,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
}
if (!this.r()) {
+ mayAcceptItems = true; // Paper - flag this hopper to be able to accept items
flag = a((IHopper) this) || flag;
}
@@ -150,6 +152,14 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
}
}
+ // Paper start
+ private boolean mayAcceptItems = false;
+
+ public boolean canAcceptItems() {
+ return mayAcceptItems;
+ }
+ // Paper end
+
private boolean p() {
Iterator iterator = this.items.iterator();
@@ -300,8 +310,15 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
return true;
}
+ // Paper start - split methods, and only do entity lookup if in pull mode
public static boolean a(IHopper ihopper) {
- IInventory iinventory = b(ihopper);
+ IInventory iinventory = getInventory(ihopper, !(ihopper instanceof TileEntityHopper) || !ihopper.getWorld().paperConfig.isHopperPushBased);
+
+ return acceptItem(ihopper, iinventory);
+ }
+
+ public static boolean acceptItem(IHopper ihopper, IInventory iinventory) {
+ // Paper end
if (iinventory != null) {
EnumDirection enumdirection = EnumDirection.DOWN;
@@ -332,8 +349,8 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
}
}
}
- } else {
- Iterator iterator = a(ihopper.getWorld(), ihopper.E(), ihopper.F(), ihopper.G()).iterator();
+ } else if (!ihopper.getWorld().paperConfig.isHopperPushBased || !(ihopper instanceof TileEntityHopper)) { // Paper - only search for entities in 'pull mode'
+ Iterator iterator = a(ihopper.getWorld(), ihopper.E(), ihopper.F(), ihopper.G()).iterator(); // Change getHopperLookupBoundingBox() if this ever changes
while (iterator.hasNext()) {
EntityItem entityitem = (EntityItem) iterator.next();
@@ -397,6 +414,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
return false;
}
+ public static boolean putDropInInventory(IInventory iinventory, IInventory iinventory1, EntityItem entityitem) { return a(iinventory, iinventory1, entityitem); } // Paper - OBFHELPER
public static boolean a(IInventory iinventory, IInventory iinventory1, EntityItem entityitem) {
boolean flag = false;
@@ -500,18 +518,44 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
private IInventory I() {
EnumDirection enumdirection = BlockHopper.b(this.v());
- return b(this.getWorld(), this.E() + (double) enumdirection.getAdjacentX(), this.F() + (double) enumdirection.getAdjacentY(), this.G() + (double) enumdirection.getAdjacentZ());
+ // Paper start - don't search for entities in push mode
+ World world = getWorld();
+ return getInventory(world, this.E() + (double) enumdirection.getAdjacentX(), this.F() + (double) enumdirection.getAdjacentY(), this.G() + (double) enumdirection.getAdjacentZ(), !world.paperConfig.isHopperPushBased);
+ // Paper end
}
- public static IInventory b(IHopper ihopper) {
- return b(ihopper.getWorld(), ihopper.E(), ihopper.F() + 1.0D, ihopper.G());
+ // Paper start - add option to search for entities
+ public static IInventory b(IHopper hopper) {
+ return getInventory(hopper, true);
+ }
+
+ public static IInventory getInventory(IHopper ihopper, boolean searchForEntities) {
+ return getInventory(ihopper.getWorld(), ihopper.E(), ihopper.F() + 1.0D, ihopper.G(), searchForEntities);
+ // Paper end
}
public static List<EntityItem> a(World world, double d0, double d1, double d2) {
- return world.a(EntityItem.class, new AxisAlignedBB(d0 - 0.5D, d1, d2 - 0.5D, d0 + 0.5D, d1 + 1.5D, d2 + 0.5D), IEntitySelector.a);
+ return world.a(EntityItem.class, new AxisAlignedBB(d0 - 0.5D, d1, d2 - 0.5D, d0 + 0.5D, d1 + 1.5D, d2 + 0.5D), IEntitySelector.a); // Change getHopperLookupBoundingBox(double, double, double) if the bounding box calculation is ever changed
+ }
+
+ // Paper start
+ public AxisAlignedBB getHopperLookupBoundingBox() {
+ return getHopperLookupBoundingBox(this.getX(), this.getY(), this.getZ());
}
+ private static AxisAlignedBB getHopperLookupBoundingBox(double d0, double d1, double d2) {
+ // Change this if a(World, double, double, double) above ever changes
+ return new AxisAlignedBB(d0 - 0.5D, d1, d2 - 0.5D, d0 + 0.5D, d1 + 1.5D, d2 + 0.5D);
+ }
+ // Paper end
+
+ // Paper start - add option to searchForEntities
public static IInventory b(World world, double d0, double d1, double d2) {
+ return getInventory(world, d0, d1, d2, true);
+ }
+
+ public static IInventory getInventory(World world, double d0, double d1, double d2, boolean searchForEntities) {
+ // Paper end
Object object = null;
int i = MathHelper.floor(d0);
int j = MathHelper.floor(d1);
@@ -531,7 +575,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
}
}
- if (object == null) {
+ if (object == null && searchForEntities) { // Paper - only if searchForEntities
List list = world.getEntities((Entity) null, new AxisAlignedBB(d0 - 0.5D, d1 - 0.5D, d2 - 0.5D, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D), IEntitySelector.c);
if (!list.isEmpty()) {
--
2.18.0

Datei anzeigen

@ -1,45 +0,0 @@
From 516394ea692192adfd455d9671c2bc9427e9c4c0 Mon Sep 17 00:00:00 2001
From: Jadon Fowler <jadonflower@gmail.com>
Date: Sat, 18 Jun 2016 23:13:59 -0700
Subject: [PATCH] Toggleable Elytra Wall Damage
Instead of calculating the damage taken from hitting a wall, you can
disable it in the config.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e35e72e8b..1b9eb7f45 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -358,4 +358,9 @@ public class PaperWorldConfig {
private void skipEntityTickingInChunksScheduledForUnload() {
skipEntityTickingInChunksScheduledForUnload = getBoolean("skip-entity-ticking-in-chunks-scheduled-for-unload", skipEntityTickingInChunksScheduledForUnload);
}
+
+ public boolean elytraHitWallDamage = true;
+ private void elytraHitWallDamage() {
+ elytraHitWallDamage = getBoolean("elytra-hit-wall-damage", true);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 4b6bb38ae..dda6219a7 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1739,6 +1739,7 @@ public abstract class EntityLiving extends Entity {
this.motY = 0.30000001192092896D;
}
} else if (this.cP()) {
+ if (world.paperConfig.elytraHitWallDamage) { // Paper start - Toggleable Elytra Wall Damage
if (this.motY > -0.5D) {
this.fallDistance = 1.0F;
}
@@ -1788,6 +1789,7 @@ public abstract class EntityLiving extends Entity {
this.damageEntity(DamageSource.FLY_INTO_WALL, f8);
}
}
+ } // Paper end - Elyta Wall Damage if statement
if (this.onGround && !this.world.isClientSide) {
if (getFlag(7) && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit
--
2.18.0

@ -1 +1 @@
Subproject commit 55a3379d9bcd38efb5c4f4d0db8bcee39db853df Subproject commit 1d21dc022e7e6905ef64f54b165e7559dfa40ade

@ -1 +1 @@
Subproject commit 8fbc72b714a5051c6df8f05ac97528d747f1bdeb Subproject commit 1fccb8950186caae273e45f1b08ebe2797214293

@ -1 +1 @@
Subproject commit 6505f06b355d5f1ea0fff2d0e8edbd60b2f75354 Subproject commit 1d0aef704b8cca70ab2c71dbabad4a09b91287e3