More patches for 1.14

This commit is contained in:
William Blake Galbreath 2019-05-05 03:33:44 -05:00
parent eb25d664df
commit 997e1c2ad3
40 changed files with 698 additions and 707 deletions

View File

@ -1,4 +1,4 @@
From 7f9d6eaeea4c3a7fd2d75d413016e01b7b2d30d8 Mon Sep 17 00:00:00 2001
From 83261d909e36f226f2043582f2bcadd3e89dd068 Mon Sep 17 00:00:00 2001
From: miclebrick <miclebrick@outlook.com>
Date: Thu, 23 Aug 2018 11:45:32 -0400
Subject: [PATCH] Optimize CraftBlockData Creation
@ -7,21 +7,25 @@ Avoids a hashmap lookup by cacheing a reference to the CraftBlockData
and cloning it when one is needed.
diff --git a/src/main/java/net/minecraft/server/BlockData.java b/src/main/java/net/minecraft/server/BlockData.java
index 4dd6c32761..1b226a77e0 100644
--- a/src/main/java/net/minecraft/server/BlockData.java
new file mode 100644
index 000000000..1b226a77e
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockData.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import com.google.common.collect.ImmutableMap;
@@ -0,0 +1,25 @@
+package net.minecraft.server;
+
+import com.google.common.collect.ImmutableMap;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
public class BlockData extends BlockDataAbstract<Block, IBlockData> implements IBlockData {
@@ -11,4 +12,14 @@ public class BlockData extends BlockDataAbstract<Block, IBlockData> implements I
public Block getBlock() {
return (Block) this.e_;
}
+
+public class BlockData extends BlockDataAbstract<Block, IBlockData> implements IBlockData {
+
+ public BlockData(Block block, ImmutableMap<IBlockState<?>, Comparable<?>> immutablemap) {
+ super(block, immutablemap);
+ }
+
+ public Block getBlock() {
+ return (Block) this.e_;
+ }
+
+ // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
+ private CraftBlockData cachedCraftBlockData;
@ -32,25 +36,42 @@ index 4dd6c32761..1b226a77e0 100644
+ return (CraftBlockData) cachedCraftBlockData.clone();
+ }
+ // Paper end
}
+}
diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java
index e4e4c55130..08a5acb0ac 100644
index e8ae4b5e4..5413fe5b1 100644
--- a/src/main/java/net/minecraft/server/IBlockData.java
+++ b/src/main/java/net/minecraft/server/IBlockData.java
@@ -27,6 +27,8 @@ public interface IBlockData extends IBlockDataHolder<IBlockData> {
Block getBlock();
+ org.bukkit.craftbukkit.block.data.CraftBlockData createCraftBlockData(); // Paper - property for converting IBlockData to CraftBlockData, should only be used by CraftBlockData#fromData and should return a clone
@@ -4,6 +4,8 @@ import com.google.common.collect.ImmutableMap;
import com.mojang.datafixers.Dynamic;
import com.mojang.datafixers.types.DynamicOps;
import com.mojang.datafixers.util.Pair;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
default Material getMaterial() {
return this.getBlock().n(this);
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -38,6 +40,16 @@ public class IBlockData extends BlockDataAbstract<Block, IBlockData> implements
return (Block) this.a;
}
+ // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
+ private CraftBlockData cachedCraftBlockData;
+
+ @Override
+ public CraftBlockData createCraftBlockData() {
+ if(cachedCraftBlockData == null) cachedCraftBlockData = CraftBlockData.createData(this);
+ return (CraftBlockData) cachedCraftBlockData.clone();
+ }
+ // Paper end
+
public Material getMaterial() {
return this.getBlock().l(this);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index 7755e4f7a6..4bb43e360d 100644
index c1666a9ba..3c29abd52 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -521,7 +521,17 @@ public class CraftBlockData implements BlockData {
@@ -539,7 +539,17 @@ public class CraftBlockData implements BlockData {
return craft;
}
@ -69,5 +90,5 @@ index 7755e4f7a6..4bb43e360d 100644
}
}
--
2.21.0
2.20.1

View File

@ -1,14 +1,14 @@
From c31f3e86f6647a66fe4ab95da3ab06921900bd31 Mon Sep 17 00:00:00 2001
From 3d39c0e93184b77724106a9b6911d53179a61ce2 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Thu, 23 Aug 2018 09:25:30 -0500
Subject: [PATCH] Fix MC-124320
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index c674aa13d8..2e460a7f63 100644
index 69e65ea6c..549c50de7 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -154,6 +154,7 @@ public class Block implements IMaterial {
@@ -160,6 +160,7 @@ public class Block implements IMaterial {
return tag.isTagged(this);
}
@ -17,21 +17,21 @@ index c674aa13d8..2e460a7f63 100644
IBlockData iblockdata1 = iblockdata;
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 139a70ca3b..e4aba0e0a8 100644
index a1033ce28..de2d99534 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -305,8 +305,9 @@ public class EntityEnderman extends EntityMonster {
@@ -325,8 +325,9 @@ public class EntityEnderman extends EntityMonster {
if (block.a(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
// CraftBukkit start - Pickup event
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
- this.enderman.setCarried(iblockdata);
+ //this.enderman.setCarried(iblockdata); // Paper - moved down
world.setAir(blockposition);
world.a(blockposition, false);
+ this.enderman.setCarried(Block.getValidBlockForPosition(iblockdata, this.enderman.world, blockposition)); // Paper - Fix MC-124320
}
// CraftBukkit end
}
@@ -316,6 +317,7 @@ public class EntityEnderman extends EntityMonster {
@@ -336,6 +337,7 @@ public class EntityEnderman extends EntityMonster {
static class PathfinderGoalEndermanPlaceBlock extends PathfinderGoal {
@ -39,15 +39,15 @@ index 139a70ca3b..e4aba0e0a8 100644
private final EntityEnderman a;
public PathfinderGoalEndermanPlaceBlock(EntityEnderman entityenderman) {
@@ -335,7 +337,7 @@ public class EntityEnderman extends EntityMonster {
BlockPosition blockposition = new BlockPosition(i, j, k);
@@ -358,7 +360,7 @@ public class EntityEnderman extends EntityMonster {
IBlockData iblockdata = world.getType(blockposition);
IBlockData iblockdata1 = world.getType(blockposition.down());
BlockPosition blockposition1 = blockposition.down();
IBlockData iblockdata1 = world.getType(blockposition1);
- IBlockData iblockdata2 = this.a.getCarried();
+ IBlockData iblockdata2 = Block.getValidBlockForPosition(getEnderman().getCarried(), getEnderman().world, blockposition); // Paper - Fix MC-124320
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1)) {
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
// CraftBukkit start - Place event
--
2.21.0
2.20.1

View File

@ -1,16 +1,16 @@
From fec723b8d5ee06df01c78f30e25beba1b4d7df2d Mon Sep 17 00:00:00 2001
From ed723934e9e628f2d975d03730c391c2e27e3452 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 24 Aug 2018 08:18:42 -0500
Subject: [PATCH] Slime Pathfinder Events
diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java
index f92bf02b87..81966542ee 100644
index 8115b1e4e..d720d0fae 100644
--- a/src/main/java/net/minecraft/server/EntitySlime.java
+++ b/src/main/java/net/minecraft/server/EntitySlime.java
@@ -1,6 +1,14 @@
package net.minecraft.server;
@@ -2,6 +2,14 @@ package net.minecraft.server;
import java.util.EnumSet;
import javax.annotation.Nullable;
+// Paper start
+import com.destroystokyo.paper.event.entity.SlimeChangeDirectionEvent;
@ -23,18 +23,18 @@ index f92bf02b87..81966542ee 100644
// CraftBukkit start
import java.util.ArrayList;
import java.util.List;
@@ -61,6 +69,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
@@ -63,6 +71,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
super.b(nbttagcompound);
nbttagcompound.setInt("Size", this.getSize() - 1);
nbttagcompound.setBoolean("wasOnGround", this.bD);
nbttagcompound.setBoolean("wasOnGround", this.bA);
+ nbttagcompound.setBoolean("Paper.canWander", this.canWander); // Paper
}
public void a(NBTTagCompound nbttagcompound) {
@@ -73,6 +82,11 @@ public class EntitySlime extends EntityInsentient implements IMonster {
@Override
@@ -76,6 +85,11 @@ public class EntitySlime extends EntityInsentient implements IMonster {
this.setSize(i + 1, false);
this.bD = nbttagcompound.getBoolean("wasOnGround");
this.bA = nbttagcompound.getBoolean("wasOnGround");
+ // Paper start - check exists before loading or this will be loaded as false
+ if (nbttagcompound.hasKey("Paper.canWander")) {
+ this.canWander = nbttagcompound.getBoolean("Paper.canWander");
@ -42,33 +42,34 @@ index f92bf02b87..81966542ee 100644
+ // Paper end
}
public boolean dy() {
@@ -323,7 +337,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
}
public boolean ea() {
@@ -344,7 +358,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
@Override
public boolean a() {
- return true;
+ return this.a.canWander && new SlimeWanderEvent((Slime) this.a.getBukkitEntity()).callEvent(); // Paper
- return !this.a.isPassenger();
+ return !this.a.isPassenger() && this.a.canWander && new SlimeWanderEvent((Slime) this.a.getBukkitEntity()).callEvent(); // Paper
}
public void e() {
@@ -342,7 +356,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
}
@Override
@@ -365,7 +379,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
@Override
public boolean a() {
- return this.a.isInWater() || this.a.ax();
+ return (this.a.isInWater() || this.a.ax()) && this.a.canWander && new SlimeSwimEvent((Slime) this.a.getBukkitEntity()).callEvent(); // Paper
- return (this.a.isInWater() || this.a.aC()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime;
+ return (this.a.isInWater() || this.a.aC()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime && this.a.canWander && new SlimeSwimEvent((Slime) this.a.getBukkitEntity()).callEvent(); // Paper
}
public void e() {
@@ -366,13 +380,17 @@ public class EntitySlime extends EntityInsentient implements IMonster {
}
@Override
@@ -391,14 +405,18 @@ public class EntitySlime extends EntityInsentient implements IMonster {
@Override
public boolean a() {
- return this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.ax() || this.a.hasEffect(MobEffects.LEVITATION));
+ return this.a.canWander && this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.ax() || this.a.hasEffect(MobEffects.LEVITATION)); // Paper
- return this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aC() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime;
+ return this.a.canWander && this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aC() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; // Paper
}
@Override
public void e() {
if (--this.c <= 0) {
this.c = 40 + this.a.getRandom().nextInt(60);
@ -81,11 +82,11 @@ index f92bf02b87..81966542ee 100644
}
((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.b, false);
@@ -392,7 +410,15 @@ public class EntitySlime extends EntityInsentient implements IMonster {
@@ -419,7 +437,15 @@ public class EntitySlime extends EntityInsentient implements IMonster {
public boolean a() {
EntityLiving entityliving = this.a.getGoalTarget();
- return entityliving == null ? false : (!entityliving.isAlive() ? false : !(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.isInvulnerable);
- return entityliving == null ? false : (!entityliving.isAlive() ? false : (entityliving instanceof EntityHuman && ((EntityHuman) entityliving).abilities.isInvulnerable ? false : this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime));
+ // Paper start
+ if (entityliving == null || !entityliving.isAlive()) {
+ return false;
@ -93,12 +94,12 @@ index f92bf02b87..81966542ee 100644
+ if (entityliving instanceof EntityHuman && ((EntityHuman) entityliving).abilities.isInvulnerable) {
+ return false;
+ }
+ return this.a.canWander && new SlimeTargetLivingEntityEvent((Slime) this.a.getBukkitEntity(), (LivingEntity) entityliving.getBukkitEntity()).callEvent();
+ return this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime && this.a.canWander && new SlimeTargetLivingEntityEvent((Slime) this.a.getBukkitEntity(), (LivingEntity) entityliving.getBukkitEntity()).callEvent();
+ // Paper end
}
public void c() {
@@ -403,13 +429,28 @@ public class EntitySlime extends EntityInsentient implements IMonster {
@Override
@@ -432,7 +458,15 @@ public class EntitySlime extends EntityInsentient implements IMonster {
public boolean b() {
EntityLiving entityliving = this.a.getGoalTarget();
@ -114,9 +115,10 @@ index f92bf02b87..81966542ee 100644
+ // Paper end
}
public void e() {
@Override
@@ -440,6 +474,13 @@ public class EntitySlime extends EntityInsentient implements IMonster {
this.a.a((Entity) this.a.getGoalTarget(), 10.0F, 10.0F);
((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.a.yaw, this.a.dt());
((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.a.yaw, this.a.dV());
}
+
+ // Paper start - clear timer and target when goal resets
@ -128,7 +130,7 @@ index f92bf02b87..81966542ee 100644
}
static class ControllerMoveSlime extends ControllerMove {
@@ -467,4 +508,15 @@ public class EntitySlime extends EntityInsentient implements IMonster {
@@ -498,4 +539,15 @@ public class EntitySlime extends EntityInsentient implements IMonster {
}
}
}
@ -145,10 +147,10 @@ index f92bf02b87..81966542ee 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java
index 18e7ef80ac..8403c1e01c 100644
index 00fbef360..6c11a5f8a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java
@@ -33,4 +33,14 @@ public class CraftSlime extends CraftMob implements Slime {
@@ -32,4 +32,14 @@ public class CraftSlime extends CraftMob implements Slime {
public EntityType getType() {
return EntityType.SLIME;
}
@ -164,5 +166,5 @@ index 18e7ef80ac..8403c1e01c 100644
+ // Paper end
}
--
2.21.0
2.20.1

View File

@ -1,14 +1,14 @@
From 4fef830e9621867bc3af8bac7fa822e12adfed59 Mon Sep 17 00:00:00 2001
From d7b2ad128b02dce9fcda0b35a8a76f01e2bc0614 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 8 Aug 2018 16:33:21 -0600
Subject: [PATCH] Configurable speed for water flowing over lava
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 8f49262226..869bf8a9f9 100644
index 2b5402b00..2c27be63e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -481,6 +481,12 @@ public class PaperWorldConfig {
@@ -401,6 +401,12 @@ public class PaperWorldConfig {
}
}
@ -18,19 +18,19 @@ index 8f49262226..869bf8a9f9 100644
+ log("Water over lava flow speed: " + waterOverLavaFlowSpeed);
+ }
+
public enum DuplicateUUIDMode {
SAFE_REGEN, DELETE, NOTHING, WARN
}
public boolean armorStandTick = true;
private void armorStandTick() {
this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java
index e672385829..b53a88c33f 100644
index 44e00339f..b4616f259 100644
--- a/src/main/java/net/minecraft/server/BlockFluids.java
+++ b/src/main/java/net/minecraft/server/BlockFluids.java
@@ -77,11 +77,27 @@ public class BlockFluids extends Block implements IFluidSource {
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1) {
@@ -70,11 +70,27 @@ public class BlockFluids extends Block implements IFluidSource {
@Override
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
if (this.a(world, blockposition, iblockdata)) {
- world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.a((IWorldReader) world));
+ world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.getFlowSpeed(world, blockposition)); // Paper
- world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.a((IWorldReader) world));
+ world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.getFlowSpeed(world, blockposition)); // Paper
}
}
@ -51,18 +51,18 @@ index e672385829..b53a88c33f 100644
+ }
+ // Paper end
+
@Override
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
if (iblockdata.s().d() || iblockdata1.s().d()) {
generatoraccess.getFluidTickList().a(blockposition, iblockdata.s().c(), this.a((IWorldReader) generatoraccess));
@@ -92,7 +108,7 @@ public class BlockFluids extends Block implements IFluidSource {
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1) {
if (iblockdata.p().isSource() || iblockdata1.p().isSource()) {
@@ -87,7 +103,7 @@ public class BlockFluids extends Block implements IFluidSource {
@Override
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
if (this.a(world, blockposition, iblockdata)) {
- world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.a((IWorldReader) world));
+ world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.getFlowSpeed(world, blockposition)); // Paper
- world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.a((IWorldReader) world));
+ world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.getFlowSpeed(world, blockposition)); // Paper
}
}
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 6287458c83ada09b092886a8aa35534838222ed2 Mon Sep 17 00:00:00 2001
From feb037bcc438e450631048b1bb2d45785ecc9ea8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 26 Aug 2018 20:49:50 -0400
Subject: [PATCH] Optimize RegistryMaterials
@ -8,23 +8,23 @@ Use larger initial sizes to increase bucket capacity on the BiMap
BiMap.get was seen to be using a good bit of CPU time.
diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java
index 1521ed759b..78de740acf 100644
index f291e05b2..860924f9b 100644
--- a/src/main/java/net/minecraft/server/RegistryMaterials.java
+++ b/src/main/java/net/minecraft/server/RegistryMaterials.java
@@ -15,9 +15,9 @@ import org.apache.logging.log4j.Logger;
public class RegistryMaterials<V> implements IRegistry<V> {
@@ -16,9 +16,9 @@ import org.apache.logging.log4j.Logger;
public class RegistryMaterials<T> extends IRegistryWritable<T> {
protected static final Logger a = LogManager.getLogger();
- protected final RegistryID<V> b = new RegistryID<>(256);
- protected final BiMap<MinecraftKey, V> c = HashBiMap.create();
protected static final Logger LOGGER = LogManager.getLogger();
- protected final RegistryID<T> b = new RegistryID<>(256);
- protected final BiMap<MinecraftKey, T> c = HashBiMap.create();
- protected Object[] d;
+ protected final RegistryID<V> b = new RegistryID<V>(2048); // Paper - use bigger expected size to reduce collisions
+ protected final BiMap<MinecraftKey, V> c = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions
+ protected V[] d; // Paper - Decompile fix
private int x;
+ protected final RegistryID<T> b = new RegistryID<>(2048); // Paper - use bigger expected size to reduce collisions
+ protected final BiMap<MinecraftKey, T> c = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions
+ protected T[] d; // Paper - Decompile fix
private int R;
public RegistryMaterials() {}
@@ -90,7 +90,7 @@ public class RegistryMaterials<V> implements IRegistry<V> {
@@ -98,7 +98,7 @@ public class RegistryMaterials<T> extends IRegistryWritable<T> {
return null;
}
@ -34,5 +34,5 @@ index 1521ed759b..78de740acf 100644
return this.d[random.nextInt(this.d.length)];
--
2.21.0
2.20.1

View File

@ -1,14 +1,14 @@
From 30c304589394cbb4a62b90d363c0538f0a60ba75 Mon Sep 17 00:00:00 2001
From 5ce2bea107f64d47592ed33ceddbfcc2b04ee2fc Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 25 Aug 2018 19:56:51 -0500
Subject: [PATCH] Add PhantomPreSpawnEvent
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
index a99d90efcb..f576264a8d 100644
index e5ed5a3dc..e5d032d02 100644
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
@@ -127,6 +127,11 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -129,6 +129,11 @@ public class EntityPhantom extends EntityFlying implements IMonster {
}
this.setSize(nbttagcompound.getInt("Size"));
@ -19,10 +19,10 @@ index a99d90efcb..f576264a8d 100644
+ // Paper end
}
public void b(NBTTagCompound nbttagcompound) {
@@ -135,6 +140,11 @@ public class EntityPhantom extends EntityFlying implements IMonster {
nbttagcompound.setInt("AY", this.c.getY());
nbttagcompound.setInt("AZ", this.c.getZ());
@Override
@@ -138,6 +143,11 @@ public class EntityPhantom extends EntityFlying implements IMonster {
nbttagcompound.setInt("AY", this.d.getY());
nbttagcompound.setInt("AZ", this.d.getZ());
nbttagcompound.setInt("Size", this.getSize());
+ // Paper start
+ if (this.spawningEntity != null) {
@ -31,9 +31,9 @@ index a99d90efcb..f576264a8d 100644
+ // Paper end
}
public SoundCategory bV() {
@@ -170,6 +180,14 @@ public class EntityPhantom extends EntityFlying implements IMonster {
return true;
@Override
@@ -184,6 +194,14 @@ public class EntityPhantom extends EntityFlying implements IMonster {
return entitysize.a(f);
}
+ // Paper start
@ -46,9 +46,9 @@ index a99d90efcb..f576264a8d 100644
+
class b extends PathfinderGoal {
private int b;
private final PathfinderTargetCondition b;
diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
index 5c43d908f0..5ddf66eef5 100644
index 9f64d81c6..11098cd13 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
@@ -50,8 +50,17 @@ public class MobSpawnerPhantom {
@ -64,14 +64,14 @@ index 5c43d908f0..5ddf66eef5 100644
+ continue;
+ }
+ // Paper end
EntityPhantom entityphantom = new EntityPhantom(world);
EntityPhantom entityphantom = (EntityPhantom) EntityTypes.PHANTOM.a((World) worldserver);
-
+ entityphantom.spawningEntity = entityhuman.uniqueID; // Paper
entityphantom.setPositionRotation(blockposition1, 0.0F, 0.0F);
groupdataentity = entityphantom.prepare(difficultydamagescaler, groupdataentity, (NBTTagCompound) null);
world.addEntity(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
groupdataentity = entityphantom.prepare(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
worldserver.addEntity(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
index 9f9ee92390..2b97313694 100644
index 9f9ee9239..2b9731369 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
@@ -35,4 +35,10 @@ public class CraftPhantom extends CraftFlying implements Phantom {
@ -86,5 +86,5 @@ index 9f9ee92390..2b97313694 100644
+ // Paper end
}
--
2.21.0
2.20.1

View File

@ -1,32 +1,32 @@
From 90acbf1d243aaf1738d21101fb44075790373591 Mon Sep 17 00:00:00 2001
From da041de23ba213f90f6d7fe6b5c3eb49cb53ab16 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 24 Aug 2018 11:50:26 -0500
Subject: [PATCH] Add More Creeper API
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index a07337ae40..945a75dd62 100644
index 29569805c..0c2c3c730 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -14,7 +14,7 @@ public class EntityCreeper extends EntityMonster {
private static final DataWatcherObject<Boolean> b = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Boolean> c = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i);private static final DataWatcherObject<Boolean> isIgnitedDW = c; // Paper OBFHELPER
private int bC;
@@ -13,7 +13,7 @@ public class EntityCreeper extends EntityMonster {
private static final DataWatcherObject<Boolean> POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> isIgnitedDW = d; // Paper OBFHELPER
private int bz;
- private int fuseTicks;
+ public int fuseTicks; // Paper - public
public int maxFuseTicks = 30;
public int explosionRadius = 3;
private int bG;
@@ -190,6 +190,7 @@ public class EntityCreeper extends EntityMonster {
private int bD;
@@ -201,6 +201,7 @@ public class EntityCreeper extends EntityMonster {
return super.a(entityhuman, enumhand);
}
+ public void explode() { this.dE(); } // Paper - OBFHELPER
private void dE() {
+ public void explode() { this.eb(); } // Paper - OBFHELPER
private void eb() {
if (!this.world.isClientSide) {
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
@@ -241,8 +242,19 @@ public class EntityCreeper extends EntityMonster {
return (Boolean) this.datawatcher.get(EntityCreeper.c);
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean("mobGriefing") ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
@@ -252,8 +253,19 @@ public class EntityCreeper extends EntityMonster {
return (Boolean) this.datawatcher.get(EntityCreeper.d);
}
+ // Paper start
@ -34,23 +34,23 @@ index a07337ae40..945a75dd62 100644
+ if (isIgnited() != ignited) {
+ com.destroystokyo.paper.event.entity.CreeperIgniteEvent event = new com.destroystokyo.paper.event.entity.CreeperIgniteEvent((org.bukkit.entity.Creeper) getBukkitEntity(), ignited);
+ if (event.callEvent()) {
+ this.datawatcher.set(EntityCreeper.c, event.isIgnited());
+ this.datawatcher.set(EntityCreeper.d, event.isIgnited());
+ }
+ }
+ }
+
public void dB() {
- this.datawatcher.set(EntityCreeper.c, true);
public void dY() {
- this.datawatcher.set(EntityCreeper.d, true);
+ setIgnited(true);
+ // Paper end
}
public boolean canCauseHeadDrop() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java
index ffebb54caa..ab2b20a0d4 100644
index 2f2abb707..e54664661 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java
@@ -76,4 +76,22 @@ public class CraftCreeper extends CraftMonster implements Creeper {
@@ -75,4 +75,22 @@ public class CraftCreeper extends CraftMonster implements Creeper {
public EntityType getType() {
return EntityType.CREEPER;
}
@ -74,5 +74,5 @@ index ffebb54caa..ab2b20a0d4 100644
+ // Paper end
}
--
2.21.0
2.20.1

View File

@ -1,14 +1,14 @@
From f0993f00111e586cef6bd9a91f599b2c675b1a44 Mon Sep 17 00:00:00 2001
From 69a8e55d0ea65cb255d8a2a37b03596f352afeac Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 28 Aug 2018 23:04:15 -0400
Subject: [PATCH] Inventory#removeItemAnySlot
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index dd7b3d766f..01af982933 100644
index 3a2b57ae7..fe52f87d3 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -213,10 +213,16 @@ public class CraftInventory implements Inventory {
@@ -210,10 +210,16 @@ public class CraftInventory implements Inventory {
}
private int first(ItemStack item, boolean withAmount) {
@ -26,7 +26,7 @@ index dd7b3d766f..01af982933 100644
for (int i = 0; i < inventory.length; i++) {
if (inventory[i] == null) continue;
@@ -331,6 +337,17 @@ public class CraftInventory implements Inventory {
@@ -328,6 +334,17 @@ public class CraftInventory implements Inventory {
}
public HashMap<Integer, ItemStack> removeItem(ItemStack... items) {
@ -44,7 +44,7 @@ index dd7b3d766f..01af982933 100644
Validate.notNull(items, "Items cannot be null");
HashMap<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
@@ -341,7 +358,10 @@ public class CraftInventory implements Inventory {
@@ -338,7 +355,10 @@ public class CraftInventory implements Inventory {
int toDelete = item.getAmount();
while (true) {
@ -57,5 +57,5 @@ index dd7b3d766f..01af982933 100644
// Drat! we don't have this type in the inventory
if (first == -1) {
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From b9a079faa51a82120065cb1726802785d95fd6c9 Mon Sep 17 00:00:00 2001
From a54679a5585f693e6c222b3413ef1b5156892466 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sun, 2 Sep 2018 19:34:33 -0700
Subject: [PATCH] Make CraftWorld#loadChunk(int, int, false) load unconverted
@ -6,18 +6,18 @@ Subject: [PATCH] Make CraftWorld#loadChunk(int, int, false) load unconverted
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 7e52859c1d..0e4455d66e 100644
index e336813bd..a6f6046c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -296,7 +296,7 @@ public class CraftWorld implements World {
@@ -454,7 +454,7 @@ public class CraftWorld implements World {
public boolean loadChunk(int x, int z, boolean generate) {
org.spigotmc.AsyncCatcher.catchOp( "chunk load"); // Spigot
chunkLoadCount++;
- return world.getChunkProvider().getChunkAt(x, z, true, generate) != null;
+ return world.getChunkProvider().getChunkAt(x, z, true, generate || isChunkGenerated(x, z)) != null; // Paper
}
- IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, generate ? ChunkStatus.FULL : ChunkStatus.EMPTY, true);
+ IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, generate || isChunkGenerated(x, z) ? ChunkStatus.FULL : ChunkStatus.EMPTY, true);
public boolean isChunkLoaded(Chunk chunk) {
// If generate = false, but the chunk already exists, we will get this back.
if (chunk instanceof ProtoChunkExtension) {
--
2.21.0
2.20.1

View File

@ -1,16 +1,16 @@
From f7d0224d01343e319ec60cd0807c1f9e58bfe8ba Mon Sep 17 00:00:00 2001
From 78b79db41419aab24fd685e01aa02dc7d9de02d4 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 3 Sep 2018 18:20:03 -0500
Subject: [PATCH] Add ray tracing methods to LivingEntity
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index cb32d64bd0..6367fdd469 100644
index 2ed2960c5..064703afe 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2817,6 +2817,22 @@ public abstract class EntityLiving extends Entity {
@@ -3170,6 +3170,22 @@ public abstract class EntityLiving extends Entity {
this.c(enumhand == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND);
}
// Paper start
+ public MovingObjectPosition getRayTrace(int maxDistance) {
+ return getRayTrace(maxDistance, FluidCollisionOption.NEVER);
@ -32,10 +32,10 @@ index cb32d64bd0..6367fdd469 100644
public int getShieldBlockingDelay() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 52834b6da3..eeab59379a 100644
index 29b23e30f..863802187 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -171,6 +171,23 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -170,6 +170,23 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return blocks.get(0);
}
@ -60,5 +60,5 @@ index 52834b6da3..eeab59379a 100644
return getLineOfSight(transparent, maxDistance, 2);
}
--
2.21.0
2.20.1

View File

@ -1,36 +1,36 @@
From 4fbc83d8093f60433f29b804c3c352235627ab26 Mon Sep 17 00:00:00 2001
From 2f9d171741fcd9eeaca82f3592ae2ea1dbf5a9c7 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Tue, 4 Sep 2018 15:02:00 -0500
Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index cc1bc01b16..4bbf577523 100644
index f665dc0eb..f17c1c54b 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -2061,14 +2061,17 @@ public abstract class EntityHuman extends EntityLiving {
this.datawatcher.set(EntityHuman.bA, nbttagcompound);
@@ -2003,14 +2003,17 @@ public abstract class EntityHuman extends EntityLiving {
this.datawatcher.set(EntityHuman.bw, nbttagcompound);
}
+ public float getCooldownPeriod() { return dG(); } // Paper - OBFHELPER
public float dG() {
return (float) (1.0D / this.getAttributeInstance(GenericAttributes.g).getValue() * 20.0D);
+ public float getCooldownPeriod() { return dY(); } // Paper - OBFHELPER
public float dY() {
return (float) (1.0D / this.getAttributeInstance(GenericAttributes.ATTACK_SPEED).getValue() * 20.0D);
}
+ public float getCooledAttackStrength(float adjustTicks) { return r(adjustTicks); } // Paper - OBFHELPER
public float r(float f) {
return MathHelper.a(((float) this.aH + f) / this.dG(), 0.0F, 1.0F);
+ public float getCooledAttackStrength(float adjustTicks) { return s(adjustTicks); } // Paper - OBFHELPER
public float s(float f) {
return MathHelper.a(((float) this.aD + f) / this.dY(), 0.0F, 1.0F);
}
+ public void resetCooldown() { dH(); } // Paper - OBFHELPER
public void dH() {
this.aH = 0;
+ public void resetCooldown() { dZ(); } // Paper - OBFHELPER
public void dZ() {
this.aD = 0;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 47426d8fda..7a918ea72f 100644
index 6ceb02200..d505af188 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1897,6 +1897,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1907,6 +1907,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.resourcePackStatus = status;
}
@ -52,5 +52,5 @@ index 47426d8fda..7a918ea72f 100644
private final Player.Spigot spigot = new Player.Spigot()
{
--
2.21.0
2.20.1

View File

@ -1,14 +1,14 @@
From 9254fbc2091ff1c898ef32c4b788c22da56915c6 Mon Sep 17 00:00:00 2001
From d3120098ca824fcf3a86efcd2601976b301f06f8 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 8 Sep 2018 18:43:31 -0500
Subject: [PATCH] Allow chests to be placed with NBT data
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 0d06db9355..f8d82a0276 100644
index 2d83c9e79..dec589463 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -241,6 +241,7 @@ public final class ItemStack {
@@ -235,6 +235,7 @@ public final class ItemStack {
enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement
// PAIL: Remove this when MC-99075 fixed
placeEvent.getPlayer().updateInventory();
@ -17,10 +17,10 @@ index 0d06db9355..f8d82a0276 100644
for (BlockState blockstate : blocks) {
blockstate.update(true, false);
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index c46b761cc5..2e0f782f65 100644
index d606e2e4f..f9f9183da 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -305,7 +305,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic
@@ -308,7 +308,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic
// CraftBukkit start
@Override
public boolean isFilteredNBT() {
@ -30,5 +30,5 @@ index c46b761cc5..2e0f782f65 100644
// CraftBukkit end
}
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From f30d73d8b95844609afc163311777a5346232f34 Mon Sep 17 00:00:00 2001
From ef8f04a7d876a0e7d3c2d86f7e37b83c0ea49347 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 9 Sep 2018 13:30:00 -0400
Subject: [PATCH] Mob Pathfinding API
@ -7,7 +7,7 @@ Implements Pathfinding API for mobs
diff --git a/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java
new file mode 100644
index 0000000000..ed3d86ddd3
index 000000000..ed3d86ddd
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java
@@ -0,0 +1,113 @@
@ -125,7 +125,7 @@ index 0000000000..ed3d86ddd3
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index c55aadb536..cac0ce2a3a 100644
index 0586597e7..583f2c5ad 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -69,7 +69,7 @@ public abstract class NavigationAbstract {
@ -137,16 +137,16 @@ index c55aadb536..cac0ce2a3a 100644
return this.b(new BlockPosition(d0, d1, d2));
}
@@ -97,7 +97,7 @@ public abstract class NavigationAbstract {
@@ -86,7 +86,7 @@ public abstract class NavigationAbstract {
}
@Nullable
- public PathEntity a(Entity entity) {
+ public PathEntity calculateDestination(Entity entity) { return a(entity); } @Nullable public PathEntity a(Entity entity) { // Paper - OBFHELPER
if (!this.b()) {
return null;
} else {
@@ -148,6 +148,7 @@ public abstract class NavigationAbstract {
BlockPosition blockposition = new BlockPosition(entity);
double d0 = entity.locX;
double d1 = entity.getBoundingBox().minY;
@@ -152,6 +152,7 @@ public abstract class NavigationAbstract {
private int pathfindFailures = 0;
// Paper end
@ -154,65 +154,62 @@ index c55aadb536..cac0ce2a3a 100644
public boolean a(@Nullable PathEntity pathentity, double d0) {
if (pathentity == null) {
this.c = null;
@@ -170,8 +171,7 @@ public abstract class NavigationAbstract {
}
@@ -175,7 +176,7 @@ public abstract class NavigationAbstract {
}
}
-
- @Nullable
+ @Nullable public PathEntity getPathEntity() { return m(); } @Nullable // Paper - OBFHELPER
public PathEntity m() {
+ @Nullable public PathEntity getPathEntity() { return l(); } @Nullable // Paper - OBFHELPER
public PathEntity l() {
return this.c;
}
@@ -279,6 +279,7 @@ public abstract class NavigationAbstract {
@@ -283,6 +284,7 @@ public abstract class NavigationAbstract {
return this.c == null || this.c.b();
}
+ public void stopPathfinding() { q(); } // Paper - OBFHELPER
public void q() {
+ public void stopPathfinding() { o(); } // Paper - OBFHELPER
public void o() {
this.pathfindFailures = 0; this.lastFailure = 0; // Paper - Pathfinding optimizations
this.c = null;
diff --git a/src/main/java/net/minecraft/server/PathEntity.java b/src/main/java/net/minecraft/server/PathEntity.java
index 31fc1fbc65..5cf7f3bf1b 100644
index d1cb80208..ec6b3a292 100644
--- a/src/main/java/net/minecraft/server/PathEntity.java
+++ b/src/main/java/net/minecraft/server/PathEntity.java
@@ -4,12 +4,13 @@ import javax.annotation.Nullable;
@@ -5,11 +5,11 @@ import javax.annotation.Nullable;
public class PathEntity {
- private final PathPoint[] a;
+ private final PathPoint[] a; public PathPoint[] getPoints() { return a; } // Paper - OBFHELPER
- private final List<PathPoint> a;
+ private final List<PathPoint> a; public List<PathPoint> getPoints() { return a; } // Paper - OBFHELPER
private PathPoint[] b = new PathPoint[0];
private PathPoint[] c = new PathPoint[0];
private PathPoint d;
- private int e;
- private int f;
+ private int e; public int getNextIndex() { return e; } // Paper - OBFHELPER
+ private int f; public int getPathCount() { return f; } // Paper - OBFHELPER
+ public boolean hasNext() { return getNextIndex() < getPathCount(); } // Paper
public PathEntity(PathPoint[] apathpoint) {
this.a = apathpoint;
@@ -25,7 +26,7 @@ public class PathEntity {
public PathEntity(List<PathPoint> list) {
this.a = list;
@@ -23,8 +23,7 @@ public class PathEntity {
return this.e >= this.a.size();
}
@Nullable
- @Nullable
- public PathPoint c() {
+ public PathPoint getFinalPoint() { return c(); } @Nullable public PathPoint c() { // Paper - OBFHELPER
return this.f > 0 ? this.a[this.f - 1] : null;
return !this.a.isEmpty() ? (PathPoint) this.a.get(this.a.size() - 1) : null;
}
@@ -65,7 +66,7 @@ public class PathEntity {
@@ -72,7 +71,7 @@ public class PathEntity {
return this.a(entity, this.e);
}
- public Vec3D f() {
+ public Vec3D getNext() { return f(); } public Vec3D f() { // Paper - OBFHELPER
PathPoint pathpoint = this.a[this.e];
- public Vec3D g() {
+ public Vec3D getNext() { return g(); } public Vec3D g() { // Paper - OBFHELPER
PathPoint pathpoint = (PathPoint) this.a.get(this.e);
return new Vec3D((double) pathpoint.a, (double) pathpoint.b, (double) pathpoint.c);
diff --git a/src/main/java/net/minecraft/server/PathPoint.java b/src/main/java/net/minecraft/server/PathPoint.java
index 78ed002868..0dd6e46d12 100644
index 0f6e8c51e..5d445e08a 100644
--- a/src/main/java/net/minecraft/server/PathPoint.java
+++ b/src/main/java/net/minecraft/server/PathPoint.java
@@ -2,9 +2,9 @@ package net.minecraft.server;
@ -229,7 +226,7 @@ index 78ed002868..0dd6e46d12 100644
public int d = -1;
public float e;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index 5bf1cd06fa..53c2d154ed 100644
index 5bf1cd06f..53c2d154e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -12,8 +12,11 @@ import org.bukkit.loot.LootTable;
@ -245,5 +242,5 @@ index 5bf1cd06fa..53c2d154ed 100644
public void setTarget(LivingEntity target) {
EntityInsentient entity = getHandle();
--
2.21.0
2.20.1

View File

@ -1,14 +1,14 @@
From 3d3c48d4ab5f4be23a1fb1e8803f8a233c3d7628 Mon Sep 17 00:00:00 2001
From 1cef982ae001f8da273de56a99ce6c1ef3d1de9a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 10 Sep 2018 23:36:16 -0400
Subject: [PATCH] Prevent chunk loading from Fluid Flowing
diff --git a/src/main/java/net/minecraft/server/FluidTypeFlowing.java b/src/main/java/net/minecraft/server/FluidTypeFlowing.java
index 431602cac1..c0955d6ec2 100644
index c76fa0b4b..5f1514360 100644
--- a/src/main/java/net/minecraft/server/FluidTypeFlowing.java
+++ b/src/main/java/net/minecraft/server/FluidTypeFlowing.java
@@ -185,7 +185,8 @@ public abstract class FluidTypeFlowing extends FluidType {
@@ -178,7 +178,8 @@ public abstract class FluidTypeFlowing extends FluidType {
EnumDirection enumdirection = (EnumDirection) entry.getKey();
Fluid fluid1 = (Fluid) entry.getValue();
BlockPosition blockposition1 = blockposition.shift(enumdirection);
@ -16,19 +16,19 @@ index 431602cac1..c0955d6ec2 100644
+ IBlockData iblockdata1 = generatoraccess.getTypeIfLoaded(blockposition1); // Paper
+ if (iblockdata1 == null) continue; // Paper
if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.c())) {
if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.getType())) {
// CraftBukkit start
@@ -212,7 +213,8 @@ public abstract class FluidTypeFlowing extends FluidType {
@@ -205,7 +206,8 @@ public abstract class FluidTypeFlowing extends FluidType {
while (iterator.hasNext()) {
EnumDirection enumdirection = (EnumDirection) iterator.next();
BlockPosition blockposition1 = blockposition.shift(enumdirection);
- IBlockData iblockdata1 = iworldreader.getType(blockposition1);
+ IBlockData iblockdata1 = iworldreader.getTypeIfLoaded(blockposition1); // Paper
+ if (iblockdata1 == null) continue; // Paper
Fluid fluid = iblockdata1.s();
Fluid fluid = iblockdata1.p();
if (fluid.c().a((FluidType) this) && this.a(enumdirection, (IBlockAccess) iworldreader, blockposition, iblockdata, blockposition1, iblockdata1)) {
@@ -329,11 +331,20 @@ public abstract class FluidTypeFlowing extends FluidType {
if (fluid.getType().a((FluidType) this) && this.a(enumdirection, (IBlockAccess) iworldreader, blockposition, iblockdata, blockposition1, iblockdata1)) {
@@ -322,11 +324,19 @@ public abstract class FluidTypeFlowing extends FluidType {
if (enumdirection1 != enumdirection) {
BlockPosition blockposition2 = blockposition.shift(enumdirection1);
short short0 = a(blockposition1, blockposition2);
@ -41,26 +41,25 @@ index 431602cac1..c0955d6ec2 100644
+ if (iblockdatax == null) {
+ continue;
+ }
+
+ pair = Pair.of(iblockdatax, iblockdatax.s());
- return Pair.of(iblockdata1, iblockdata1.p());
- });
+ pair = Pair.of(iblockdatax, iblockdatax.p());
+ short2objectmap.put(short0, pair);
+
+ }
+ // Paper end
- return Pair.of(iblockdata1, iblockdata1.s());
- });
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
Fluid fluid = (Fluid) pair.getSecond();
@@ -405,11 +416,16 @@ public abstract class FluidTypeFlowing extends FluidType {
@@ -398,11 +408,16 @@ public abstract class FluidTypeFlowing extends FluidType {
EnumDirection enumdirection = (EnumDirection) iterator.next();
BlockPosition blockposition1 = blockposition.shift(enumdirection);
short short0 = a(blockposition, blockposition1);
- Pair<IBlockData, Fluid> pair = (Pair) short2objectmap.computeIfAbsent(short0, (j) -> {
- IBlockData iblockdata1 = iworldreader.getType(blockposition1);
-
- return Pair.of(iblockdata1, iblockdata1.s());
- return Pair.of(iblockdata1, iblockdata1.p());
- });
+ // Paper start
+ Pair pair = (Pair) short2objectmap.get(short0);
@ -68,7 +67,7 @@ index 431602cac1..c0955d6ec2 100644
+ IBlockData iblockdatax = iworldreader.getTypeIfLoaded(blockposition1);
+ if (iblockdatax == null) continue;
+
+ pair = Pair.of(iblockdatax, iblockdatax.s());
+ pair = Pair.of(iblockdatax, iblockdatax.p());
+ short2objectmap.put(short0, pair);
+ }
+ // Paper end
@ -76,5 +75,5 @@ index 431602cac1..c0955d6ec2 100644
Fluid fluid = (Fluid) pair.getSecond();
Fluid fluid1 = this.a(iworldreader, blockposition1, iblockdata1);
--
2.21.0
2.20.1

View File

@ -1,11 +1,11 @@
From 4acfbb97ceafd3046c16fb8763ee1568daaf7abb Mon Sep 17 00:00:00 2001
From 7e60246a15e8dadda0eaf8c2e4ea5cbb8ee01492 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Wed, 12 Sep 2018 18:53:55 +0300
Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values
diff --git a/src/main/java/net/minecraft/server/ArgumentBlock.java b/src/main/java/net/minecraft/server/ArgumentBlock.java
index 8e8390282d..f529365817 100644
index 3a215dea4..ea93452e6 100644
--- a/src/main/java/net/minecraft/server/ArgumentBlock.java
+++ b/src/main/java/net/minecraft/server/ArgumentBlock.java
@@ -43,7 +43,7 @@ public class ArgumentBlock {
@ -32,10 +32,10 @@ index 8e8390282d..f529365817 100644
this.s = this::l;
if (this.i.canRead() && this.i.peek() == '#') {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 570f695d82..ec91ab72d6 100644
index 9435136cc..9ced2abbb 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -82,6 +82,12 @@ import javax.annotation.Nullable;
@@ -83,6 +83,12 @@ import org.bukkit.inventory.meta.tags.CustomItemTagContainer;
import static org.spigotmc.ValidateUtils.*;
// Spigot end
@ -48,9 +48,9 @@ index 570f695d82..ec91ab72d6 100644
/**
* Children must include the following:
*
@@ -257,6 +263,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -261,6 +267,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Specific(Specific.To.NBT)
static final ItemMetaKey DAMAGE = new ItemMetaKey("Damage");
static final ItemMetaKey BLOCK_DATA = new ItemMetaKey("BlockStateTag");
static final ItemMetaKey BUKKIT_CUSTOM_TAG = new ItemMetaKey("PublicBukkitValues");
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
+ static final ItemMetaKey CAN_DESTROY = new ItemMetaKey("CanDestroy");
@ -59,7 +59,7 @@ index 570f695d82..ec91ab72d6 100644
private IChatBaseComponent displayName;
private IChatBaseComponent locName;
@@ -267,6 +277,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -273,6 +283,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
private int hideFlag;
private boolean unbreakable;
private int damage;
@ -70,7 +70,7 @@ index 570f695d82..ec91ab72d6 100644
private static final Set<String> HANDLED_TAGS = Sets.newHashSet();
private static final CraftCustomTagTypeRegistry TAG_TYPE_REGISTRY = new CraftCustomTagTypeRegistry();
@@ -299,6 +313,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -310,6 +324,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
this.hideFlag = meta.hideFlag;
this.unbreakable = meta.unbreakable;
this.damage = meta.damage;
@ -86,7 +86,7 @@ index 570f695d82..ec91ab72d6 100644
this.unhandledTags.putAll(meta.unhandledTags);
this.publicItemTagContainer.putAll(meta.publicItemTagContainer.getRaw());
@@ -362,6 +385,31 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -386,6 +409,31 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
publicItemTagContainer.put(key, compound.get(key));
}
}
@ -118,7 +118,7 @@ index 570f695d82..ec91ab72d6 100644
Set<String> keys = tag.getKeys();
for (String key : keys) {
@@ -489,6 +537,34 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -523,6 +571,34 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
setDamage(damage);
}
@ -153,7 +153,7 @@ index 570f695d82..ec91ab72d6 100644
String internal = SerializableMeta.getString(map, "internal", true);
if (internal != null) {
ByteArrayInputStream buf = new ByteArrayInputStream(Base64.decodeBase64(internal));
@@ -609,6 +685,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -651,6 +727,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
if (hasDamage()) {
itemTag.setInt(DAMAGE.NBT, damage);
}
@ -163,7 +163,7 @@ index 570f695d82..ec91ab72d6 100644
+ .map(this::serializeNamespaced)
+ .collect(java.util.stream.Collectors.toList());
+
+ itemTag.set(CAN_PLACE_ON.NBT, createStringList(items));
+ itemTag.set(CAN_PLACE_ON.NBT, createNonComponentStringList(items));
+ }
+
+ if (hasDestroyableKeys()) {
@ -171,28 +171,49 @@ index 570f695d82..ec91ab72d6 100644
+ .map(this::serializeNamespaced)
+ .collect(java.util.stream.Collectors.toList());
+
+ itemTag.set(CAN_DESTROY.NBT, createStringList(items));
+ itemTag.set(CAN_DESTROY.NBT, createNonComponentStringList(items));
+ }
+ // Paper end
for (Map.Entry<String, NBTBase> e : unhandledTags.entrySet()) {
itemTag.set(e.getKey(), e.getValue());
@@ -707,7 +800,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -667,6 +760,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
}
+ // Paper start
+ static NBTTagList createNonComponentStringList(List<String> list) {
+ if (list == null || list.isEmpty()) {
+ return null;
+ }
+
+ NBTTagList tagList = new NBTTagList();
+ for (String value : list) {
+ tagList.add(new NBTTagString(value));
+ }
+
+ return tagList;
+ }
+ // Paper end
+
static NBTTagList createStringList(List<IChatBaseComponent> list) {
if (list == null || list.isEmpty()) {
return null;
@@ -749,7 +857,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Overridden
boolean isEmpty() {
- return !(hasDisplayName() || hasLocalizedName() || hasEnchants() || hasLore() || hasRepairCost() || !unhandledTags.isEmpty() || !publicItemTagContainer.isEmpty() || hideFlag != 0 || isUnbreakable() || hasDamage() || hasAttributeModifiers());
+ return !(hasDisplayName() || hasLocalizedName() || hasEnchants() || hasLore() || hasRepairCost() || !unhandledTags.isEmpty() || !publicItemTagContainer.isEmpty() || hideFlag != 0 || isUnbreakable() || hasDamage() || hasAttributeModifiers()
+ || hasPlaceableKeys() || hasDestroyableKeys()); // Paper - Implement an API for CanPlaceOn and CanDestroy NBT values
- return !(hasDisplayName() || hasLocalizedName() || hasEnchants() || hasLore() || hasCustomModelData() || hasBlockData() || hasRepairCost() || !unhandledTags.isEmpty() || !publicItemTagContainer.isEmpty() || hideFlag != 0 || isUnbreakable() || hasDamage() || hasAttributeModifiers());
+ return !(hasDisplayName() || hasLocalizedName() || hasEnchants() || hasLore() || hasCustomModelData() || hasBlockData() || hasRepairCost() || !unhandledTags.isEmpty() || !publicItemTagContainer.isEmpty() || hideFlag != 0 || isUnbreakable() || hasDamage() || hasAttributeModifiers() || hasPlaceableKeys() || hasDestroyableKeys()); // Paper - Implement an API for CanPlaceOn and CanDestroy NBT values
}
public String getDisplayName() {
@@ -1049,7 +1143,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
&& (this.publicItemTagContainer.equals(that.publicItemTagContainer))
@@ -1125,7 +1233,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
&& (this.hideFlag == that.hideFlag)
&& (this.isUnbreakable() == that.isUnbreakable())
- && (this.hasDamage() ? that.hasDamage() && this.damage == that.damage : !that.hasDamage());
+ && (this.hasDamage() ? that.hasDamage() && this.damage == that.damage : !that.hasDamage())
&& (this.hasDamage() ? that.hasDamage() && this.damage == that.damage : !that.hasDamage())
- && (this.version == that.version);
+ && (this.version == that.version)
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
+ && (this.hasPlaceableKeys() ? that.hasPlaceableKeys() && this.placeableKeys.equals(that.placeableKeys) : !that.hasPlaceableKeys())
+ && (this.hasDestroyableKeys() ? that.hasDestroyableKeys() && this.destroyableKeys.equals(that.destroyableKeys) : !that.hasDestroyableKeys());
@ -200,10 +221,10 @@ index 570f695d82..ec91ab72d6 100644
}
/**
@@ -1081,6 +1179,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
hash = 61 * hash + (isUnbreakable() ? 1231 : 1237);
@@ -1160,6 +1272,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
hash = 61 * hash + (hasDamage() ? this.damage : 0);
hash = 61 * hash + (hasAttributeModifiers() ? this.attributeModifiers.hashCode() : 0);
hash = 61 * hash + version;
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
+ hash = 61 * hash + (hasPlaceableKeys() ? this.placeableKeys.hashCode() : 0);
+ hash = 61 * hash + (hasDestroyableKeys() ? this.destroyableKeys.hashCode() : 0);
@ -211,15 +232,14 @@ index 570f695d82..ec91ab72d6 100644
return hash;
}
@@ -1101,6 +1203,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
clone.hideFlag = this.hideFlag;
@@ -1183,6 +1299,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
clone.unbreakable = this.unbreakable;
clone.damage = this.damage;
clone.version = this.version;
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
+ if (this.placeableKeys != null) {
+ clone.placeableKeys = Sets.newHashSet(this.placeableKeys);
+ }
+
+ if (this.destroyableKeys != null) {
+ clone.destroyableKeys = Sets.newHashSet(this.destroyableKeys);
+ }
@ -227,7 +247,7 @@ index 570f695d82..ec91ab72d6 100644
return clone;
} catch (CloneNotSupportedException e) {
throw new Error(e);
@@ -1150,6 +1261,24 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1239,6 +1363,24 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
builder.put(DAMAGE.BUKKIT, damage);
}
@ -252,7 +272,7 @@ index 570f695d82..ec91ab72d6 100644
final Map<String, NBTBase> internalTags = new HashMap<String, NBTBase>(unhandledTags);
serializeInternal(internalTags);
if (!internalTags.isEmpty()) {
@@ -1299,7 +1428,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1399,7 +1541,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
CraftMetaArmorStand.NO_BASE_PLATE.NBT,
CraftMetaArmorStand.SHOW_ARMS.NBT,
CraftMetaArmorStand.SMALL.NBT,
@ -263,7 +283,7 @@ index 570f695d82..ec91ab72d6 100644
// Paper end
));
}
@@ -1346,4 +1477,147 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1446,4 +1590,147 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return spigot;
}
// Spigot end
@ -412,5 +432,5 @@ index 570f695d82..ec91ab72d6 100644
+ // Paper end
}
--
2.21.0
2.20.1

View File

@ -1,70 +1,70 @@
From f11bd89aabd642b356d2af32e10640a8569fef7d Mon Sep 17 00:00:00 2001
From e8030d939fc374bbef44bb68ebcaed841c330a7a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 10 Sep 2018 23:56:36 -0400
Subject: [PATCH] Prevent Mob AI Rules from Loading Chunks
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java
index 2b15aa6c9e..3ca32123bb 100644
index ce9318c57..541d97344 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java
@@ -12,11 +12,13 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
private final Block f;
private final Block g;
private final EntityInsentient entity;
private int h;
private int i;
+ private World world; // Paper
public PathfinderGoalRemoveBlock(Block block, EntityCreature entitycreature, double d0, int i) {
super(entitycreature, d0, 24, i);
this.f = block;
this.g = block;
this.entity = entitycreature;
+ this.world = entitycreature.world; // Paper
}
public boolean a() {
@@ -99,7 +101,9 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
@Override
@@ -114,7 +116,9 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
@Nullable
private BlockPosition a(BlockPosition blockposition, IBlockAccess iblockaccess) {
- if (iblockaccess.getType(blockposition).getBlock() == this.f) {
- if (iblockaccess.getType(blockposition).getBlock() == this.g) {
+ Block block = world.getBlockIfLoaded(blockposition); // Paper
+ if (block == null) return null; // Paper
+ if (block == this.f) { // Paper
+ if (block == this.g) { // Paper
return blockposition;
} else {
BlockPosition[] ablockposition = new BlockPosition[] { blockposition.down(), blockposition.west(), blockposition.east(), blockposition.north(), blockposition.south(), blockposition.down().down()};
@@ -109,7 +113,7 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
@@ -124,7 +128,7 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
for (int j = 0; j < i; ++j) {
BlockPosition blockposition1 = ablockposition1[j];
- if (iblockaccess.getType(blockposition1).getBlock() == this.f) {
+ if (world.getBlockIfLoaded(blockposition1) == this.f) { // Paper
- if (iblockaccess.getType(blockposition1).getBlock() == this.g) {
+ if (world.getBlockIfLoaded(blockposition1) == this.g) { // Paper
return blockposition1;
}
}
@@ -119,7 +123,8 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
}
@@ -135,7 +139,8 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
@Override
protected boolean a(IWorldReader iworldreader, BlockPosition blockposition) {
- Block block = iworldreader.getType(blockposition).getBlock();
+ Block block = world.getBlockIfLoaded(blockposition); // Paper
+ if (block == null) return false; // Paper
return block == this.f && iworldreader.getType(blockposition.up()).isAir() && iworldreader.getType(blockposition.up(2)).isAir();
return block == this.g && iworldreader.getType(blockposition.up()).isAir() && iworldreader.getType(blockposition.up(2)).isAir();
}
diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
index e58fdee8bb..f2c4048c2b 100644
index 8340d6d25..78eb1b39c 100644
--- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java
+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
@@ -87,6 +87,7 @@ public class RandomPositionGenerator {
@@ -93,6 +93,7 @@ public class RandomPositionGenerator {
}
blockposition1 = new BlockPosition((double) k1 + entitycreature.locX, (double) l1 + entitycreature.locY, (double) i2 + entitycreature.locZ);
+ if (!entitycreature.world.isLoaded(blockposition1)) continue; // Paper
if ((!flag1 || entitycreature.f(blockposition1)) && navigationabstract.a(blockposition1)) {
if ((!flag1 || entitycreature.a(blockposition1)) && navigationabstract.a(blockposition1)) {
if (!flag) {
blockposition1 = a(blockposition1, entitycreature);
@@ -155,6 +156,7 @@ public class RandomPositionGenerator {
@@ -161,6 +162,7 @@ public class RandomPositionGenerator {
}
private static boolean b(BlockPosition blockposition, EntityCreature entitycreature) {
@ -74,10 +74,10 @@ index e58fdee8bb..f2c4048c2b 100644
}
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 630ebfb37c..0d45e21573 100644
index 79ded224c..cfab578df 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -764,7 +764,17 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -644,6 +644,16 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
return chunk.getType(blockposition);
}
}
@ -87,14 +87,13 @@ index 630ebfb37c..0d45e21573 100644
+ return getFluid(blockposition);
+ } else {
+ Chunk chunk = this.getChunkIfLoaded(blockposition);
+ return chunk != null ? chunk.getFluid(blockposition) : null;
+ }
+ }
+ // Paper end
@Override
public Fluid getFluid(BlockPosition blockposition) {
if (blockposition.isInvalidYLocation()) { // Paper
return FluidTypes.EMPTY.i();
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 25496ec74347f65858d1b02bf856dc89c3e44a65 Mon Sep 17 00:00:00 2001
From e84f9798c9de10f7cd0fc3c479c72a6bfbec6b0d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 12 Sep 2018 21:12:57 -0400
Subject: [PATCH] Prevent mob spawning from loading/generating chunks
@ -6,30 +6,30 @@ Subject: [PATCH] Prevent mob spawning from loading/generating chunks
also prevents if out of world border bounds
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index d125fae03b..297c53d15c 100644
index e5695c760..696293132 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -129,9 +129,9 @@ public final class SpawnerCreature {
int i2 = blockposition1.getX();
int j2 = blockposition1.getY();
int k2 = blockposition1.getZ();
- IBlockData iblockdata = worldserver.getType(blockposition1);
+ IBlockData iblockdata = worldserver.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn
@@ -25,9 +25,9 @@ public final class SpawnerCreature {
int l = blockposition1.getZ();
- if (!iblockdata.isOccluding()) {
+ if (iblockdata != null && !iblockdata.isOccluding()) { // Paper - don't load chunks for mob spawn
int l2 = 0;
int i3 = 0;
if (k >= 1) {
- IBlockData iblockdata = chunk.getType(blockposition1);
+ IBlockData iblockdata = world.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn
@@ -158,7 +158,7 @@ public final class SpawnerCreature {
float f1 = (float) l3 + 0.5F;
EntityHuman entityhuman1 = worldserver.a((double) f, (double) f1, -1.0D);
- if (!iblockdata.isOccluding(chunk, blockposition1)) {
+ if (iblockdata != null && !iblockdata.isOccluding(chunk, blockposition1)) { // Paper - don't load chunks for mob spawn
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
int i1 = 0;
- if (entityhuman1 != null) {
+ if (entityhuman1 != null && worldserver.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn
double d0 = entityhuman1.d((double) f, (double) k3, (double) f1);
@@ -52,7 +52,7 @@ public final class SpawnerCreature {
float f1 = (float) k1 + 0.5F;
EntityHuman entityhuman = world.a((double) f, (double) f1, -1.0D);
if (d0 > 576.0D && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) {
- if (entityhuman != null && entityhuman.e((double) f, (double) k, (double) f1) > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D)) {
+ if (entityhuman != null && entityhuman.e((double) f, (double) k, (double) f1) > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D) && world.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition_mutableblockposition);
if (Objects.equals(chunkcoordintpair, chunk.getPos())) {
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 38dcc25caf79d64c5fcb8cf6046cb7fe4cbd72a9 Mon Sep 17 00:00:00 2001
From 8d39347a9a9836d2df429831bee64bc016e97c67 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 12 Sep 2018 21:47:01 -0400
Subject: [PATCH] Optimize Biome Mob Lookups for Mob Spawning
@ -6,29 +6,29 @@ Subject: [PATCH] Optimize Biome Mob Lookups for Mob Spawning
Uses an EnumMap as well as a Set paired List for O(1) contains calls.
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
index c399bdecc3..3496d4236d 100644
index 9a839d654..72eb669c5 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -120,7 +120,7 @@ public abstract class BiomeBase {
protected final Map<WorldGenStage.Decoration, List<WorldGenFeatureComposite<?, ?>>> aW = Maps.newHashMap();
protected final List<WorldGenFeatureCompositeFlower<?>> aX = Lists.newArrayList();
protected final Map<StructureGenerator<?>, WorldGenFeatureConfiguration> aY = Maps.newHashMap();
- private final Map<EnumCreatureType, List<BiomeBase.BiomeMeta>> aZ = Maps.newHashMap();
+ private final java.util.EnumMap<EnumCreatureType, List<BiomeBase.BiomeMeta>> aZ = Maps.newEnumMap(EnumCreatureType.class); // Paper
@@ -38,7 +38,7 @@ public abstract class BiomeBase {
protected final Map<WorldGenStage.Decoration, List<WorldGenFeatureConfigured<?>>> r = Maps.newHashMap();
protected final List<WorldGenFeatureConfigured<?>> s = Lists.newArrayList();
protected final Map<StructureGenerator<?>, WorldGenFeatureConfiguration> t = Maps.newHashMap();
- private final Map<EnumCreatureType, List<BiomeBase.BiomeMeta>> u = Maps.newHashMap();
+ private final java.util.EnumMap<EnumCreatureType, List<BiomeBase.BiomeMeta>> u = Maps.newEnumMap(EnumCreatureType.class); // Paper
@Nullable
public static BiomeBase a(BiomeBase biomebase) {
@@ -169,7 +169,7 @@ public abstract class BiomeBase {
@@ -85,7 +85,7 @@ public abstract class BiomeBase {
for (j = 0; j < i; ++j) {
EnumCreatureType enumcreaturetype = aenumcreaturetype[j];
- this.aZ.put(enumcreaturetype, Lists.newArrayList());
+ this.aZ.put(enumcreaturetype, new MobList()); // Paper
- this.u.put(enumcreaturetype, Lists.newArrayList());
+ this.u.put(enumcreaturetype, new MobList()); // Paper
}
} else {
@@ -473,6 +473,38 @@ public abstract class BiomeBase {
@@ -283,6 +283,38 @@ public abstract class BiomeBase {
return this.m;
}
+ // Paper start - keep track of data in a pair set to give O(1) contains calls - we have to hook removals incase plugins mess with it
@ -67,5 +67,5 @@ index c399bdecc3..3496d4236d 100644
@Nullable
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 30647dba5827f15f94d35d4cc67acd0cb71e367b Mon Sep 17 00:00:00 2001
From 79869c22b965698c17bf620cf92b889c075ed027 Mon Sep 17 00:00:00 2001
From: Tassu <git@tassu.me>
Date: Thu, 13 Sep 2018 08:45:21 +0300
Subject: [PATCH] Implement furnace cook speed multiplier API
@ -6,27 +6,27 @@ Subject: [PATCH] Implement furnace cook speed multiplier API
Signed-off-by: Tassu <git@tassu.me>
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index 5b6ccfa9f5..bfbd35bbe5 100644
index be16fe9a9..b9f3a952e 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -9,6 +9,7 @@ import java.util.Map.Entry;
@@ -8,6 +8,7 @@ import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Nullable;
// CraftBukkit start
import java.util.List;
+
+import java.util.List;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
@@ -25,6 +26,7 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve
private NonNullList<ItemStack> items;
private int burnTime;
@@ -26,6 +27,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
protected NonNullList<ItemStack> items;
public int burnTime;
private int ticksForCurrentFuel;
+ public double cookSpeedMultiplier = 1.0; // Paper - cook speed multiplier API
private int cookTime;
private int cookTimeTotal;
private IChatBaseComponent l;
@@ -218,6 +220,11 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve
this.l = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
public int cookTime;
public int cookTimeTotal;
protected final IContainerProperties b;
@@ -212,6 +214,11 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
this.n.put(minecraftkey, j);
}
+ // Paper start - cook speed API
@ -36,16 +36,16 @@ index 5b6ccfa9f5..bfbd35bbe5 100644
+ // Paper end
}
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
@@ -225,6 +232,7 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve
@Override
@@ -220,6 +227,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
nbttagcompound.setShort("BurnTime", (short) this.burnTime);
nbttagcompound.setShort("CookTime", (short) this.cookTime);
nbttagcompound.setShort("CookTimeTotal", (short) this.cookTimeTotal);
+ nbttagcompound.setDouble("Paper.CookSpeedMultiplier", this.cookSpeedMultiplier); // Paper - cook speed multiplier API
ContainerUtil.a(nbttagcompound, this.items);
nbttagcompound.setShort("RecipesUsedSize", (short) this.m.size());
nbttagcompound.setShort("RecipesUsedSize", (short) this.n.size());
int i = 0;
@@ -299,8 +307,8 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve
@@ -283,8 +291,8 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
}
if (this.isBurning() && this.canBurn(irecipe)) {
@ -54,15 +54,15 @@ index 5b6ccfa9f5..bfbd35bbe5 100644
+ this.cookTime += cookSpeedMultiplier; // Paper - cook speed multiplier API
+ if (this.cookTime >= this.cookTimeTotal) { // Paper - cook speed multiplier API
this.cookTime = 0;
this.cookTimeTotal = this.s();
this.cookTimeTotal = this.getRecipeCookingTime();
this.burn(irecipe);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
index c2eea8ce03..429c780ec7 100644
index 9cc67915c..1ce10ea04 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
@@ -84,4 +84,18 @@ public class CraftFurnace extends CraftContainer<TileEntityFurnace> implements F
furnace.setCustomName(null);
}
@@ -63,4 +63,18 @@ public class CraftFurnace<T extends TileEntityFurnace> extends CraftContainer<T>
public void setCookTimeTotal(int cookTimeTotal) {
this.getSnapshot().cookTimeTotal = cookTimeTotal;
}
+
+ // Paper start - cook speed multiplier API
@ -80,5 +80,5 @@ index c2eea8ce03..429c780ec7 100644
+ // Paper end
}
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 264373f74330d046b10469dbe24d45a0c3971da5 Mon Sep 17 00:00:00 2001
From 0a6de7867ec114749ff0cfd6c3c49dcfb14417d5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 17 Sep 2018 23:05:31 -0400
Subject: [PATCH] Support Overriding World Seeds
@ -15,7 +15,7 @@ This seed will end up being saved to the world data file, so it is
a permanent change in that it won't go back if you remove it from paper.yml
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 2023b5af0f..07d7976d21 100644
index 8062054ab..e1bbe142b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -11,6 +11,7 @@ import java.lang.reflect.Modifier;
@ -34,7 +34,7 @@ index 2023b5af0f..07d7976d21 100644
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import co.aikar.timings.Timings;
@@ -355,4 +357,23 @@ public class PaperConfig {
@@ -331,4 +333,23 @@ public class PaperConfig {
}
tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
}
@ -59,10 +59,10 @@ index 2023b5af0f..07d7976d21 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ae271a57fc..4543ac8f15 100644
index 0cebf6f5a..27af4398c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -345,7 +345,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@@ -362,7 +362,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.convertWorld(name); // Run conversion now
org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
@ -72,10 +72,10 @@ index ae271a57fc..4543ac8f15 100644
if (j == 0) {
diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java
index 8458dc17d4..b5fb95293e 100644
index c69a32477..43a557eb4 100644
--- a/src/main/java/net/minecraft/server/WorldData.java
+++ b/src/main/java/net/minecraft/server/WorldData.java
@@ -110,7 +110,7 @@ public class WorldData {
@@ -116,7 +116,7 @@ public class WorldData {
this.d = nbttagcompound2.getBoolean("Snapshot");
}
@ -85,10 +85,10 @@ index 8458dc17d4..b5fb95293e 100644
String s = nbttagcompound.getString("generatorName");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d5ab1d11a2..3cf3037857 100644
index 7b204d584..cf657167d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -990,7 +990,7 @@ public final class CraftServer implements Server {
@@ -983,7 +983,7 @@ public final class CraftServer implements Server {
WorldData worlddata = sdm.getWorldData();
WorldSettings worldSettings = null;
if (worlddata == null) {
@ -98,5 +98,5 @@ index d5ab1d11a2..3cf3037857 100644
if (parsedSettings.isJsonObject()) {
worldSettings.setGeneratorSettings(parsedSettings.getAsJsonObject());
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 6c00757284ea40b18a629c0be9fa09042496f06d Mon Sep 17 00:00:00 2001
From cf834d2b80d762e0229edf91987ea48e58767e7e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 17 Sep 2018 23:37:31 -0400
Subject: [PATCH] Optimize Server World Map
@ -21,7 +21,7 @@ known NMS used methods, but we can add more if naughty plugins are found later.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldMap.java b/src/main/java/com/destroystokyo/paper/PaperWorldMap.java
new file mode 100644
index 0000000000..af9e4455c6
index 000000000..af9e4455c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldMap.java
@@ -0,0 +1,191 @@
@ -217,27 +217,35 @@ index 0000000000..af9e4455c6
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4543ac8f15..d2ee4e5781 100644
index 27af4398c..e6054dddb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -82,7 +82,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@@ -78,7 +78,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public final DataFixer dataConverterManager;
private String serverIp;
private int q = -1;
private int serverPort = -1;
- public final Map<DimensionManager, WorldServer> worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods
+ public final Map<DimensionManager, WorldServer> worldServer = new com.destroystokyo.paper.PaperWorldMap(); // Paper;
private PlayerList playerList;
private boolean isRunning = true;
private boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
@@ -546,7 +546,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
private volatile boolean isRunning = true;
private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
@@ -442,7 +442,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
}
- for (WorldServer world : this.getWorlds()) {
+ for (WorldServer world : com.google.common.collect.Lists.newArrayList(this.getWorlds())) { // Paper - avoid como if 1 world triggers another world
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(world.getWorld()));
this.a(this.getDifficulty(), true);
- for (WorldServer worldserver : this.getWorlds()) {
+ for (WorldServer worldserver : com.google.common.collect.Lists.newArrayList(this.getWorlds())) { // Paper - avoid como if 1 world triggers another world
this.loadSpawn(worldserver.getChunkProvider().playerChunkMap.worldLoadListener, worldserver);
}
// CraftBukkit end
@@ -582,7 +582,6 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.sleepForTick();
// CraftBukkit start
// Iterator iterator = DimensionManager.a().iterator();
-
if (true) {
DimensionManager dimensionmanager = worldserver.worldProvider.getDimensionManager();
// CraftBukkit end
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 27d86dafa2b1b6763d579bfcb34efef889ffa7ec Mon Sep 17 00:00:00 2001
From 95706a134f6565e2758e639b360ecfcd7ac9945c Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Tue, 18 Sep 2018 23:53:23 +0100
Subject: [PATCH] PreSpawnerSpawnEvent
@ -9,24 +9,24 @@ SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners.
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index eca3f85ad2..b2d2de7f81 100644
index bca0e3a2e..96080b6c7 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -102,11 +102,11 @@ public abstract class MobSpawnerAbstract {
String key = this.getMobName().getKey();
@@ -108,11 +108,11 @@ public abstract class MobSpawnerAbstract {
String key = entityType.getKey().getKey();
org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key);
if (type != null) {
- com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
- event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent event;
+ event = new com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent(
MCUtil.toLocation(world, d3, d4, d5),
type,
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+ MCUtil.toLocation(world, blockposition)
MCUtil.toLocation(world, d3, d4, d5),
type,
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+ MCUtil.toLocation(world, blockposition)
);
if (!event.callEvent()) {
flag = true;
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From b44e80368f30993e543b9cd43097a5a41118e16f Mon Sep 17 00:00:00 2001
From 51378c11a77da24269914f4f1e15d0905b672b82 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 22 Sep 2018 15:56:59 -0400
Subject: [PATCH] Catch JsonParseException in Entity and TE names
@ -13,33 +13,33 @@ Shulkers) may need to be changed in order for it to re-save properly
No more crashing though.
diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java
index e38a0d488e..a245df1dce 100644
index 4b7aefb7a..9e568d5d1 100644
--- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java
+++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java
@@ -56,7 +56,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener {
this.g = nbttagcompound.getString("Command");
this.d = nbttagcompound.getInt("SuccessCount");
this.command = nbttagcompound.getString("Command");
this.successCount = nbttagcompound.getInt("SuccessCount");
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.h = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
+ this.h = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException
- this.customName = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
+ this.customName = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException
}
if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index c4d4775627..3d90fdb642 100644
index 2dfa7d251..98d798abd 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1745,7 +1745,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.setPosition(this.locX, this.locY, this.locZ);
this.setYawPitch(this.yaw, this.pitch);
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.setCustomName(IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName")));
+ this.setCustomName(MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound)); // Paper - Catch ParseException
}
@@ -1637,7 +1637,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.setPosition(this.locX, this.locY, this.locZ);
this.setYawPitch(this.yaw, this.pitch);
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.setCustomName(IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName")));
+ this.setCustomName(MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound)); // Paper - Catch ParseException
}
this.setCustomNameVisible(nbttagcompound.getBoolean("CustomNameVisible"));
this.setCustomNameVisible(nbttagcompound.getBoolean("CustomNameVisible"));
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 0ef5ad1165..f70f5899fa 100644
index 0ef5ad116..f70f5899f 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -339,4 +339,19 @@ public final class MCUtil {
@ -63,10 +63,10 @@ index 0ef5ad1165..f70f5899fa 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/TileEntityBanner.java b/src/main/java/net/minecraft/server/TileEntityBanner.java
index 7d9e0837d8..dfee7332ea 100644
index 1f26d8a02..12264c4d0 100644
--- a/src/main/java/net/minecraft/server/TileEntityBanner.java
+++ b/src/main/java/net/minecraft/server/TileEntityBanner.java
@@ -74,7 +74,7 @@ public class TileEntityBanner extends TileEntity implements INamableTileEntity {
@@ -57,7 +57,7 @@ public class TileEntityBanner extends TileEntity implements INamableTileEntity {
public void load(NBTTagCompound nbttagcompound) {
super.load(nbttagcompound);
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
@ -75,84 +75,19 @@ index 7d9e0837d8..dfee7332ea 100644
}
if (this.hasWorld()) {
diff --git a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
index a106a783eb..ff8a5926e1 100644
--- a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
+++ b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
@@ -236,7 +236,7 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IWorl
ContainerUtil.b(nbttagcompound, this.items);
this.brewTime = nbttagcompound.getShort("BrewTime");
diff --git a/src/main/java/net/minecraft/server/TileEntityContainer.java b/src/main/java/net/minecraft/server/TileEntityContainer.java
index 3590b4e31..ea7d5a430 100644
--- a/src/main/java/net/minecraft/server/TileEntityContainer.java
+++ b/src/main/java/net/minecraft/server/TileEntityContainer.java
@@ -17,7 +17,7 @@ public abstract class TileEntityContainer extends TileEntity implements IInvento
super.load(nbttagcompound);
this.chestLock = ChestLock.b(nbttagcompound);
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.k = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
+ this.k = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException
}
this.fuelLevel = nbttagcompound.getByte("Fuel");
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index 2e0f782f65..77c012946a 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -83,7 +83,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic
}
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.i = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
+ this.i = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java
index ddd2e0eb0b..21bd156e91 100644
--- a/src/main/java/net/minecraft/server/TileEntityDispenser.java
+++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java
@@ -107,7 +107,7 @@ public class TileEntityDispenser extends TileEntityLootable {
}
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.i = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
+ this.i = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index bfbd35bbe5..538ca9bbb4 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -217,7 +217,7 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve
}
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.l = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
+ this.l = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException
}
// Paper start - cook speed API
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
index 7303a6fdda..544dde4289 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -60,7 +60,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
}
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.setCustomName(IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName")));
+ this.setCustomName(MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound)); // Paper - Catch ParseException
}
this.f = nbttagcompound.getInt("TransferCooldown");
diff --git a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
index fedba2e1fd..296b8dd56d 100644
--- a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
+++ b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
@@ -249,7 +249,7 @@ public class TileEntityShulkerBox extends TileEntityLootable implements IWorldIn
}
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.i = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
+ this.i = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException
- this.customName = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
+ this.customName = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException
}
}
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 1b850b4cb89a77373fab8799934e2371a22d3dc0 Mon Sep 17 00:00:00 2001
From 2f0f3c789fb42c5ef1b904b0c38919741006640d Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 25 Sep 2018 06:53:43 +0200
Subject: [PATCH] Avoid dimension id collisions
@ -8,10 +8,10 @@ we would reuse an existing dimension id, if some other dimension was
unloaded before.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 3cf3037857..d4d8fbb556 100644
index cf657167d..15756014a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -976,7 +976,7 @@ public final class CraftServer implements Server {
@@ -970,7 +970,7 @@ public final class CraftServer implements Server {
boolean used = false;
do {
for (WorldServer server : console.getWorlds()) {
@ -21,5 +21,5 @@ index 3cf3037857..d4d8fbb556 100644
dimension++;
break;
--
2.21.0
2.20.1

View File

@ -1,14 +1,14 @@
From 4e97187ddd0422e3eaaea5715cae3db866f7c0f6 Mon Sep 17 00:00:00 2001
From 8c7a2d6f219fe6cca184f0cb9f363ca5e02980b5 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 23 Sep 2018 20:59:53 -0500
Subject: [PATCH] Honor EntityAgeable.ageLock
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
index 2af1ac7028..aa54e380e4 100644
index da9740a99..e87754ef3 100644
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
@@ -82,6 +82,7 @@ public abstract class EntityAgeable extends EntityCreature {
@@ -85,6 +85,7 @@ public abstract class EntityAgeable extends EntityCreature {
}
public void setAge(int i, boolean flag) {
@ -17,5 +17,5 @@ index 2af1ac7028..aa54e380e4 100644
int k = j;
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 504acd5b82a2ade2f382e890d31ee27efb22aee4 Mon Sep 17 00:00:00 2001
From 26828dd84bae00ca74903c8233623d9e19455a23 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 27 Sep 2018 00:08:31 -0400
Subject: [PATCH] Ignore Dimension NBT field in Entity data
@ -14,10 +14,10 @@ DimensionManager set to the world it is being placed into.
This fixes corrupt entities breaking chunk saving in custom worlds.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d6d0dd6d88..3db1b6bb1b 100644
index 98d798abd..f5625fca3 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1732,7 +1732,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1622,7 +1622,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.setAirTicks(nbttagcompound.getShort("Air"));
this.onGround = nbttagcompound.getBoolean("OnGround");
if (nbttagcompound.hasKey("Dimension")) {
@ -27,5 +27,5 @@ index d6d0dd6d88..3db1b6bb1b 100644
this.invulnerable = nbttagcompound.getBoolean("Invulnerable");
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 5c7269fbecfab55d9d9aaae09ccd13df67fad70b Mon Sep 17 00:00:00 2001
From 353301bbd8a11960f5b06ffa3eec29bb13b13795 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Sep 2018 22:27:33 -0400
Subject: [PATCH] Don't recheck type after setting a block
@ -16,18 +16,18 @@ be having data corruption issues anyways.
This provides a small boost to all setType calls.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 966879a894..0d51c1baeb 100644
index 21fae98c1..98ca253bd 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -558,7 +558,7 @@ public class Chunk implements IChunkAccess {
this.world.n(blockposition);
@@ -361,7 +361,7 @@ public class Chunk implements IChunkAccess {
this.world.removeTileEntity(blockposition);
}
- if (chunksection.getType(i, j & 15, k).getBlock() != block) {
+ if (false && chunksection.getType(i, j & 15, k).getBlock() != block) { // Paper - don't need to recheck this - this would only fail due to non main thread writes which are not supported
return null;
} else {
if (flag1) {
TileEntity tileentity;
--
2.21.0
2.20.1

View File

@ -1,14 +1,14 @@
From 2b373c407f22a8b2ecfd5fc3a9faa9f94546383c Mon Sep 17 00:00:00 2001
From b5948f0b7250322cb54dab6aff82ad1c55a8d779 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 2 Oct 2018 09:57:50 +0100
Subject: [PATCH] Configurable connection throttle kick message
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index c25db284ff..e4972e30ce 100644
index e1bbe142b..6a2eb12ba 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -296,6 +296,11 @@ public class PaperConfig {
@@ -272,6 +272,11 @@ public class PaperConfig {
authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage));
}
@ -21,10 +21,10 @@ index c25db284ff..e4972e30ce 100644
private static void savePlayerData() {
savePlayerData = getBoolean("settings.save-player-data", savePlayerData);
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index e732d55f9f..2c594b4378 100644
index da88978db..1dad79620 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -37,7 +37,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
@@ -38,7 +38,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
synchronized (throttleTracker) {
if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
throttleTracker.put(address, currentTime);
@ -34,5 +34,5 @@ index e732d55f9f..2c594b4378 100644
this.b.close(chatmessage);
return;
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 82c714ff2ed5dc92a29901636c8dbf590f4a68ba Mon Sep 17 00:00:00 2001
From bfbc1f427e79c169269872707cfea2b275a88483 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Wed, 3 Oct 2018 20:09:18 -0400
Subject: [PATCH] Hook into CB plugin rewrites
@ -8,7 +8,7 @@ our own relocation. Also lets us rewrite NMS calls for when we're
debugging in an IDE pre-relocate.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 632df2270c..b663232201 100644
index 467b2d938..61f102355 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -6,7 +6,9 @@ import java.io.FileOutputStream;
@ -170,8 +170,8 @@ index 632df2270c..b663232201 100644
+
if ( modern )
{
super.visitFieldInsn( opcode, owner, name, desc );
@@ -214,6 +332,14 @@ public class Commodore
if ( owner.equals( "org/bukkit/Material" ) )
@@ -236,6 +354,14 @@ public class Commodore
return;
}
@ -187,5 +187,5 @@ index 632df2270c..b663232201 100644
{
if ( owner.equals( "org/bukkit/Material" ) )
--
2.21.0
2.20.1

View File

@ -1,23 +1,23 @@
From e709b2648076946859a2a2edd80d180b399fd3d1 Mon Sep 17 00:00:00 2001
From 4f0debfaae841ff5458c87e8c16808c54d1ece2e Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 6 Oct 2018 21:47:44 -0500
Subject: [PATCH] Allow setting the vex's summoner
diff --git a/src/main/java/net/minecraft/server/EntityVex.java b/src/main/java/net/minecraft/server/EntityVex.java
index c3864b869e..589b13f4ee 100644
index 83e022c91..c56933068 100644
--- a/src/main/java/net/minecraft/server/EntityVex.java
+++ b/src/main/java/net/minecraft/server/EntityVex.java
@@ -127,6 +127,7 @@ public class EntityVex extends EntityMonster {
@@ -133,6 +133,7 @@ public class EntityVex extends EntityMonster {
this.a(1, flag);
}
+ public void setOwner(EntityInsentient entityinsentient) { a(entityinsentient); } // Paper - OBFHELPER
public void a(EntityInsentient entityinsentient) {
this.b = entityinsentient;
this.c = entityinsentient;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
index c96a5df80a..b09da64c3b 100644
index 169c951ec..2f7df3074 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
@@ -23,6 +23,10 @@ public class CraftVex extends CraftMonster implements Vex {
@ -32,5 +32,5 @@ index c96a5df80a..b09da64c3b 100644
@Override
--
2.21.0
2.20.1

View File

@ -1,38 +1,38 @@
From ac264d636345bea08b5ed7a1ff74b972471f6245 Mon Sep 17 00:00:00 2001
From 783671ae5df4a62f75c3662231e8e8f473c1594c Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 7 Oct 2018 00:54:21 -0500
Subject: [PATCH] Add sun related API
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 856ddf2a74..d1ec201d8a 100644
index f1621a9e9..a8318c88a 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1288,6 +1288,7 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -1330,6 +1330,7 @@ public abstract class EntityInsentient extends EntityLiving {
return flag;
}
+ public boolean isInDaylight() { return dq(); } // Paper - OBFHELPER
protected boolean dq() {
if (this.world.L() && !this.world.isClientSide) {
float f = this.az();
+ public boolean isInDaylight() { return dS(); } // Paper - OBFHELPER
protected boolean dS() {
if (this.world.J() && !this.world.isClientSide) {
float f = this.aE();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 728319968b..027bb64acc 100644
index cfab578df..c917c39b9 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -829,6 +829,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -666,6 +666,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
}
}
+ public boolean isDayTime() { return L(); } // Paper - OBFHELPER
public boolean L() {
return this.G < 4;
+ public boolean isDayTime() { return J(); } // Paper - OBFHELPER
public boolean J() {
return this.d < 4;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index eacecccfdb..7c0a530533 100644
index a6f6046c6..5e672ae2e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -538,6 +538,12 @@ public class CraftWorld implements World {
@@ -699,6 +699,12 @@ public class CraftWorld implements World {
}
}
@ -46,7 +46,7 @@ index eacecccfdb..7c0a530533 100644
return createExplosion(x, y, z, power, false, true);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index 53c2d154ed..40a429942e 100644
index 53c2d154e..40a429942 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -68,4 +68,10 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
@ -61,5 +61,5 @@ index 53c2d154ed..40a429942e 100644
+ // Paper end
}
--
2.21.0
2.20.1

View File

@ -1,22 +1,22 @@
From 27b640541e74e7f1607ad073af6f4b03645d5151 Mon Sep 17 00:00:00 2001
From 60e5273939e2db036b46509e51a97f05f7025e61 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Wed, 10 Oct 2018 21:22:44 -0500
Subject: [PATCH] Check Drowned for Villager Aggression Config
diff --git a/src/main/java/net/minecraft/server/EntityDrowned.java b/src/main/java/net/minecraft/server/EntityDrowned.java
index b861c623cc..0e2b5ee743 100644
index 10957c877..449fbee60 100644
--- a/src/main/java/net/minecraft/server/EntityDrowned.java
+++ b/src/main/java/net/minecraft/server/EntityDrowned.java
@@ -28,7 +28,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity {
@@ -29,7 +29,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity {
this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityDrowned.class}));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, new EntityDrowned.b(this)));
- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillager.class, false));
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillager.class, false));
this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[] { EntityDrowned.class})).a(EntityPigZombie.class));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::h));
- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false));
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); // Paper
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true));
this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bC));
this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bz));
}
--
2.21.0
2.20.1

View File

@ -1,24 +1,24 @@
From a5499b66282e7f75a127044fd454a2927ff7e4f3 Mon Sep 17 00:00:00 2001
From 28e15116850717bceba1cd078a32c6519ea3935c Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 12 Oct 2018 01:37:22 -0500
Subject: [PATCH] Here's Johnny!
diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java
index 96d0651e9b..4bbb4817b1 100644
index 45370ad5d..6b7712ec9 100644
--- a/src/main/java/net/minecraft/server/EntityVindicator.java
+++ b/src/main/java/net/minecraft/server/EntityVindicator.java
@@ -5,7 +5,7 @@ import javax.annotation.Nullable;
public class EntityVindicator extends EntityIllagerAbstract {
- private boolean b;
+ private boolean b; public boolean isJohnny() { return b; } public void setJohnny(boolean johnny) { b = johnny; } // Paper - OBFHELPER
private static final Predicate<Entity> c = (entity) -> {
return entity instanceof EntityLiving && ((EntityLiving) entity).df();
@@ -11,7 +11,7 @@ public class EntityVindicator extends EntityIllagerAbstract {
private static final Predicate<EnumDifficulty> b = (enumdifficulty) -> {
return enumdifficulty == EnumDifficulty.NORMAL || enumdifficulty == EnumDifficulty.HARD;
};
- private boolean bz;
+ private boolean bz; public boolean isJohnny() { return bz; } public void setJohnny(boolean johnny) { bz = johnny; } // Paper - OBFHELPER
public EntityVindicator(EntityTypes<? extends EntityVindicator> entitytypes, World world) {
super(entitytypes, world);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
index 951d479298..5ff957ced7 100644
index 951d47929..5ff957ced 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
@@ -25,4 +25,14 @@ public class CraftVindicator extends CraftIllager implements Vindicator {
@ -37,5 +37,5 @@ index 951d479298..5ff957ced7 100644
+ // Paper end
}
--
2.21.0
2.20.1

View File

@ -1,109 +1,110 @@
From 0145dcdb179116632a79d6734a4829db2ee0c740 Mon Sep 17 00:00:00 2001
From f545c659cc4dd700d009f0912c5dc71962c930d4 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 29 Sep 2018 16:08:23 -0500
Subject: [PATCH] Turtle API
diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java
index b016e0ae7c..a533e0eb5b 100644
index 1b4933c07..b7929c5c4 100644
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
@@ -27,51 +27,63 @@ public class EntityTurtle extends EntityAnimal {
this.Q = 1.0F;
this.K = 1.0F;
}
+ public void setHome(BlockPosition pos) { g(pos); } // Paper - OBFHELPER
public void g(BlockPosition blockposition) {
this.datawatcher.set(EntityTurtle.bD, blockposition);
this.datawatcher.set(EntityTurtle.bA, blockposition);
}
+ public BlockPosition getHome() { return dA(); } // Paper - OBFHELPER
private BlockPosition dA() {
return (BlockPosition) this.datawatcher.get(EntityTurtle.bD);
+ public BlockPosition getHome() { return dX(); } // Paper - OBFHELPER
private BlockPosition dX() {
return (BlockPosition) this.datawatcher.get(EntityTurtle.bA);
}
+ public void setTravelPos(BlockPosition pos) { h(pos); } // Paper - OBFHELPER
private void h(BlockPosition blockposition) {
this.datawatcher.set(EntityTurtle.bH, blockposition);
this.datawatcher.set(EntityTurtle.bE, blockposition);
}
+ public BlockPosition getTravelPos() { return dB(); } // Paper - OBFHELPER
private BlockPosition dB() {
return (BlockPosition) this.datawatcher.get(EntityTurtle.bH);
+ public BlockPosition getTravelPos() { return dY(); } // Paper - OBFHELPER
private BlockPosition dY() {
return (BlockPosition) this.datawatcher.get(EntityTurtle.bE);
}
+ public boolean hasEgg() { return dy(); } // Paper - OBFHELPER
public boolean dy() {
return (Boolean) this.datawatcher.get(EntityTurtle.bE);
+ public boolean hasEgg() { return dV(); } // Paper - OBFHELPER
public boolean dV() {
return (Boolean) this.datawatcher.get(EntityTurtle.bB);
}
+ public void setHasEgg(boolean hasEgg) { s(hasEgg); } // Paper - OBFHELPER
+ public void setHasEgg(boolean hasEgg) { r(hasEgg); } // Paper - OBFHELPER
private void r(boolean flag) {
this.datawatcher.set(EntityTurtle.bB, flag);
}
+ public boolean isDigging() { return dW(); } // Paper - OBFHELPER
public boolean dW() {
return (Boolean) this.datawatcher.get(EntityTurtle.bD);
}
+ public void setDigging(boolean digging) { s(digging); } // Paper - OBFHELPER
private void s(boolean flag) {
this.datawatcher.set(EntityTurtle.bE, flag);
this.bH = flag ? 1 : 0;
this.datawatcher.set(EntityTurtle.bD, flag);
}
+ public boolean isDigging() { return dz(); } // Paper - OBFHELPER
public boolean dz() {
+ public boolean isGoingHome() { return dZ(); } // Paper - OBFHELPER
private boolean dZ() {
return (Boolean) this.datawatcher.get(EntityTurtle.bF);
}
+ public void setGoingHome(boolean goingHome) { t(goingHome); } // Paper - OBFHELPER
private void t(boolean flag) {
this.datawatcher.set(EntityTurtle.bF, flag);
}
+ public boolean isTravelling() { return ee(); } // Paper - OBFHELPER
private boolean ee() {
return (Boolean) this.datawatcher.get(EntityTurtle.bG);
}
+ public void setDigging(boolean digging) { t(digging); } // Paper - OBFHELPER
private void t(boolean flag) {
this.bK = flag ? 1 : 0;
+ public void setTravelling(boolean travelling) { u(travelling); } // Paper - OBFHELPER
private void u(boolean flag) {
this.datawatcher.set(EntityTurtle.bG, flag);
}
@@ -445,14 +457,18 @@ public class EntityTurtle extends EntityAnimal {
+ public boolean isGoingHome() { return dC(); } // Paper - OBFHELPER
private boolean dC() {
return (Boolean) this.datawatcher.get(EntityTurtle.bI);
}
+ public void setGoingHome(boolean goingHome) { u(goingHome); } // Paper - OBFHELPER
private void u(boolean flag) {
this.datawatcher.set(EntityTurtle.bI, flag);
}
+ public boolean isTravelling() { return dH(); } // Paper - OBFHELPER
private boolean dH() {
return (Boolean) this.datawatcher.get(EntityTurtle.bJ);
}
+ public void setTravelling(boolean travelling) { v(travelling); } // Paper - OBFHELPER
private void v(boolean flag) {
this.datawatcher.set(EntityTurtle.bJ, flag);
}
@@ -423,14 +435,17 @@ public class EntityTurtle extends EntityAnimal {
if (!this.f.isInWater() && this.k()) {
if (this.f.bK < 1) {
- this.f.t(true);
+ this.f.setDigging(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.f.getBukkitEntity(), MCUtil.toLocation(this.f.world, this.d)).callEvent()); // Paper
} else if (this.f.bK > 200) {
World world = this.f.world;
if (!this.g.isInWater() && this.k()) {
if (this.g.bH < 1) {
- this.g.s(true);
+ this.g.setDigging(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.g.getBukkitEntity(), MCUtil.toLocation(this.g.world, this.e)).callEvent()); // Paper
} else if (this.g.bH > 200) {
World world = this.g.world;
// CraftBukkit start
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.f, this.d.up(), Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, Integer.valueOf(this.f.random.nextInt(4) + 1))).isCancelled()) {
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.g, this.e.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, this.g.random.nextInt(4) + 1)).isCancelled()) {
+ // Paper start
+ int eggCount = this.f.random.nextInt(4) + 1;
+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.f.getBukkitEntity(), MCUtil.toLocation(this.f.world, this.d.up()), eggCount);
+ if (layEggEvent.callEvent() && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.f, this.d.up(), Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, layEggEvent.getEggCount())).isCancelled()) {
+ int eggCount = this.g.random.nextInt(4) + 1;
+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.g.getBukkitEntity(), MCUtil.toLocation(this.g.world, this.e.up()), eggCount);
+ if (layEggEvent.callEvent() && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.g, this.e.up(), Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, layEggEvent.getEggCount())).isCancelled()) {
world.a((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
- world.setTypeAndData(this.d.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, this.f.random.nextInt(4) + 1), 3);
+ world.setTypeAndData(this.d.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, layEggEvent.getEggCount()), 3);
- world.setTypeAndData(this.e.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, this.g.random.nextInt(4) + 1), 3);
+ world.setTypeAndData(this.e.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, layEggEvent.getEggCount()), 3);
+ // Paper end
}
// CraftBukkit end
this.f.s(false);
@@ -556,7 +571,7 @@ public class EntityTurtle extends EntityAnimal {
}
this.g.r(false);
@@ -587,7 +603,7 @@ public class EntityTurtle extends EntityAnimal {
@Override
public boolean a() {
- return this.a.isBaby() ? false : (this.a.dy() ? true : (this.a.getRandom().nextInt(700) != 0 ? false : this.a.c(this.a.dA()) >= 4096.0D));
+ return this.a.isBaby() ? false : (this.a.dy() ? true : (this.a.getRandom().nextInt(700) != 0 ? false : this.a.c(this.a.dA()) >= 4096.0D)) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.a.getBukkitEntity()).callEvent(); // Paper;
- return this.a.isBaby() ? false : (this.a.dV() ? true : (this.a.getRandom().nextInt(700) != 0 ? false : !this.a.dX().a((IPosition) this.a.ch(), 64.0D)));
+ return this.a.isBaby() ? false : (this.a.dV() ? true : (this.a.getRandom().nextInt(700) != 0 ? false : !this.a.dX().a((IPosition) this.a.ch(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.a.getBukkitEntity()).callEvent(); // Paper;
}
public void c() {
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
index 123a2c75ca..8edcf7af65 100644
index 123a2c75c..8edcf7af6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
@@ -1,6 +1,8 @@
@ -153,5 +154,5 @@ index 123a2c75ca..8edcf7af65 100644
+ // Paper end
}
--
2.21.0
2.20.1

View File

@ -1,14 +1,14 @@
From baf45e6afa85406637c126b82ac06e48a949e18f Mon Sep 17 00:00:00 2001
From e448b41d1488e3cff3b4bcda8c2d035cabafe69c Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
Date: Fri, 14 Sep 2018 17:42:08 +0200
Subject: [PATCH] Limit lightning strike effect distance
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 869bf8a9f9..2a912286b2 100644
index 2c27be63e..fb44fccc9 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -246,6 +246,28 @@ public class PaperWorldConfig {
@@ -234,6 +234,28 @@ public class PaperWorldConfig {
skeleHorseSpawnChance = 0.01D; // Vanilla value
}
}
@ -38,10 +38,10 @@ index 869bf8a9f9..2a912286b2 100644
public boolean firePhysicsEventForRedstone = false;
private void firePhysicsEventForRedstone() {
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
index 7781babf51..50f6200095 100644
index adf68d165..fbcda86b3 100644
--- a/src/main/java/net/minecraft/server/EntityLightning.java
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
@@ -60,6 +60,17 @@ public class EntityLightning extends EntityWeather {
@@ -64,6 +64,17 @@ public class EntityLightning extends Entity {
double deltaX = this.locX - player.locX;
double deltaZ = this.locZ - player.locZ;
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
@ -59,7 +59,7 @@ index 7781babf51..50f6200095 100644
if (distanceSquared > viewDistance * viewDistance) {
double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
@@ -70,7 +81,7 @@ public class EntityLightning extends EntityWeather {
@@ -74,7 +85,7 @@ public class EntityLightning extends Entity {
}
}
// CraftBukkit end
@ -69,18 +69,18 @@ index 7781babf51..50f6200095 100644
--this.lifeTicks;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index e71a405807..53e7834cca 100644
index ffa5a0bee..6d8fb1290 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1065,7 +1065,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@@ -1183,7 +1183,7 @@ public class WorldServer extends World {
}
// CraftBukkit end
if (super.strikeLightning(entity)) {
- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, this, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit - Use dimension, // Paper - use world instead of dimension
+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, this.paperConfig.maxLightningFlashDistance, this, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit - Use dimension, // Paper - use world instead of dimension, limit lightning strike effect distance
return true;
} else {
return false;
this.globalEntityList.add(entitylightning);
- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, 512.0D, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension
+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, paperConfig.maxLightningFlashDistance, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension, limit lightning strike effect distance
}
@Override
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From a8c45fca2ef99f438a12b9ca59f9ca0ab03e86d0 Mon Sep 17 00:00:00 2001
From 6a7b1343bfcd0709f7f0a4ba2e6870809c55a138 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 17 Oct 2018 19:17:27 -0400
Subject: [PATCH] MC-50319: Check other worlds for shooter of projectiles
@ -11,10 +11,10 @@ If the projectile fails to find the shooter in the current world, check
other worlds.
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 62b5b6ecea..60ab1c7514 100644
index c19828ed5..7deeaa083 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -250,11 +250,21 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
@@ -213,11 +213,21 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
public EntityLiving getShooter() {
if (this.shooter == null && this.shooterId != null && this.world instanceof WorldServer) {
Entity entity = ((WorldServer) this.world).getEntity(this.shooterId);
@ -38,5 +38,5 @@ index 62b5b6ecea..60ab1c7514 100644
}
--
2.21.0
2.20.1

View File

@ -1,23 +1,23 @@
From d1b3dc4217aa68d0c522bb1f600ddebb54a191af Mon Sep 17 00:00:00 2001
From 0c13726aeda1ae50653ac107789455a2a9803a5c Mon Sep 17 00:00:00 2001
From: Caleb Bassham <caleb.bassham@gmail.com>
Date: Fri, 28 Sep 2018 02:32:19 -0500
Subject: [PATCH] Call player spectator target events
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 62feadc8af..f1b7353cf8 100644
index 634c30d93..d34daafda 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -59,7 +59,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private EntityHuman.EnumChatVisibility cs;
private boolean ct = true;
private long cu = SystemUtils.getMonotonicMillis();
private EnumChatVisibility ck;
private boolean cl = true;
private long cm = SystemUtils.getMonotonicMillis();
- private Entity spectatedEntity;
+ private Entity spectatedEntity; private void setSpectatorTargetField(Entity e) { this.spectatedEntity = e; } // Paper - OBFHELPER
public boolean worldChangeInvuln;
private boolean cx; private void setHasSeenCredits(boolean has) { this.cx = has; } // Paper - OBFHELPER
private boolean cp; private void setHasSeenCredits(boolean has) { this.cp = has; } // Paper - OBFHELPER
private final RecipeBookServer recipeBook;
@@ -1390,15 +1390,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1525,15 +1525,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return (Entity) (this.spectatedEntity == null ? this : this.spectatedEntity);
}
@ -57,7 +57,7 @@ index 62feadc8af..f1b7353cf8 100644
+ // Paper end
}
protected void E() {
@Override
--
2.21.0
2.20.1

View File

@ -1,4 +1,4 @@
From 5d4e0ebff8236bcee63ca414af432baff1681c40 Mon Sep 17 00:00:00 2001
From 98329c0298e555bd0b4bc87f00ac49c7bc210d85 Mon Sep 17 00:00:00 2001
From: Andrew Steinborn <git@steinborn.me>
Date: Mon, 8 Oct 2018 14:36:14 -0400
Subject: [PATCH] Add Velocity IP Forwarding Support
@ -14,7 +14,7 @@ forwarding, and is integrated into the Minecraft login process by using the 1.13
login plugin message packet.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index e4972e30ce..cac79686d8 100644
index 6a2eb12ba..ee282cb35 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -8,6 +8,7 @@ import java.io.IOException;
@ -25,7 +25,7 @@ index e4972e30ce..cac79686d8 100644
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -256,7 +257,7 @@ public class PaperConfig {
@@ -243,7 +244,7 @@ public class PaperConfig {
}
public static boolean isProxyOnlineMode() {
@ -34,7 +34,7 @@ index e4972e30ce..cac79686d8 100644
}
public static int packetInSpamThreshold = 300;
@@ -434,4 +435,18 @@ public class PaperConfig {
@@ -357,4 +358,18 @@ public class PaperConfig {
}
}
}
@ -55,7 +55,7 @@ index e4972e30ce..cac79686d8 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java
new file mode 100644
index 0000000000..fdd8708f97
index 000000000..fdd8708f9
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java
@@ -0,0 +1,67 @@
@ -127,10 +127,10 @@ index 0000000000..fdd8708f97
+ }
+}
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index c5801122dd..ca76f2a380 100644
index d4d752ddb..5d46a975e 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -42,6 +42,7 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -42,6 +42,7 @@ public class LoginListener implements PacketLoginInListener {
private SecretKey loginKey;
private EntityPlayer l;
public String hostname = ""; // CraftBukkit - add field
@ -138,9 +138,9 @@ index c5801122dd..ca76f2a380 100644
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.g = LoginListener.EnumProtocolState.HELLO;
@@ -186,6 +187,14 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -188,6 +189,14 @@ public class LoginListener implements PacketLoginInListener {
this.g = LoginListener.EnumProtocolState.KEY;
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.E().getPublic(), this.e));
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic(), this.e));
} else {
+ // Paper start - Velocity support
+ if (com.destroystokyo.paper.PaperConfig.velocitySupport) {
@ -153,7 +153,7 @@ index c5801122dd..ca76f2a380 100644
// Spigot start
// Paper start - Cache authenticator threads
authenticatorPool.execute(new Runnable() {
@@ -277,6 +286,12 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -280,6 +289,12 @@ public class LoginListener implements PacketLoginInListener {
public class LoginHandler {
public void fireEvents() throws Exception {
@ -166,7 +166,7 @@ index c5801122dd..ca76f2a380 100644
String playerName = i.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
java.util.UUID uniqueId = i.getId();
@@ -324,6 +339,35 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -327,6 +342,35 @@ public class LoginListener implements PacketLoginInListener {
// Spigot end
public void a(PacketLoginInCustomPayload packetloginincustompayload) {
@ -203,7 +203,7 @@ index c5801122dd..ca76f2a380 100644
}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 4c1110479c..c536979140 100644
index 6c5544807..38386d588 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -46,7 +46,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@ -216,23 +216,23 @@ index 4c1110479c..c536979140 100644
public java.util.UUID spoofedUUID;
public com.mojang.authlib.properties.Property[] spoofedProfile;
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
index b95836d443..621aad1503 100644
index fa2d3ce8c..dac560c63 100644
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
@@ -140,6 +140,7 @@ public class PacketDataSerializer extends ByteBuf {
return this.d(oenum.ordinal());
}
+ public int readVarInt() { return this.g(); } // Paper - OBFHELPER
public int g() {
+ public int readVarInt() { return i(); } // Paper - OBFHELPER
public int i() {
int i = 0;
int j = 0;
@@ -180,6 +181,7 @@ public class PacketDataSerializer extends ByteBuf {
return this;
}
+ public UUID readUUID() { return this.i(); } // Paper - OBFHELPER
public UUID i() {
+ public UUID readUUID() { return k(); } // Paper - OBFHELPER
public UUID k() {
return new UUID(this.readLong(), this.readLong());
}
@@ -298,6 +300,7 @@ public class PacketDataSerializer extends ByteBuf {
@ -241,10 +241,10 @@ index b95836d443..621aad1503 100644
+ public String readUTF(int maxLength) { return this.e(maxLength); } // Paper - OBFHELPER
public String e(int i) {
int j = this.g();
int j = this.i();
diff --git a/src/main/java/net/minecraft/server/PacketLoginInCustomPayload.java b/src/main/java/net/minecraft/server/PacketLoginInCustomPayload.java
index bdac03da43..430445cc6d 100644
index 4d1f44139..c1ca6f950 100644
--- a/src/main/java/net/minecraft/server/PacketLoginInCustomPayload.java
+++ b/src/main/java/net/minecraft/server/PacketLoginInCustomPayload.java
@@ -4,8 +4,8 @@ import java.io.IOException;
@ -259,7 +259,7 @@ index bdac03da43..430445cc6d 100644
public PacketLoginInCustomPayload() {}
diff --git a/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java b/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java
index 345843a7f2..23c96f44b3 100644
index ae74dc9e1..7eb230f1b 100644
--- a/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java
+++ b/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java
@@ -10,6 +10,14 @@ public class PacketLoginOutCustomPayload implements Packet<PacketLoginOutListene
@ -274,9 +274,9 @@ index 345843a7f2..23c96f44b3 100644
+ }
+ // Paper end
+
@Override
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.g();
this.b = packetdataserializer.l();
this.a = packetdataserializer.i();
--
2.21.0
2.20.1

View File

@ -1,11 +1,11 @@
From 3bbdc053fd65bd8f74f4886348e1833250a3a22b Mon Sep 17 00:00:00 2001
From 00346e25360ac12c7efe575695f6781ef3f9af20 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 12 Oct 2018 14:10:46 -0500
Subject: [PATCH] Add more Witch API
diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index feedfc9d9c..955e0e19b9 100644
index ae9efb72c..3cbb34a0c 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -1,5 +1,11 @@
@ -20,32 +20,32 @@ index feedfc9d9c..955e0e19b9 100644
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
@@ -8,9 +14,9 @@ import javax.annotation.Nullable;
public class EntityWitch extends EntityMonster implements IRangedEntity {
@@ -8,9 +14,9 @@ import java.util.function.Predicate;
public class EntityWitch extends EntityRaider implements IRangedEntity {
private static final UUID a = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E");
- private static final AttributeModifier b = (new AttributeModifier(EntityWitch.a, "Drinking speed penalty", -0.25D, 0)).a(false);
+ private static final AttributeModifier b = (new AttributeModifier(EntityWitch.a, "Drinking speed penalty", -0.25D, 0)).a(false); private static final AttributeModifier DRINKING_SPEED = b; // Paper - OBFHELPER
private static final DataWatcherObject<Boolean> c = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i);
- private int bC;
+ private int bC; public int getPotionUseTimeLeft() { return bC; } public void setPotionUseTimeLeft(int timeLeft) { bC = timeLeft; } // Paper - OBFHELPER
private static final UUID b = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E");
- private static final AttributeModifier bz = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false);
+ private static final AttributeModifier bz = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false); private static final AttributeModifier DRINKING_SPEED = bz; // Paper - OBFHELPER
private static final DataWatcherObject<Boolean> bA = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i);
- private int bB;
+ private int bB; public int getPotionUseTimeLeft() { return bB; } public void setPotionUseTimeLeft(int timeLeft) { bB = timeLeft; } // Paper - OBFHELPER
private PathfinderGoalNearestHealableRaider<EntityRaider> bC;
private PathfinderGoalNearestAttackableTargetWitch<EntityHuman> bD;
public EntityWitch(World world) {
super(EntityTypes.WITCH, world);
@@ -44,10 +50,12 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
@@ -56,10 +62,12 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
return SoundEffects.ENTITY_WITCH_DEATH;
}
+ public void setDrinkingPotion(boolean drinkingPotion) { a(drinkingPotion); } // Paper - OBFHELPER
public void a(boolean flag) {
this.getDataWatcher().set(EntityWitch.c, flag);
+ public void setDrinkingPotion(boolean drinkingPotion) { s(drinkingPotion); } // Paper - OBFHELPER
public void s(boolean flag) {
this.getDataWatcher().set(EntityWitch.bA, flag);
}
+ public boolean isDrinkingPotion() { return l(); } // Paper - OBFHELPER
public boolean l() {
return (Boolean) this.getDataWatcher().get(EntityWitch.c);
return (Boolean) this.getDataWatcher().get(EntityWitch.bA);
}
@@ -100,18 +108,17 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
@@ -121,18 +129,19 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
}
if (potionregistry != null) {
@ -54,27 +54,29 @@ index feedfc9d9c..955e0e19b9 100644
- org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
- this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack));
+ // Paper start - moved all this down into its own method
+ //this.setSlot(EnumItemSlot.MAINHAND, PotionUtil.a(new ItemStack(Items.POTION), potionregistry));
+ //this.bC = this.getItemInMainHand().k();
+ //this.a(true);
+ //this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_WITCH_DRINK, this.bV(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
+ //ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry);
+ //org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
+ //this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack));
+ //this.bB = this.getItemInMainHand().k();
+ //this.s(true);
+ //this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
+ //AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
+ //attributeinstance.c(EntityWitch.b);
+ //attributeinstance.b(EntityWitch.b);
+ //attributeinstance.c(EntityWitch.bz);
+ //attributeinstance.b(EntityWitch.bz);
+
+ setDrinkingPotion(PotionUtil.addPotionToItemStack(new ItemStack(Items.POTION), potionregistry));
// Paper end
- this.bC = this.getItemInMainHand().k();
- this.a(true);
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_WITCH_DRINK, this.bV(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
- this.bB = this.getItemInMainHand().k();
- this.s(true);
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
- AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
-
- attributeinstance.c(EntityWitch.b);
- attributeinstance.b(EntityWitch.b);
- attributeinstance.c(EntityWitch.bz);
- attributeinstance.b(EntityWitch.bz);
}
}
@@ -123,6 +130,18 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
@@ -144,6 +153,18 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
super.movementTick();
}
@ -90,28 +92,35 @@ index feedfc9d9c..955e0e19b9 100644
+ }
+ // Paper end
+
protected float applyMagicModifier(DamageSource damagesource, float f) {
f = super.applyMagicModifier(damagesource, f);
if (damagesource.getEntity() == this) {
@Override
public SoundEffect dW() {
return SoundEffects.ENTITY_WITCH_CELEBRATE;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
index f25998eb6d..ac465bda2e 100644
index 49e0f2206..d157d195d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
@@ -6,6 +6,13 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Witch;
import org.bukkit.entity.EntityType;
@@ -1,12 +1,18 @@
package org.bukkit.craftbukkit.entity;
-import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper
import net.minecraft.server.EntityWitch;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Witch;
+// Paper start
+import com.destroystokyo.paper.entity.CraftRangedEntity;
+import com.google.common.base.Preconditions;
+import org.bukkit.Material;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.inventory.ItemStack;
+// Paper end
+
public class CraftWitch extends CraftMonster implements Witch, CraftRangedEntity<EntityWitch> { // Paper
-public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity<EntityWitch> { // Paper
+public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity<EntityWitch> {
public CraftWitch(CraftServer server, EntityWitch entity) {
super(server, entity);
@@ -24,4 +31,23 @@ public class CraftWitch extends CraftMonster implements Witch, CraftRangedEntity
}
@@ -24,4 +30,23 @@ public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity<
public EntityType getType() {
return EntityType.WITCH;
}
@ -136,5 +145,5 @@ index f25998eb6d..ac465bda2e 100644
+ // Paper end
}
--
2.21.0
2.20.1

View File

@ -1,22 +1,22 @@
From a61ea1bde3ba2fca97d74e75926539f83e504f1a Mon Sep 17 00:00:00 2001
From 86e08f09cb0cd4d89a438048bff83a1af9fe398b Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 19 Oct 2018 19:38:45 -0500
Subject: [PATCH] Fix MC-93764
diff --git a/src/main/java/net/minecraft/server/WorldProviderTheEnd.java b/src/main/java/net/minecraft/server/WorldProviderTheEnd.java
index 99191f09f0..4d692b7e05 100644
index c25be1642..b323df98e 100644
--- a/src/main/java/net/minecraft/server/WorldProviderTheEnd.java
+++ b/src/main/java/net/minecraft/server/WorldProviderTheEnd.java
@@ -27,7 +27,7 @@ public class WorldProviderTheEnd extends WorldProvider {
}
@Override
public float a(long i, float f) {
- return 0.0F;
+ return 0.5F; // Paper - fix MC-93764
}
public boolean canRespawn() {
@Override
--
2.21.0
2.20.1