Update PaperSpigot to Minecraft 1.8

This commit is contained in:
Zach Brown
2014-11-27 17:17:45 -08:00
parent 0dc6acba77
commit a52eb21fd8
256 changed files with 5529 additions and 15301 deletions

View File

@@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 10 Jun 2014 18:22:19 -0500
Subject: [PATCH] Add 1.8 recipes for stone variants
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -0,0 +0,0 @@ public class CraftingManager {
this.registerShapelessRecipe(new ItemStack(Items.FIREBALL, 3), new Object[] { Items.SULPHUR, Items.BLAZE_POWDER, new ItemStack(Items.COAL, 1, 1)});
this.registerShapedRecipe(new ItemStack(Blocks.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Blocks.GLASS, Character.valueOf('Q'), Items.QUARTZ, Character.valueOf('W'), Blocks.WOOD_STEP});
this.registerShapedRecipe(new ItemStack(Blocks.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Items.IRON_INGOT, Character.valueOf('C'), Blocks.CHEST});
+ // PaperSpigot start - Register moss stone and mossy and chiseled stone brick recipes
+ this.registerShapelessRecipe(new ItemStack(Blocks.MOSSY_COBBLESTONE), new Object[] { Blocks.VINE, Blocks.COBBLESTONE});
+ this.registerShapelessRecipe(new ItemStack(Blocks.SMOOTH_BRICK, 1, 1), new Object[] { Blocks.VINE, Blocks.SMOOTH_BRICK});
+ this.registerShapelessRecipe(new ItemStack(Blocks.SMOOTH_BRICK, 1, 3), new Object[] { new ItemStack(Blocks.STEP, 1, 5), new ItemStack(Blocks.STEP, 1, 5)});
+ // PaperSpigot end
// Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below
this.sort(); // CraftBukkit - call new sort method
}
diff --git a/src/main/java/net/minecraft/server/RecipesFurnace.java b/src/main/java/net/minecraft/server/RecipesFurnace.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/RecipesFurnace.java
+++ b/src/main/java/net/minecraft/server/RecipesFurnace.java
@@ -0,0 +0,0 @@ public class RecipesFurnace {
this.registerRecipe(Blocks.EMERALD_ORE, new ItemStack(Items.EMERALD), 1.0F);
this.a(Items.POTATO, new ItemStack(Items.POTATO_BAKED), 0.35F);
this.registerRecipe(Blocks.NETHERRACK, new ItemStack(Items.NETHER_BRICK), 0.1F);
+ this.registerRecipe(Blocks.SMOOTH_BRICK, new ItemStack(Blocks.SMOOTH_BRICK, 1, 2), 0.5F); // PaperSpigot - Register cracked stone brick recipe
EnumFish[] aenumfish = EnumFish.values();
int i = aenumfish.length;
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Suddenly <suddenly@suddenly.coffee>
Date: Mon, 7 Jul 2014 04:11:34 +0100
Date: Fri, 28 Nov 2014 01:49:53 -0600
Subject: [PATCH] Add configurable despawn distances for living entities
@@ -17,37 +17,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.die();
}
- if (this.aU > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
+ if (this.aU > 600 && this.random.nextInt(800) == 0 && d3 > this.world.paperSpigotConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distances
- if (this.aO > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
+ if (this.aO > 600 && this.random.nextInt(800) == 0 && d3 > this.world.paperSpigotConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distances
this.die();
- } else if (d3 < 1024.0D) {
+ } else if (d3 < this.world.paperSpigotConfig.softDespawnDistance) { // PaperSpigot - custom despawn distances
this.aU = 0;
this.aO = 0;
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
private void blockGrowthHeight()
{
cactusMaxHeight = getInt( "max-growth-height.cactus", 3 );
- reedMaxHeight = getInt( "max-growth-height.reeds", 3 );
+ reedMaxHeight = getInt("max-growth-height.reeds", 3);
log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight);
}
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
blockBreakExhaustion = getFloat( "player-exhaustion.block-break", 0.025F );
playerSwimmingExhaustion = getFloat("player-exhaustion.swimming", 0.015F );
}
+
+ public Integer softDespawnDistance;
+ public Integer hardDespawnDistance;
+ public int softDespawnDistance;
+ public int hardDespawnDistance;
+ private void despawnDistances()
+ {
+ softDespawnDistance = getInt( "despawn-ranges.soft", 32 ); // 32^2 = 1024, Minecraft Default
+ hardDespawnDistance = getInt( "despawn-ranges.hard", 128 ); // 128^2 = 16384, Minecraft Default;
+
+ if ( softDespawnDistance > hardDespawnDistance)
+ {
+
+ if ( softDespawnDistance > hardDespawnDistance) {
+ softDespawnDistance = hardDespawnDistance;
+ }
+
+
+ log( "Living Entity Despawn Ranges: Soft: " + softDespawnDistance + " Hard: " + hardDespawnDistance );
+
+
+ softDespawnDistance = softDespawnDistance*softDespawnDistance;
+ hardDespawnDistance = hardDespawnDistance*hardDespawnDistance;
+ }

View File

@@ -1,9 +1,8 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dmck2b <itallhappenedverysuddenly@gmail.com>
Date: Thu, 10 Jul 2014 16:57:10 +0100
Date: Fri, 28 Nov 2014 01:53:14 -0600
Subject: [PATCH] Allow for toggling of spawn chunks
Now with 100% more confirmed working by creator
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@@ -16,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.keepSpawnInMemory = this.paperSpigotConfig.keepSpawnInMemory; // PaperSpigot
// Spigot start
this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 );
this.chunkTickList = new net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -25,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
softDespawnDistance = softDespawnDistance*softDespawnDistance;
hardDespawnDistance = hardDespawnDistance*hardDespawnDistance;
}
+
+
+ public boolean keepSpawnInMemory;
+ private void keepSpawnInMemory()
+ {

View File

@@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.world.methodProfiler.a("goalSelector");
+ this.goalSelector.a();
+ this.world.methodProfiler.c("jump");
+ this.bm.b();
+ this.g.b();
+ // PaperSpigot end
return;
}

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 5 Aug 2014 16:10:44 -0500
Date: Fri, 28 Nov 2014 00:08:37 -0600
Subject: [PATCH] Allow undead horse types to be leashed
@@ -11,18 +11,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
public boolean bM() {
- return !this.cE() && super.bM();
public boolean ca() {
- return !this.cP() && super.ca();
+ // PaperSpigot start - Configurable undead horse leashing
+ if (this.world.paperSpigotConfig.allowUndeadHorseLeashing) {
+ return super.bM();
+ return super.ca();
+ } else {
+ return !this.cE() && super.bM();
+ return !this.cP() && super.ca();
+ }
+ // PaperSpigot end
}
protected void o(float f) {
protected void n(float f) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java

View File

@@ -1,32 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Sat, 13 Sep 2014 02:23:56 -0700
Subject: [PATCH] Backwards compatible PacketPlayOutEntityTeleport constructor
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
@@ -0,0 +0,0 @@ public class PacketPlayOutEntityTeleport extends Packet {
this.heightCorrection = heightCorrection; // Spigot Update - 20140916a
}
+ /**
+ * PaperSpigot - Backwards compatible PacketPlayOutEntityTeleport contructor
+ */
+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround) {
+ this(i, j, k, l, b0, b1, onGround, false);
+ }
+
+ /**
+ * PaperSpigot - Backwards compatible PacketPlayOutEntityTeleport contructor
+ */
+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1) {
+ this(i, j, k, l, b0, b1, false, false);
+ }
+
public void a(PacketDataSerializer packetdataserializer) {
this.a = packetdataserializer.readInt();
this.b = packetdataserializer.readInt();
--

View File

@@ -1,68 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 8 Jul 2014 22:39:41 -0500
Subject: [PATCH] Better EULA handling
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -0,0 +0,0 @@ import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit; // PaperSpigot
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
i.info("Loading properties");
this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
- this.n = new EULA(new File("eula.txt"));
+ // PaperSpigot start - Display a EULA warning then continue
+ File EULALock = new File( ".eula-lock");
// Spigot Start
boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" );
if ( eulaAgreed )
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
System.err.println( "You have used the Spigot command line EULA agreement flag." );
System.err.println( "By using this setting you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula)." );
System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." );
- }
- // Spigot End
- if (!this.n.a() && !eulaAgreed) {
- i.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
- this.n.b();
- return false;
+ // Spigot End
} else {
+ if (!EULALock.exists()) {
+ System.err.println("WARNING: By using this server you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula)");
+ System.err.println("If you do not agree to the above EULA please stop this server and remove it from your system immediately.");
+ System.err.println("The server will start in 10 seconds, you will only see this message and have to wait this one time.");
+ try {
+ EULALock.createNewFile();
+ } catch (IOException e1) {
+ System.err.println("Unable to create EULA lock file");
+ e1.printStackTrace();
+ }
+ try {
+ Thread.sleep(TimeUnit.SECONDS.toMillis(10));
+ } catch (InterruptedException ex) {
+ }
+ }
+ // PaperSpigot end
if (this.N()) {
this.c("127.0.0.1");
} else {
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return true;
}
}
+ return true; // PaperSpigot
}
// CraftBukkit start
--

View File

@@ -1,9 +1,8 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Wed, 6 Aug 2014 18:17:41 -0500
Date: Fri, 28 Nov 2014 02:36:18 -0600
Subject: [PATCH] Center TNT grid sample points
More information at https://bugs.mojang.com/browse/MC-65697
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@@ -26,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
double d4 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) f1;
double d5 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) f2;
- if (this.a(vec3d2.b(d3, d4, d5), vec3d) == null) { // CraftBukkit
+ if (this.a(vec3d2.b(xOffset + d3, d4, zOffset + d5), vec3d) == null) { // CraftBukkit // PaperSpigot
- if (this.rayTrace(new Vec3D(d3, d4, d5), vec3d) == null) {
+ if (this.rayTrace(new Vec3D(xOffset, d4, zOffset + d5), vec3d) == null) { // PaperSpigot - Center TNT sample points
++i;
}

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 5 Aug 2014 17:18:23 -0500
Date: Fri, 28 Nov 2014 01:01:51 -0600
Subject: [PATCH] Configurable baby zombie movement speed
@@ -10,14 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
protected static final IAttribute bp = (new AttributeRanged("zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
private static final UUID bq = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
- private static final AttributeModifier br = new AttributeModifier(bq, "Baby speed boost", 0.5D, 1);
protected static final IAttribute b = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
private static final UUID c = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
- private static final AttributeModifier bk = new AttributeModifier(EntityZombie.c, "Baby speed boost", 0.5D, 1);
+ // PaperSpigot - Configurable baby zombie movement speed
+ private static final AttributeModifier br = new AttributeModifier(bq, "Baby speed boost", org.github.paperspigot.PaperSpigotConfig.babyZombieMovementSpeed, 1);
private final PathfinderGoalBreakDoor bs = new PathfinderGoalBreakDoor(this);
private int bt;
private boolean bu = false;
+ private static final AttributeModifier bk = new AttributeModifier(EntityZombie.c, "Baby speed boost", org.github.paperspigot.PaperSpigotConfig.babyZombieMovementSpeed, 1);
private final PathfinderGoalBreakDoor bl = new PathfinderGoalBreakDoor(this);
private int bm;
private boolean bn = false;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 5 Aug 2014 16:26:30 -0500
Date: Fri, 28 Nov 2014 00:55:17 -0600
Subject: [PATCH] Configurable cactus and reed natural growth heights
@@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
;
}
- if (l < 3) {
+ if (l < world.paperSpigotConfig.cactusMaxHeight) { // PaperSpigot - Configurable max growth height for cactus blocks
int i1 = world.getData(i, j, k);
- if (i < 3) {
+ if (i < world.paperSpigotConfig.cactusMaxHeight) { // PaperSpigot - Configurable max growth height for cactus blocks
int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue();
if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java
@@ -25,11 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
;
}
- if (l < 3) {
+ if (l < world.paperSpigotConfig.reedMaxHeight) { // PaperSpigot - Configurable max growth height for reed blocks
int i1 = world.getData(i, j, k);
- if (i < 3) {
+ if (i < world.paperSpigotConfig.reedMaxHeight) { // PaperSpigot - Configurable max growth height for reed blocks
int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue();
if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 5 Aug 2014 16:21:03 -0500
Date: Fri, 28 Nov 2014 00:45:14 -0600
Subject: [PATCH] Configurable damage multiplier for PvP blocking
@@ -8,9 +8,9 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
// CraftBukkit end
if (!this.isInvulnerable()) {
if (!this.isInvulnerable(damagesource)) {
if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) {
- f = (1.0F + f) * 0.5F;
+ f = (1.0F + f) * this.world.paperSpigotConfig.playerBlockingDamageMultiplier; // PaperSpigot - Configurable damage multiplier for blocking

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 5 Aug 2014 17:49:02 -0500
Date: Fri, 28 Nov 2014 01:29:35 -0600
Subject: [PATCH] Configurable fishing time ranges
@@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity {
this.az = MathHelper.nextInt(this.random, 20, 80);
this.av = MathHelper.nextInt(this.random, 20, 80);
}
} else {
- this.ay = MathHelper.nextInt(this.random, 100, 900);
- this.au = MathHelper.nextInt(this.random, 100, 900);
+ // PaperSpigot - Configurable fishing tick range
+ this.ay = MathHelper.nextInt(this.random, this.world.paperSpigotConfig.fishingMinTicks, this.world.paperSpigotConfig.fishingMaxTicks);
this.ay -= EnchantmentManager.getLureEnchantmentLevel(this.owner) * 20 * 5;
+ this.au = MathHelper.nextInt(this.random, this.world.paperSpigotConfig.fishingMinTicks, this.world.paperSpigotConfig.fishingMaxTicks);
this.au -= EnchantmentManager.h(this.owner) * 20 * 5;
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
invertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false );
log( "Inverted Redstone Lamps: " + invertedDaylightDetectors );
reedMaxHeight = getInt( "max-growth-height.reeds", 3 );
log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight);
}
+
+ public int fishingMinTicks;

View File

@@ -1,23 +1,9 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Fri, 24 Oct 2014 22:09:58 -0500
Date: Fri, 28 Nov 2014 13:53:48 -0600
Subject: [PATCH] Configurable game mechanics changes
diff --git a/src/main/java/net/minecraft/server/BlockTorch.java b/src/main/java/net/minecraft/server/BlockTorch.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockTorch.java
+++ b/src/main/java/net/minecraft/server/BlockTorch.java
@@ -0,0 +0,0 @@ public class BlockTorch extends Block {
} else {
Block block = world.getType(i, j, k);
- return block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL;
+ // PaperSpigot - Allow torch placement on stained glass as well
+ return world.paperSpigotConfig.lessPickyTorches ? block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.STAINED_GLASS || block == Blocks.COBBLE_WALL : block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
@@ -27,13 +13,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.die();
- for (k = 0; k < 3; ++k) {
- this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F);
- }
-
- for (k = 0; k < 2; ++k) {
- this.a(Items.STICK, 1, 0.0F);
- }
+ breakNaturally(); // PaperSpigot - Customizable boat drops
+ breakNaturally(); // PaperSpigot
}
// CraftBukkit end
}
@@ -41,21 +27,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!destroyEvent.isCancelled()) {
this.die();
- int l;
- int i;
-
- for (l = 0; l < 3; ++l) {
- this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
- for (i = 0; i < 3; ++i) {
- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F);
- }
-
- for (l = 0; l < 2; ++l) {
- for (i = 0; i < 2; ++i) {
- this.a(Items.STICK, 1, 0.0F);
- }
+ breakNaturally(); // PaperSpigot - Customizable boat drops
+ breakNaturally(); // PaperSpigot
}
// CraftBukkit end
}
@@ -0,0 +0,0 @@ public class EntityBoat extends Entity {
public int i() {
public int m() {
return this.datawatcher.getInt(18);
}
+
@@ -67,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.a(Items.BOAT, 1, 0.0F);
+ } else {
+ for (int k = 0; k < 3; ++k) {
+ this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
+ this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F);
+ }
+
+ for (int k = 0; k < 2; ++k) {

View File

@@ -1,45 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Sun, 3 Aug 2014 21:20:42 -0500
Date: Fri, 28 Nov 2014 02:31:02 -0600
Subject: [PATCH] Configurable speed for water flowing over lava
Basic info: http://hastebin.com/axuzaralas.vhdl
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids {
b0 = 2;
}
boolean flag = true;
- int i1 = this.a(world);
+ int i1 = this.getFlowSpeed(world, i, j, k); // PaperSpigot
int j1;
- int j = this.a(world);
+ int j = this.getFlowSpeed(world, blockposition); // PaperSpigot
int k;
if (l > 0) {
if (i > 0) {
@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids {
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (world.getType(i, j, k) == this) {
- world.a(i, j, k, this, this.a(world));
+ world.a(i, j, k, this, this.getFlowSpeed(world, i, j, k)); // PaperSpigot
}
}
public boolean L() {
return true;
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (!this.e(world, blockposition, iblockdata)) {
- world.a(blockposition, (Block) this, this.a(world));
+ world.a(blockposition, (Block) this, this.getFlowSpeed(world, blockposition)); // PaperSpigot
}
}
+
+ /**
+ * PaperSpigot - Get flow speed. Throttle if its water and flowing adjacent to lava
+ */
+ public int getFlowSpeed(World world, int x, int y, int z) {
+ public int getFlowSpeed(World world, BlockPosition blockposition) {
+ if (this.getMaterial() == Material.WATER && (
+ world.getType(x, y, z - 1).getMaterial() == Material.LAVA ||
+ world.getType(x, y, z + 1).getMaterial() == Material.LAVA ||
+ world.getType(x - 1, y, z).getMaterial() == Material.LAVA ||
+ world.getType(x + 1, y, z).getMaterial() == Material.LAVA)) {
+ // TODO: Double check that this does what I think it does
+ world.getType(blockposition.north(1)).getBlock().getMaterial() == Material.LAVA ||
+ world.getType(blockposition.south(1)).getBlock().getMaterial() == Material.LAVA ||
+ world.getType(blockposition.west(1)).getBlock().getMaterial() == Material.LAVA ||
+ world.getType(blockposition.east(1)).getBlock().getMaterial() == Material.LAVA)) {
+ return world.paperSpigotConfig.waterOverLavaFlowSpeed;
+ }
+ return super.a(world);
@@ -58,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private void waterOverLavaFlowSpeed()
+ {
+ waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 );
+ log( "Water over lava flow speed: " + waterOverLavaFlowSpeed);
+ log( "Water over lava flow speed: " + waterOverLavaFlowSpeed );
+ }
}
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 5 Aug 2014 16:17:15 -0500
Date: Fri, 28 Nov 2014 00:41:04 -0600
Subject: [PATCH] Configurable squid spawn ranges
@@ -11,12 +11,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntitySquid extends EntityWaterAnimal {
}
public boolean canSpawn() {
- return this.locY > 45.0D && this.locY < 63.0D && super.canSpawn();
+ // PaperSpigot - Configurable squid spawn height range
+ return this.locY > this.world.paperSpigotConfig.squidMinSpawnHeight && this.locY < this.world.paperSpigotConfig.squidMaxSpawnHeight && super.canSpawn();
public boolean bQ() {
- return this.locY > 45.0D && this.locY < 63.0D && super.bQ();
+ // PaperSpigot - Configurable squid spawn range
+ return this.locY > this.world.paperSpigotConfig.squidMinSpawnHeight && this.locY < this.world.paperSpigotConfig.squidMaxSpawnHeight && super.bQ();
}
}
public void b(float f, float f1, float f2) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sun, 31 Aug 2014 12:13:32 -0500
Date: Fri, 28 Nov 2014 12:23:02 -0600
Subject: [PATCH] Configurable strength and weakness effect modifiers
@@ -8,21 +8,13 @@ diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
+import org.github.paperspigot.PaperSpigotConfig;
+
public class MobEffectAttackDamage extends MobEffectList {
protected MobEffectAttackDamage(int i, boolean flag, int j) {
@@ -0,0 +0,0 @@ public class MobEffectAttackDamage extends MobEffectList {
}
public double a(int i, AttributeModifier attributemodifier) {
- return this.id == MobEffectList.WEAKNESS.id ? (double) (-0.5F * (float) (i + 1)) : 1.3D * (double) (i + 1);
+ // PaperSpigot - Configurable modifiers for strength and weakness effects
+ return this.id == MobEffectList.WEAKNESS.id ? (double) (PaperSpigotConfig.weaknessEffectModifier * (float) (i + 1)) : PaperSpigotConfig.strengthEffectModifier * (double) (i + 1);
+ return this.id == MobEffectList.WEAKNESS.id ? (double) (org.github.paperspigot.PaperSpigotConfig.weaknessEffectModifier * (float) (i + 1)) : org.github.paperspigot.PaperSpigotConfig.strengthEffectModifier * (double) (i + 1);
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: T00thpick1 <t00thpick1dirko@gmail.com>
Date: Mon, 23 Jun 2014 21:37:24 -0500
Date: Fri, 28 Nov 2014 01:25:45 -0600
Subject: [PATCH] Do not remove player in world change
@@ -9,21 +9,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList {
entityplayer.r().getTracker().untrackPlayer(entityplayer);
// entityplayer.r().getTracker().untrackEntity(entityplayer); // CraftBukkit
entityplayer.r().getPlayerChunkMap().removePlayer(entityplayer);
entityplayer.u().getTracker().untrackPlayer(entityplayer);
// entityplayer.u().getTracker().untrackEntity(entityplayer); // CraftBukkit
entityplayer.u().getPlayerChunkMap().removePlayer(entityplayer);
- this.players.remove(entityplayer);
+ // this.players.remove(entityplayer); // PaperSpigot -- Fixes BUKKIT-4561 and BUKKIT-4082 and BUKKIT-2094
+ // this.players.remove(entityplayer); // PaperSpigot - Fixes BUKKIT-4561, BUKKIT-4082, and BUKKIT-2094
this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer);
ChunkCoordinates chunkcoordinates = entityplayer.getBed();
BlockPosition blockposition = entityplayer.getBed();
boolean flag1 = entityplayer.isRespawnForced();
@@ -0,0 +0,0 @@ public abstract class PlayerList {
if (!entityplayer.playerConnection.isDisconnected()) {
worldserver.getPlayerChunkMap().addPlayer(entityplayer1);
worldserver.addEntity(entityplayer1);
- this.players.add(entityplayer1);
+ // this.players.add(entityplayer1); // PaperSpigot -- Fixes BUKKIT-4561 and BUKKIT-4082 and BUKKIT-2094
+ //this.players.add(entityplayer1); // PaperSpigot - Fixes BUKKIT-4561, BUKKIT-4082, and BUKKIT-2094
this.f.put(entityplayer1.getUniqueID(), entityplayer1);
}
// Added from changeDimension
this.updateClient(entityplayer1); // Update health, etc...
--

View File

@@ -1,7 +1,8 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 5 Aug 2014 18:39:57 -0500
Date: Fri, 28 Nov 2014 02:03:43 -0600
Subject: [PATCH] Drop falling block entities that are above the specified
height
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -9,14 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
++this.ticksLived;
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
+
+ // PaperSpigot start - Drop falling blocks above the specified height
+ if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) {
+ if (this.dropItem) {
+ this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F);
+ this.a(new ItemStack(block, 1, block.getDropData(this.block)), 0.0F);
+ }
+
+ this.die();

View File

@@ -1,76 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 22 Jul 2014 21:52:19 -0500
Subject: [PATCH] Fix random position generator tendency to move north west
Fixes mobs sticking to one side of pens and "migrating" to the north west constantly
Backported fix from 1.8
diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java
+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
@@ -0,0 +0,0 @@ public class RandomPositionGenerator {
private static Vec3D c(EntityCreature entitycreature, int i, int j, Vec3D vec3d) {
Random random = entitycreature.aI();
boolean flag = false;
- int k = 0;
- int l = 0;
- int i1 = 0;
+ // PaperSpigot start - int -> double
+ double k = 0;
+ double l = 0;
+ double i1 = 0;
+ // PaperSpigot end
float f = -99999.0F;
boolean flag1;
@@ -0,0 +0,0 @@ public class RandomPositionGenerator {
}
for (int j1 = 0; j1 < 10; ++j1) {
- int k1 = random.nextInt(2 * i) - i;
- int l1 = random.nextInt(2 * j) - j;
- int i2 = random.nextInt(2 * i) - i;
+ // PaperSpigot start - Even distribution and average of 0
+ int k1 = random.nextInt(2 * i + 1) - i;
+ int l1 = random.nextInt(2 * j + 1) - j;
+ int i2 = random.nextInt(2 * i + 1) - i;
+ // PaperSpigot end
if (vec3d == null || (double) k1 * vec3d.a + (double) i2 * vec3d.c >= 0.0D) {
- k1 += MathHelper.floor(entitycreature.locX);
- l1 += MathHelper.floor(entitycreature.locY);
- i2 += MathHelper.floor(entitycreature.locZ);
- if (!flag1 || entitycreature.b(k1, l1, i2)) {
- float f1 = entitycreature.a(k1, l1, i2);
+ // PaperSpigot start - Use truncated absolute destination position for checking things
+ int k1Mod = k1 + MathHelper.floor(entitycreature.locX);
+ int l1Mod = l1 + MathHelper.floor(entitycreature.locY);
+ int i2Mod = i2 + MathHelper.floor(entitycreature.locZ);
+ if (!flag1 || entitycreature.b(k1Mod, l1Mod, i2Mod)) {
+ float f1 = entitycreature.a(k1Mod, l1Mod, i2Mod);
if (f1 > f) {
f = f1;
- k = k1;
- l = l1;
- i1 = i2;
+ // but then the full value to set where to move
+ k = entitycreature.locX + k1;
+ l = entitycreature.locY + l1;
+ i1 = entitycreature.locZ + i2;
+ // PaperSpigot end
flag = true;
}
}
@@ -0,0 +0,0 @@ public class RandomPositionGenerator {
}
if (flag) {
- return Vec3D.a((double) k, (double) l, (double) i1);
+ return Vec3D.a(k, l, i1); // PaperSpigot remove unnecessary cast
} else {
return null;
}
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Thu, 12 Jun 2014 13:37:35 -0500
Date: Fri, 28 Nov 2014 01:21:27 -0600
Subject: [PATCH] Fix redstone lag issues
@@ -8,25 +8,23 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World {
if (i != this.M.size()) {
throw new IllegalStateException("TickNextTick list out of synch");
} else {
+ /* PaperSpigot start - Fix redstone lag issues
if (i > 1000) {
// CraftBukkit start - If the server has too much to process over time, try to alleviate that
if (i > 20 * 1000) {
@@ -0,0 +0,0 @@ public class WorldServer extends World {
i = 1000;
}
// CraftBukkit end
+ } */
+
+ if (i > 10000) {
+ i = 10000;
}
+ // PaperSpigot end
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
if (i != this.L.size()) {
throw new IllegalStateException("TickNextTick list out of synch");
} else {
+ // PaperSpigot start - Fix redstone lag issues
+ /*
if (i > 1000) {
// CraftBukkit start - If the server has too much to process over time, try to alleviate that
if (i > 20 * 1000) {
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
i = 1000;
}
// CraftBukkit end
- }
+ } */
+ // PaperSpigot end
this.methodProfiler.a("cleaning");
this.methodProfiler.a("cleaning");
--

View File

@@ -1,47 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 24 Jun 2014 22:55:30 -0500
Subject: [PATCH] Fix zombie sieges and their spawn mechanics
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -0,0 +0,0 @@ public class VillageSiege {
return;
}
}
+
+ // PaperSpigot start - Siege manager initial state is -1
+ if (this.c == -1) {
+ return;
+ }
+ // PaperSpigot end
}
if (!this.b) {
@@ -0,0 +0,0 @@ public class VillageSiege {
while (true) {
if (i < 10) {
- this.g = chunkcoordinates.x + (int) ((double) (MathHelper.cos(this.world.random.nextFloat() * 3.1415927F * 2.0F) * f) * 0.9D);
+ // PaperSpigot start - Zombies should spawn near the perimeter of the village not in the center of it
+ float angle = this.world.random.nextFloat() * (float) Math.PI * 2.0F;
+ this.g = chunkcoordinates.x + (int) ((double) (MathHelper.cos(angle) * f) * 0.9D);
this.h = chunkcoordinates.y;
- this.i = chunkcoordinates.z + (int) ((double) (MathHelper.sin(this.world.random.nextFloat() * 3.1415927F * 2.0F) * f) * 0.9D);
+ this.i = chunkcoordinates.z + (int) ((double) (MathHelper.sin(angle) * f) * 0.9D);
+ // PaperSpigot end
flag = false;
Iterator iterator1 = this.world.villages.getVillages().iterator();
@@ -0,0 +0,0 @@ public class VillageSiege {
// CraftBukkit - add Return
return Vec3D.a((double) i1, (double) j1, (double) k1);
}
+
}
return null;
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 19 Oct 2014 15:56:39 -0500
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Fri, 28 Nov 2014 12:48:26 -0600
Subject: [PATCH] Further improve server tick loop
Improves how the catchup buffer is handled, allowing it to roll both ways
@@ -15,7 +15,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
public org.bukkit.command.ConsoleCommandSender console;
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
public ConsoleReader reader;
@@ -32,9 +32,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public final double[] recentTps = new double[ 3 ];
- // Spigot end
public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet
net.minecraft.util.io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public MinecraftServer(OptionSet options, Proxy proxy, File file1) {
io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.isRunning = false;
}
@@ -49,8 +49,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
+ private static final int SAMPLE_INTERVAL = 20;
+ public final RollingAverage tps1 = new RollingAverage(60);
+ public final RollingAverage tps5 = new RollingAverage(60*5);
+ public final RollingAverage tps15 = new RollingAverage(60*15);
+ public final RollingAverage tps5 = new RollingAverage(60 * 5);
+ public final RollingAverage tps15 = new RollingAverage(60 * 15);
+
+ public static class RollingAverage {
+ private final int size;
@@ -74,11 +74,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public void add(double x, long t) {
+ time -= times[index];
+ total -= samples[index]*times[index];
+ total -= samples[index] * times[index];
+ samples[index] = x;
+ times[index] = t;
+ time += t;
+ total += x*t;
+ total += x * t;
+ if (++index == size) {
+ index = 0;
+ }
@@ -93,8 +93,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void run() {
try {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.a(this.q);
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.a(this.r);
// Spigot start
- Arrays.fill( recentTps, 20 );
@@ -132,15 +132,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 )
+ catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait);
+ // Paperspigot end
+
+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 ) // PaperSpigot - Further improve tick loop
+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 )
{
- double currentTps = 1E9 / ( curTime - tickSection ) * SAMPLE_INTERVAL;
- recentTps[0] = calcTps( recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min)
- recentTps[1] = calcTps( recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min)
- recentTps[2] = calcTps( recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min)
+ // PaperSpigot start - Further improve tick loop
+ final long diff = curTime - tickSection;
+ double currentTps = 1E9 / diff * SAMPLE_INTERVAL;
+ tps1.add(currentTps, diff);
@@ -156,8 +154,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
return org.spigotmc.SpigotConfig.config;
}
private final Spigot spigot = new Spigot()
{
+ // PaperSpigot start - Add getTPS (Further improve tick loop)
+ @Override
@@ -171,7 +169,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // PaperSpigot end
+
@Override
public void broadcast( BaseComponent component )
public YamlConfiguration getConfig()
{
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@@ -182,9 +180,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-import com.google.common.base.Joiner;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.util.com.google.common.collect.Iterables;
+import org.apache.commons.lang.StringUtils;
+import org.bukkit.Bukkit;
-import com.google.common.collect.Iterables;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -198,16 +194,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- sb.append( format( tps ) );
- sb.append( ", " );
+ // PaperSpigot start - Further improve tick handling
+ double[] tps = Bukkit.spigot().getTPS();
+ double[] tps = org.bukkit.Bukkit.spigot().getTPS();
+ String[] tpsAvg = new String[tps.length];
+
+ for ( int i = 0; i < tps.length; i++) {
+ tpsAvg[i] = format( tps[i] );
+ for ( int i = 0; i < tps.length; i++) {
+ tpsAvg[i] = format( tps[i] );
}
- sender.sendMessage( sb.substring( 0, sb.length() - 2 ) );
+
+ sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + StringUtils.join(tpsAvg, ", "));
+ // PaperSpigot end
+ sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", "));
return true;
}

View File

@@ -1,10 +1,9 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 19 Oct 2014 16:01:51 -0500
Date: Fri, 28 Nov 2014 13:12:00 -0600
Subject: [PATCH] Improve Network Manager packet handling
Removes an unnecessary "peek at head of queue", and also makes the number of packets
processed per player per tick configurable, so larger servers can slow down incoming processing.
Removes an unnecessary "peek at head of queue"
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@@ -12,46 +11,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
private void i() {
if (this.m != null && this.m.isOpen()) {
- while (!this.l.isEmpty()) {
- QueuedPacket queuedpacket = (QueuedPacket) this.l.poll();
private void m() {
if (this.i != null && this.i.isOpen()) {
- while (!this.h.isEmpty()) {
- QueuedPacket queuedpacket = (QueuedPacket) this.h.poll();
-
+ // PaperSpigot start - Improve Network Manager packet handling
+ QueuedPacket queuedpacket;
+ while ((queuedpacket = (QueuedPacket) this.l.poll()) != null) {
this.b(QueuedPacket.a(queuedpacket), QueuedPacket.b(queuedpacket));
}
+ // PaperSpigot end
}
}
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
}
if (this.o != null) {
- for (int i = 1000; !this.k.isEmpty() && i >= 0; --i) {
- Packet packet = (Packet) this.k.poll();
+ // PaperSpigot start - Improve Network Manager packet handling - Configurable packets per player per tick processing
+ Packet packet;
+ for (int i = org.github.paperspigot.PaperSpigotConfig.maxPacketsPerPlayer; (packet = (Packet) this.k.poll()) != null && i >= 0; --i) {
+ while ((queuedpacket = (QueuedPacket) this.h.poll()) != null) {
+ // PaperSpigot end
this.a(QueuedPacket.a(queuedpacket), QueuedPacket.b(queuedpacket));
}
// CraftBukkit start
if (!this.isConnected() || !this.m.config().isAutoRead()) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotConfig
strengthEffectModifier = getDouble( "effect-modifiers.strength", 1.3D );
weaknessEffectModifier = getDouble( "effect-modifiers.weakness", -0.5D );
}
+
+ public static int maxPacketsPerPlayer;
+ private static void maxPacketsPerPlayer()
+ {
+ maxPacketsPerPlayer = getInt( "max-packets-per-player", 1000 );
+ }
}
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 19 Oct 2014 16:30:48 -0500
Date: Fri, 28 Nov 2014 13:47:24 -0600
Subject: [PATCH] Improve autosave mechanism
Only save modified chunks, or chunks with entities after 4 auto save passes
@@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk {
if (this.o && this.world.getTime() != this.lastSaved || this.n) {
if (this.r && this.world.getTime() != this.lastSaved || this.q) {
return true;
}
- } else if (this.o && this.world.getTime() >= this.lastSaved + 600L) {
+ } else if (this.o && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // PaperSpigot - Only save if we've passed 2 auto save intervals without modification
- } else if (this.r && this.world.getTime() >= this.lastSaved + 600L) {
+ } else if (this.r && this.world.getTime() >= + MinecraftServer.getServer().autosavePeriod * 4) { // PaperSpigot - Only save if we've passed 2 auto save intervals without modification
return true;
}
@@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
// Spigot Start
// We replace this with saving each individual world as this.saveChunks(...) is broken,
// and causes the main thread to sleep for random amounts of time depending on chunk activity
@@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
world.savingDisabled = false;
- world.save(true, null);
+ world.save(forceSave, null); // PaperSpigot
+ world.save(forceSave, null);
world.savingDisabled = oldSave;
} catch (ExceptionWorldConflict ex) {

View File

@@ -1,62 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Tue, 5 Aug 2014 17:31:07 -0500
Subject: [PATCH] Inverted Daylight Detector Toggle
diff --git a/src/main/java/net/minecraft/server/BlockDaylightDetector.java b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockDaylightDetector.java
+++ b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
@@ -0,0 +0,0 @@ public class BlockDaylightDetector extends BlockContainer {
f += (6.2831855F - f) * 0.2F;
}
- i1 = Math.round((float) i1 * MathHelper.cos(f));
- if (i1 < 0) {
- i1 = 0;
- }
-
- if (i1 > 15) {
- i1 = 15;
+ // PaperSpigot start - Configurable "inversion" for daylight detectors
+ if (world.paperSpigotConfig.invertedDaylightDetectors) {
+ i1 = Math.round((float) i1 * MathHelper.cos(f) * -1 + 15);
+ if (i1 < 10) {
+ i1 = 0;
+ }
+
+ if (i1 > 9) {
+ i1 = 15;
+ }
+ } else {
+ i1 = Math.round((float) i1 * MathHelper.cos(f));
+ if (i1 < 0) {
+ i1 = 0;
+ }
+
+ if (i1 > 15) {
+ i1 = 15;
+ }
}
+ // PaperSpigot end
if (l != i1) {
i1 = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, i, j, k, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
reedMaxHeight = getInt( "max-growth-height.reeds", 3 );
log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight);
}
+
+ public boolean invertedDaylightDetectors;
+ private void invertedDaylightDetectors()
+ {
+ invertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false );
+ log( "Inverted Redstone Lamps: " + invertedDaylightDetectors );
+ }
}
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Mon, 21 Jul 2014 18:46:53 -0500
Date: Fri, 28 Nov 2014 00:35:56 -0600
Subject: [PATCH] Invisible players don't have rights
@@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile {
float f2;
float f3;
float f4;
+ // PaperSpigot start - Allow arrows to fly through players
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) {
@@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
if (movingobjectposition != null) {
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -40,16 +40,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // PaperSpigot end
+
if (movingobjectposition != null) {
if (movingobjectposition.type == EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.b, movingobjectposition.c, movingobjectposition.d) == Blocks.PORTAL) {
this.ah();
if (movingobjectposition.type == EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) {
this.aq();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
for (int i = 0; i < list.size(); ++i) {
Entity entity1 = (Entity) list.get(i);
+ // PaperSpigot start - Allow block placement if the placer cannot see the blocker
+ if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) {
+ if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) {
@@ -57,7 +57,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+ // PaperSpigot end
if (!entity1.dead && entity1.k && entity1 != entity) {
+
if (!entity1.dead && entity1.k && entity1 != entity && (entity == null || entity.vehicle != entity1 && entity.passenger != entity1)) {
return false;
}
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Mon, 11 Aug 2014 23:03:47 -0500
Date: Fri, 28 Nov 2014 11:56:55 -0600
Subject: [PATCH] Move sound handling out of the chest tick loop
This allows us to disable ticking chests and enderchests without any
@@ -10,140 +10,207 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye
this.n = this.m;
+
+ // PaperSpigot start - Move chest sound handling out of the tick loop
private ItemStack[] items = new ItemStack[27];
public boolean a;
- public TileEntityChest f;
- public TileEntityChest g;
- public TileEntityChest h;
- public TileEntityChest i;
- public float j;
+ public TileEntityChest f; // PaperSpigot - adjacentChestZNeg
+ public TileEntityChest g; // PaperSpigot - adjacentChestXPos
+ public TileEntityChest h; // PaperSpigot - adjacentChestXNeg
+ public TileEntityChest i; // PaperSpigot - adjacentChestZPos
+ public float j; // PaperSpigot - lidAngle
public float k;
- public int l;
+ public int l; // PaperSpigot - playersUsing
private int n;
private int o = -1;
private String p;
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye
}
public void c() {
+ // PaperSpigot start - Move chest sounds out of tick loop - TileEntity Tick Improvements
+ /*
f = 0.1F;
double d0;
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntity implements IInventory {
this.m = 0.0F;
this.m();
int i = this.position.getX();
int j = this.position.getY();
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye
this.j = 0.0F;
}
}
+ */
+ // PaperSpigot end
}
public boolean c(int i, int j) {
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntity implements IInventory {
if (this.world == null) return; // CraftBukkit
this.world.playBlockAction(this.x, this.y, this.z, this.q(), 1, this.o);
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye
+ // PaperSpigot start - Move chest open sound handling down to here
+ this.i();
+ double d0;
+
+ if (this.o > 0 && this.m == 0.0F && this.i == null && this.k == null) {
+ double d1 = (double) this.x + 0.5D;
+
+ d0 = (double) this.z + 0.5D;
+ if (this.l != null) {
+ d0 += 0.5D;
+ }
+
+ if (this.j != null) {
+ d1 += 0.5D;
+ }
+
+ this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+ // PaperSpigot end
+
// CraftBukkit start - Call redstone event
if (this.q() == Blocks.TRAPPED_CHEST) {
int newPower = Math.max(0, Math.min(15, this.o));
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntity implements IInventory {
++this.l;
if (this.world == null) return; // CraftBukkit
this.world.playBlockAction(this.x, this.y, this.z, this.q(), 1, this.o);
+ // PaperSpigot start - Move chest close sound handling down to here
+ this.i();
+ double d0;
+
+ if (this.o == 0 && this.i == null && this.k == null) {
+ d0 = (double) this.x + 0.5D;
+ double d2 = (double) this.z + 0.5D;
+ // PaperSpigot - Move chest open sound out of the tick loop
+ if (this.l > 1 && this.j == 0.0F && this.f == null && this.h == null) {
+ int locX = this.position.getX();
+ int locY = this.position.getY();
+ int locZ = this.position.getZ();
+
+ if (this.l != null) {
+ d2 += 0.5D;
+ }
+ double d0 = (double) locZ + 0.5D;
+ double d1 = (double) locX + 0.5D;
+
+ if (this.j != null) {
+ if (this.i != null) {
+ d0 += 0.5D;
+ }
+
+ this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ if (this.g != null) {
+ d1 += 0.5D;
+ }
+
+ this.world.makeSound(d1, (double) locY + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+
this.world.playBlockAction(this.position, this.w(), 1, this.l);
// CraftBukkit start - Call redstone event
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye
--this.l;
if (this.world == null) return; // CraftBukkit
+
+ // PaperSpigot start - Move chest close sound handling out of the tick loop
+ if (this.l == 0 && this.j > 0.0F || this.l > 0 && this.j < 1.0F) {
+ int locX = this.position.getX();
+ int locY = this.position.getY();
+ int locZ = this.position.getZ();
+ float f1 = this.j;
+
+ float f = 0.1F;
+
+ if (this.l > 0) {
+ this.j += f;
+ } else {
+ this.j -= f;
+ }
+
+ double d0 = (double) locX + 0.5D;
+ double d2 = (double) locZ + 0.5D;
+
+ if (this.i != null) {
+ d2 += 0.5D;
+ }
+
+ if (this.g != null) {
+ d0 += 0.5D;
+ }
+
+ this.world.makeSound(d0, (double) locY + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+
+ if (this.j < 0.0F) {
+ this.j = 0.0F;
+ }
+ }
+ // PaperSpigot end
+
this.world.playBlockAction(this.position, this.w(), 1, this.l);
// CraftBukkit start - Call redstone event
if (this.q() == Blocks.TRAPPED_CHEST) {
int newPower = Math.max(0, Math.min(15, this.o));
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity {
}
@@ -0,0 +0,0 @@ package net.minecraft.server;
this.i = this.a;
+
+ // PaperSpigot start - Move chest sound handling out of the tick loop
public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox {
- public float a;
+ public float a; // PaperSpigot - lidAngle
public float f;
- public int g;
+ public int g; // PaperSpigot - numPlayersUsing
private int h;
public TileEntityEnderChest() {}
public void c() {
+ // PaperSpigot - Move enderchest sound handling out of the tick loop
+ /*
float f = 0.1F;
double d0;
@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity {
if (++this.h % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis
this.a = 0.0F;
}
}
+ */
+ // PaperSpigot end
}
public boolean c(int i, int j) {
@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity {
public void a() {
++this.j;
this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
+
+ // PaperSpigot start - Move chest open sound handling down to here
+ double d0;
+
+ if (this.j > 0 && this.a == 0.0F) {
+ double d1 = (double) this.x + 0.5D;
+
+ d0 = (double) this.z + 0.5D;
+ this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+ // PaperSpigot end
}
@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis
public void b() {
--this.j;
this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
++this.g;
+
+ // PaperSpigot start - Move chest close sound handling down to here
+ float f = 0.1F;
+ double d0;
+ // PaperSpigot start - Move enderchest open sounds out of the tick loop
+ if (this.g > 0 && this.a == 0.0F) {
+ int locX = this.position.getX();
+ int locY = this.position.getY();
+ int locZ = this.position.getZ();
+
+ double d1 = (double) locX + 0.5D;
+ double d0 = (double) locZ + 0.5D;
+
+ this.world.makeSound(d1, (double) locY + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+
+ this.a = 0.7F;
+ }
+ // PaperSpigot end
+
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
public void d() {
--this.g;
+
+ // PaperSpigot start - Move enderchest close sounds out of the tick loop
+ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) {
+ int locX = this.position.getX();
+ int locY = this.position.getY();
+ int locZ = this.position.getZ();
+
+ float f = 0.1F;
+
+ if (this.g > 0) {
+ this.a += f;
+ } else {
+ this.a -= f;
+ }
+
+ if (this.a > 1.0F) {
+ this.a = 1.0F;
+ }
+
+ if (this.j == 0 && this.a == 0.0F || this.j > 0 && this.a < 1.0F) {
+ float f1 = this.a;
+ d0 = (double) this.x + 0.5D;
+ double d2 = (double) this.z + 0.5D;
+ float f2 = 0.5F;
+
+ this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ if (this.a < f2 && f1 >= f2) {
+ double d0 = (double) locX + 0.5D;
+ double d2 = (double) locZ + 0.5D;
+
+ this.world.makeSound(d0, (double) locY + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+
+ if (this.a < 0.0F) {
+ this.a = 0.0F;
+ }
+ }
+ // PaperSpigot end
+
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
public boolean a(EntityHuman entityhuman) {
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 19 Oct 2014 16:04:28 -0500
Date: Fri, 28 Nov 2014 13:20:22 -0600
Subject: [PATCH] Only refresh abilities if needed
@@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
@Override
public void setFlying(boolean value) {
+ boolean needsUpdate = getHandle().abilities.canFly != value; // PaperSpigot - Only refresh abilities if needed
if (!getAllowFlight() && value) {
@@ -22,5 +22,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (needsUpdate) getHandle().updateAbilities(); // PaperSpigot - Only refresh abilities if needed
}
public boolean getAllowFlight() {
@Override
--

View File

@@ -1,119 +1,119 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 24 Aug 2014 21:35:11 -0400
Date: Fri, 28 Nov 2014 04:14:14 -0600
Subject: [PATCH] Optimize TileEntity Ticking
Re-organizes the servers TileEntity Tick List to be bucketed based on their tick interval.
We now will not even store a Tile Entity that is known to not have any tick function
(half of them), skipping time spent iterating them and checking if they are valid
and in a loaded chunk. In other words, a lot of "meta" time wasted on tile entities
that would never do anything anyways.
Then by reducing chests to 1 in 20 ticks, we cut out 95% of isLoaded checks and findPlayer
calls on chests, and 100% of the checks for Signs, the 2 most popular Tile Entities.
This cuts out a massive amount of checks revolving around TileEntity ticking.
Servers with large amounts of TileEntities should see significant improvement.
Finally, this then spreads out the ticking of reduced-rate TileEntities so that they
do not all tick on the same tick, distributing the load of some TileEntities like Chest.
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -0,0 +0,0 @@ public class TileEntity {
}
}
@@ -0,0 +0,0 @@ public abstract class TileEntity {
}
+
+ // Optimized TileEntity Tick changes
// Spigot end
+ // PaperSpigot start - Optimized TileEntity Tick changes
+ private static int tileEntityCounter = 0;
+ public boolean isAdded = false;
+ public int tileId = tileEntityCounter++;
+ // PaperSpigot end
+
// Spigot end
public TileEntity() {}
public TileEntity() {
this.position = BlockPosition.ZERO;
this.h = -1;
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay
public TileEntityBeacon() {}
public void h() {
public void c() {
- if (this.world.getTime() % 80L == 0L) {
+ if (true || this.world.getTime() % 80L == 0L) { // PaperSpigot - controlled by Improved Tick handling
this.y();
this.x();
+ if (true || this.world.getTime() % 80L == 0L) { // PaperSpigot - controlled by Improved Tick Handling
this.m();
}
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntity implements IInventory {
++this.ticks;
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye
++this.n;
float f;
- if (!this.world.isStatic && this.o != 0 && (this.ticks + this.x + this.y + this.z) % 200 == 0) {
+ if (!this.world.isStatic && this.o != 0 && (this.ticks + this.x + this.y + this.z) % 10 == 0) { // PaperSpigot Reduced 200 -> 10 interval due to reduced tick rate from Improved Tick Handling
this.o = 0;
- if (!this.world.isStatic && this.l != 0 && (this.n + i + j + k) % 200 == 0) {
+ if (!this.world.isStatic && this.l != 0 && (this.n + i + j + k) % 10 == 0) { // PaperSpigot Reduced 200 -> 10 interval due to reduced tick rate from Improved Tick Handling
this.l = 0;
f = 5.0F;
List list = this.world.a(EntityHuman.class, AxisAlignedBB.a((double) ((float) this.x - f), (double) ((float) this.y - f), (double) ((float) this.z - f), (double) ((float) (this.x + 1) + f), (double) ((float) (this.y + 1) + f), (double) ((float) (this.z + 1) + f)));
List list = this.world.a(EntityHuman.class, new AxisAlignedBB((double) ((float) i - f), (double) ((float) j - f), (double) ((float) k - f), (double) ((float) (i + 1) + f), (double) ((float) (j + 1) + f), (double) ((float) (k + 1) + f)));
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity {
@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis
public TileEntityEnderChest() {}
public void h() {
super.h();
- if (++this.k % 20 * 4 == 0) {
+ if (++this.k % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling
this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
public void c() {
- if (++this.h % 20 * 4 == 0) {
+ if (++this.h % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntityLightDetector.java
+++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
@@ -0,0 +0,0 @@ public class TileEntityLightDetector extends TileEntity {
@@ -0,0 +0,0 @@ public class TileEntityLightDetector extends TileEntity implements IUpdatePlayer
public TileEntityLightDetector() {}
public void h() {
public void c() {
- if (this.world != null && !this.world.isStatic && this.world.getTime() % 20L == 0L) {
+ if (this.world != null && !this.world.isStatic /*&& this.world.getTime() % 20L == 0L*/) { // PaperSpigot - interval controlled by Improved Tick Handling
this.h = this.q();
if (this.h instanceof BlockDaylightDetector) {
((BlockDaylightDetector) this.h).e(this.world, this.x, this.y, this.z);
this.e = this.w();
if (this.e instanceof BlockDaylightDetector) {
((BlockDaylightDetector) this.e).d(this.world, this.position);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ package net.minecraft.server;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-import java.util.UUID;
+import java.util.*;
import java.util.concurrent.Callable;
// CraftBukkit start
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
};
// Spigot end
protected List f = new ArrayList();
- public Set tileEntityList = new HashSet(); // CraftBukkit - ArrayList -> HashSet
+ public Set tileEntityList = new org.spigotmc.WorldTileEntityList(this); // CraftBukkit - ArrayList -> HashSet
private List a = new ArrayList();
private List b = new ArrayList();
public List players = new ArrayList();
diff --git a/src/main/java/org/spigotmc/WorldTileEntityList.java b/src/main/java/org/spigotmc/WorldTileEntityList.java
protected final List g = Lists.newArrayList();
public final List h = Lists.newArrayList();
- public final List tileEntityList = Lists.newArrayList();
+ public final Set tileEntityList = new org.github.paperspigot.WorldTileEntityList(this); // PaperSpigot
private final List a = Lists.newArrayList();
private final List b = Lists.newArrayList();
public final List players = Lists.newArrayList();
diff --git a/src/main/java/org/github/paperspigot/WorldTileEntityList.java b/src/main/java/org/github/paperspigot/WorldTileEntityList.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/spigotmc/WorldTileEntityList.java
+++ b/src/main/java/org/github/paperspigot/WorldTileEntityList.java
@@ -0,0 +0,0 @@
+package org.spigotmc;
+package org.github.paperspigot;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Multimap;
+import net.minecraft.server.*;
+import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.map.hash.TObjectIntHashMap;
+
+import java.util.Collection;
+import java.util.HashSet;
@@ -122,39 +122,40 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+public class WorldTileEntityList extends HashSet<TileEntity> {
+ private static final TObjectIntHashMap<Class<? extends TileEntity>> tileEntityTickIntervals =
+ new TObjectIntHashMap<Class<? extends TileEntity>>() {{
+ // Use -1 for no ticking
+ // These TE's have empty tick methods, doing nothing. Never bother ticking them.
+ for (Class<? extends TileEntity> ignored : new Class[]{
+ TileEntityChest.class, // PaperSpigot - Don't tick chests either
+ TileEntityEnderChest.class, // PaperSpigot - Don't tick chests either
+ TileEntityRecordPlayer.class,
+ TileEntityDispenser.class,
+ TileEntityDropper.class,
+ TileEntitySign.class,
+ TileEntityNote.class,
+ TileEntityEnderPortal.class,
+ TileEntityCommand.class,
+ TileEntitySkull.class,
+ TileEntityComparator.class,
+ TileEntityFlowerPot.class
+ }) {
+ put(ignored, -1);
+ }
+ new TObjectIntHashMap<Class<? extends TileEntity>>() {{
+ // Use -1 for no ticking
+ // These TE's have empty tick methods, doing nothing. Never bother ticking them.
+ for (Class<? extends TileEntity> ignored : new Class[]{
+ TileEntityChest.class, // PaperSpigot - Don't tick chests either
+ TileEntityEnderChest.class, // PaperSpigot - Don't tick chests either
+ TileEntityRecordPlayer.class,
+ TileEntityDispenser.class,
+ TileEntityDropper.class,
+ TileEntitySign.class,
+ TileEntityNote.class,
+ TileEntityEnderPortal.class,
+ TileEntityCommand.class,
+ TileEntitySkull.class,
+ TileEntityComparator.class,
+ TileEntityFlowerPot.class
+ }) {
+ put(ignored, -1);
+ }
+
+ // does findPlayer lookup, so this helps performance to slow down
+ put(TileEntityEnchantTable.class, 20);
+ // does findPlayer lookup, so this helps performance to slow down
+ put(TileEntityEnchantTable.class, 20);
+
+ // Slow things down that players won't notice due to craftbukkit "wall time" patches.
+ // These need to be investigated further before they can be safely used here
+ //put(TileEntityFurnace.class, 20);
+ //put(TileEntityBrewingStand.class, 10);
+ // Slow things down that players won't notice due to craftbukkit "wall time" patches.
+ // These need to be investigated further before they can be safely used here
+ //put(TileEntityFurnace.class, 20);
+ //put(TileEntityBrewingStand.class, 10);
+
+ // Vanilla controlled values - These are checks already done in vanilla, so don't tick on ticks we know
+ // won't do anything anyways
+ put(TileEntityBeacon.class, 80);
+ put(TileEntityLightDetector.class, 20);
+ }};
+
+ // Vanilla controlled values - These are checks already done in vanilla, so don't tick on ticks we know
+ // won't do anything anyways
+ put(TileEntityBeacon.class, 80);
+ put(TileEntityLightDetector.class, 20);
+ }};
+ private static int getInterval(Class<? extends TileEntity> cls) {
+ int tickInterval = tileEntityTickIntervals.get(cls);
+ return tickInterval != 0 ? tickInterval : 1;
@@ -281,4 +282,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+}
\ No newline at end of file
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Mon, 21 Jul 2014 15:36:01 -0500
Date: Thu, 27 Nov 2014 22:43:08 -0800
Subject: [PATCH] POM changes
@@ -17,11 +17,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ <groupId>org.github.paperspigot</groupId>
+ <artifactId>paperspigot</artifactId>
<packaging>jar</packaging>
<version>1.7.10-R0.1-SNAPSHOT</version>
<version>1.8-R0.1-SNAPSHOT</version>
- <name>Spigot</name>
- <url>http://www.spigotmc.org</url>
+ <name>PaperSpigot</name>
+ <url>https://github.com/PaperSpigot/Spigot</url>
+ <url>https://github.com/PaperSpigot/Paper</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -47,13 +47,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.spigotmc</groupId>
+ <groupId>org.github.paperspigot</groupId>
<artifactId>minecraft-server</artifactId>
<version>${minecraft.version}-SNAPSHOT</version>
<type>jar</type>
@@ -0,0 +0,0 @@
<artifactId>gitdescribe-maven-plugin</artifactId>
<version>1.3</version>

View File

@@ -15,27 +15,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // PaperSpigot start
+ org.github.paperspigot.PaperSpigotConfig.init();
+ org.github.paperspigot.PaperSpigotConfig.registerCommands();
+ // PaperSpigot stop
+ // PaperSpigot end
i.info("Generating keypair");
DedicatedServer.LOGGER.info("Generating keypair");
this.a(MinecraftEncryption.b());
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
public boolean keepSpawnInMemory = true;
public ChunkGenerator generator;
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
+ public final org.github.paperspigot.PaperSpigotWorldConfig paperSpigotConfig; // PaperSpigot
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
+ public final org.github.paperspigot.PaperSpigotWorldConfig paperSpigotConfig; // PaperSpigot
+
public final SpigotTimings.WorldTimingsHandler timings; // Spigot
public CraftWorld getWorld() {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
// Changed signature - added gen and env
public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( s ); // Spigot
+ this.paperSpigotConfig = new org.github.paperspigot.PaperSpigotWorldConfig( s ); // PaperSpigot
protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
+ this.paperSpigotConfig = new org.github.paperspigot.PaperSpigotWorldConfig( worlddata.getName() ); // PaperSpigot
this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
@@ -49,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
org.spigotmc.SpigotConfig.init(); // Spigot
+ org.github.paperspigot.PaperSpigotConfig.init(); // PaperSpigot
for (WorldServer world : console.worlds) {
world.difficulty = difficulty;
world.worldData.setDifficulty(difficulty);
world.setSpawnFlags(monsters, animals);
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns();

View File

@@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sun, 21 Sep 2014 22:10:16 -0500
Subject: [PATCH] PaperSpigot protocol warning
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -0,0 +0,0 @@ public class Main {
}
}
- System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n"
+ System.err.println( "This PaperSpigot build only supports Minecraft 1.7.x and 1.8.x clients!\n"
+ "*** It is imperative that backups be taken before running this build on your server! ***\n"
- + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n"
- + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" );
+ + "Please report issues directly to Paper, and always ensure you're up-to-date!\n"
+ + "*** Any bug reports not running the very latest version of the software will be ignored ***\n\n" );
// Spigot end
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Sun, 17 Aug 2014 16:40:54 -0500
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Fri, 28 Nov 2014 01:41:54 -0600
Subject: [PATCH] Player Exhaustion Multipliers
@@ -10,32 +10,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -0,0 +0,0 @@ public class Block {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.MINE_BLOCK_COUNT[getId(this)], 1);
public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity) {
entityhuman.b(StatisticList.MINE_BLOCK_COUNT[getId(this)]);
- entityhuman.applyExhaustion(0.025F);
+ entityhuman.applyExhaustion(world.paperSpigotConfig.blockBreakExhaustion); // PaperSpigot - Configurable block break exhaustion
if (this.E() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.j(l);
if (this.G() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.i(iblockdata);
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
this.a(StatisticList.p, i);
- this.applyExhaustion(0.015F * (float) i * 0.01F);
+ this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming exhaustion
}
} else if (this.M()) {
} else if (this.V()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.i, i);
this.a(StatisticList.l, i);
- this.applyExhaustion(0.015F * (float) i * 0.01F);
+ this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming (diving) exhaustion
}
} else if (this.h_()) {
} else if (this.j_()) {
if (d1 > 0.0D) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sun, 21 Sep 2014 22:02:02 -0500
Date: Fri, 28 Nov 2014 03:31:21 -0600
Subject: [PATCH] Player affects spawning API
@@ -8,24 +8,24 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public boolean sleeping; // protected -> public
public boolean fauxSleeping;
public String spawnWorld = "";
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
private final GameProfile bF;
private boolean bG = false;
public EntityFishingHook hookedFish;
+ public boolean affectsSpawning = true; // PaperSpigot
@Override
public CraftHumanEntity getBukkitEntity() {
// CraftBukkit start
public boolean fauxSleeping;
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
if (this.persistent) {
this.aU = 0;
this.aO = 0;
} else {
- EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
+ EntityHuman entityhuman = this.world.findNearbyPlayerWhoAffectsSpawning(this, -1.0D); // PaperSpigot
+ EntityHuman entityhuman = this.world.findNearbyPlayerWhoAffectsSpawning(this, -1.0D); // PaperSpigot - Affects Spawning API
if (entityhuman != null) {
double d0 = entityhuman.locX - this.locX;
@@ -34,47 +34,87 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
private boolean g() {
BlockPosition blockposition = this.b();
- return this.a().isPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange);
+ // PaperSpigot - Affects Spawning API
+ return this.a().isPlayerNearbyWhoAffectsSpawning((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange);
}
public boolean f() {
- return this.a().findNearbyPlayer((double) this.b() + 0.5D, (double) this.c() + 0.5D, (double) this.d() + 0.5D, (double) this.requiredPlayerRange) != null;
+ return this.a().findNearbyPlayerWhoAffectsSpawning((double) this.b() + 0.5D, (double) this.c() + 0.5D, (double) this.d() + 0.5D, (double) this.requiredPlayerRange) != null; // PaperSpigot
}
public void g() {
public void c() {
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
while (iterator.hasNext()) {
EntityHuman entityhuman = (EntityHuman) iterator.next();
for (i = 0; i < worldserver.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) worldserver.players.get(i);
+ // PaperSpigot start - Affects spawning API
+ if (!entityhuman.affectsSpawning)
+ continue;
+ // PaperSpigot end
int k = MathHelper.floor(entityhuman.locX / 16.0D);
- if (!entityhuman.v()) {
+ if (!entityhuman.v() || !entityhuman.affectsSpawning) { // PaperSpigot
int l = MathHelper.floor(entityhuman.locX / 16.0D);
j = MathHelper.floor(entityhuman.locZ / 16.0D);
j = MathHelper.floor(entityhuman.locZ / 16.0D);
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
float f1 = (float) i3;
float f2 = (float) j3 + 0.5F;
float f = (float) j3 + 0.5F;
float f1 = (float) l3 + 0.5F;
- if (worldserver.findNearbyPlayer((double) f, (double) f1, (double) f2, 24.0D) == null) {
+ if (worldserver.findNearbyPlayerWhoAffectsSpawning((double) f, (double) f1, (double) f2, 24.0D) == null) { // PaperSpigot
float f3 = f - (float) chunkcoordinates.x;
float f4 = f1 - (float) chunkcoordinates.y;
float f5 = f2 - (float) chunkcoordinates.z;
- if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.c((double) f, (double) k3, (double) f1) >= 576.0D) {
+ // PaperSpigot - Affects Spawning API
+ if (!worldserver.isPlayerNearbyWhoAffectsSpawning((double) f, (double) k3, (double) f1, 24.0D) && blockposition.c((double) f, (double) k3, (double) f1) >= 576.0D) {
if (biomemeta == null) {
biomemeta = worldserver.a(enumcreaturetype, blockposition2);
if (biomemeta == null) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ package net.minecraft.server;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
-import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
@@ -0,0 +0,0 @@ import java.util.concurrent.Callable;
import org.bukkit.Bukkit;
import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
-import org.bukkit.craftbukkit.util.LongHashSet;
import org.bukkit.craftbukkit.SpigotTimings; // Spigot
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.craftbukkit.CraftServer;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
return entityhuman;
return false;
}
+ // PaperSpigot start - Find players with the spawning flag
+ // PaperSpigot start - Affects spawning API
+ public boolean isPlayerNearbyWhoAffectsSpawning(double d0, double d1, double d2, double d3) {
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityHuman entityhuman = (EntityHuman) this.players.get(i);
+
+ if (IEntitySelector.d.apply(entityhuman)) {
+ double d4 = entityhuman.e(d0, d1, d2);
+
+ if (d3 < 0.0D || d4 < d3 * d3 && entityhuman.affectsSpawning) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public EntityHuman findNearbyPlayerWhoAffectsSpawning(Entity entity, double radius) {
+ return this.findNearbyPlayerWhoAffectsSpawning(entity.locX, entity.locY, entity.locZ, radius);
+ }
@@ -110,8 +150,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
packet.components = components;
getHandle().playerConnection.sendPacket( packet );
return java.util.Collections.unmodifiableSet( ret );
}
+
+ // PaperSpigot start - Add affects spawning API
@@ -123,7 +163,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return getHandle().affectsSpawning;
+ }
+ // PaperSpigot end
+
};
public Player.Spigot spigot()

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 19 Oct 2014 16:26:55 -0500
Date: Fri, 28 Nov 2014 13:43:11 -0600
Subject: [PATCH] Player lookup improvements
Minecraft and CraftBukkit both use Arrays to store online players,
@@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList {
private static final SimpleDateFormat h = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
private static final SimpleDateFormat i = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
private final MinecraftServer server;
public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety
+ // PaperSpigot start - Player lookup improvements
@@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public EntityPlayer get(Object key) {
+ // put the .playerConnection check done in other places here
+ EntityPlayer player = super.get(key instanceof String ? ((String)key).toLowerCase() : key);
+ EntityPlayer player = super.get(key instanceof String ? ((String) key).toLowerCase() : key);
+ return (player != null && player.playerConnection != null) ? player : null;
+ }
+
@@ -41,44 +41,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public EntityPlayer remove(Object key) {
+ return super.remove(key instanceof String ? ((String)key).toLowerCase() : key);
+ return super.remove(key instanceof String ? ((String) key).toLowerCase() : key);
+ }
+ };
+ public final Map<UUID, EntityPlayer> uuidMap = new java.util.HashMap<UUID, EntityPlayer>() {
+ @Override
+ public EntityPlayer get(Object key) {
+ // put the .playerConnection check done in other places here
+ EntityPlayer player = super.get(key instanceof String ? ((String)key).toLowerCase() : key);
+ EntityPlayer player = super.get(key instanceof String ? ((String) key).toLowerCase() : key);
+ return (player != null && player.playerConnection != null) ? player : null;
+ }
+ };
+ // PaperSpigot end
private final GameProfileBanList j;
private final IpBanList k;
private final OpList operators;
public final Map f = Maps.newHashMap();
private final GameProfileBanList k;
private final IpBanList l;
@@ -0,0 +0,0 @@ public abstract class PlayerList {
cserver.detectListNameConflict(entityplayer); // CraftBukkit
// this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, 1000)); // CraftBukkit - replaced with loop below
public void onPlayerJoin(EntityPlayer entityplayer) {
this.players.add(entityplayer);
+ this.playerMap.put(entityplayer.getName(), entityplayer); // PaperSpigot
+ this.uuidMap.put(entityplayer.getUniqueID(), entityplayer); // PaperSpigot
this.f.put(entityplayer.getUniqueID(), entityplayer);
// this.sendAll(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer})); // CraftBukkit - replaced with loop below
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
// CraftBukkit start
@@ -0,0 +0,0 @@ public abstract class PlayerList {
worldserver.kill(entityplayer);
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
this.players.remove(entityplayer);
+ this.uuidMap.remove(entityplayer.getUniqueID()); // PaperSpigot
+ this.playerMap.remove(entityplayer.getName()); // PaperSpigot
this.n.remove(entityplayer.getUniqueID());
ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); // CraftBukkit
this.f.remove(entityplayer.getUniqueID());
this.o.remove(entityplayer.getUniqueID());
// CraftBukkit start
@@ -0,0 +0,0 @@ public abstract class PlayerList {
EntityPlayer entityplayer;
+ /* // PaperSpigot start - Use exact lookup below
+ // PaperSpigot - Use exact lookup below
+ /*
for (int i = 0; i < this.players.size(); ++i) {
entityplayer = (EntityPlayer) this.players.get(i);
if (entityplayer.getUniqueID().equals(uuid)) {
@@ -88,7 +89,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entityplayer = (EntityPlayer) iterator.next();
+ */
+ if ((entityplayer = uuidMap.get(uuid)) != null) {
+ // PaperSpigot end
entityplayer.playerConnection.disconnect("You logged in from another location");
}
@@ -142,11 +142,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int delta = Integer.MAX_VALUE;
for (Player player : getOnlinePlayers()) {
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
@Override
@Deprecated
public Player getPlayerExact(String name) {
- Validate.notNull(name, "Name cannot be null");
-
Validate.notNull(name, "Name cannot be null");
- String lname = name.toLowerCase();
-
- for (Player player : getOnlinePlayers()) {
@@ -159,10 +157,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // PaperSpigot start - Improved player lookup, replace whole method
+ EntityPlayer player = playerList.playerMap.get(name);
+ return player != null ? player.getBukkitEntity() : null;
+ // PaperSpigot end
+ // PaperSpigot end
}
// TODO: In 1.8+ this should use the server's UUID->EntityPlayer map
@Override
public Player getPlayer(UUID id) {
- for (Player player : getOnlinePlayers()) {
- if (player.getUniqueId().equals(id)) {
- return player;
- }
- }
-
- return null;
+ // PaperSpigot start - Improved player lookup, replace whole method
+ EntityPlayer player = playerList.uuidMap.get(id);
+ return player != null ? player.getBukkitEntity() : null;
+ // PaperSpigot end
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 19 Aug 2014 14:51:28 -0500
Date: Fri, 28 Nov 2014 03:43:14 -0600
Subject: [PATCH] Remove invalid mob spawner tile entities
@@ -14,19 +14,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Spigot end
+ // PaperSpigot start - Remove invalid mob spawner Tile Entities
+ } else if (this.world.paperSpigotConfig.removeInvalidMobSpawnerTEs && tileentity instanceof TileEntityMobSpawner &&
+ org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(i, j, k)) != org.bukkit.Material.MOB_SPAWNER) {
+ this.tileEntities.remove(chunkposition);
+ org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) != org.bukkit.Material.MOB_SPAWNER) {
+ this.tileEntities.remove(blockposition);
+ // PaperSpigot end
// CraftBukkit start
} else {
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 );
log( "Water over lava flow speed: " + waterOverLavaFlowSpeed);
log( "Water over lava flow speed: " + waterOverLavaFlowSpeed );
}
+
+ public boolean removeInvalidMobSpawnerTEs;

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Fri, 29 Aug 2014 20:33:52 -0500
Date: Fri, 28 Nov 2014 12:11:03 -0600
Subject: [PATCH] Remove specific entities that fly through an unloaded chunk
@@ -8,8 +8,8 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity {
public EnumEntitySize as;
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
private final CommandObjectiveExecutor as;
public boolean valid; // CraftBukkit
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
+ public boolean inUnloadedChunk = false; // PaperSpigot - Remove entities in unloaded chunks
@@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
@@ -0,0 +0,0 @@ public class EntityEnderPearl extends EntityProjectile {
movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0.0F);
movingobjectposition.entity.damageEntity(DamageSource.projectile(this, entityliving), 0.0F);
}
+ // PaperSpigot start - Remove entities in unloaded chunks
@@ -31,24 +31,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // PaperSpigot end
+
for (int i = 0; i < 32; ++i) {
this.world.addParticle("portal", this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian());
this.world.addParticle(EnumParticle.PORTAL, this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian(), new int[0]);
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
++this.ticksLived;
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
+ // PaperSpigot start - Remove entities in unloaded chunks
+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedFallingBlocks) {
+ this.die();
+ }
+ // PaperSpigot end
+
// PaperSpigot start - Drop falling blocks above the specified height
if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) {
if (this.dropItem) {
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -57,12 +58,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.lastZ = this.locZ;
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
+
+ // PaperSpigot start - Remove entities in unloaded chunks
+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedTNTEntities) {
+ this.die();
+ this.fuseTicks = 2;
+ }
+ // PaperSpigot end
+
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
@@ -72,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
{
if ( !this.isChunkLoaded( chunkx, chunkz ) )
if ( !this.isChunkLoaded( chunkx, chunkz, true ) )
{
+ entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks
continue;
@@ -83,10 +86,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entity.ticksLived++;
entity.inactiveTick();
+ // PaperSpigot start - Remove entities in unloaded chunks
+ if (entity instanceof EntityEnderPearl || (!this.isChunkLoaded(i, j) &&
+ if (entity instanceof EntityEnderPearl || (!this.isChunkLoaded(i, j, true) &&
+ (entity instanceof EntityFallingBlock && this.paperSpigotConfig.removeUnloadedFallingBlocks) ||
+ (entity instanceof EntityTNTPrimed && this.paperSpigotConfig.removeUnloadedTNTEntities))) {
+ entity.inUnloadedChunk = true;
+ entity.inUnloadedChunk = true;
+ entity.die();
+ }
+ // PaperSpigot end

View File

@@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
}
public String getServerModName() {

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 17 May 2014 02:12:39 -0500
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Fri, 28 Nov 2014 00:24:18 -0600
Subject: [PATCH] Teleport passenger/vehicle with player
@@ -8,22 +8,22 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity {
static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
+ // PaperSpigot start
// CraftBukikt end
+ // PaperSpigot start - Teleport passenger vehicle with player
+ public void retrack() {
+ final EntityTracker entityTracker = ((WorldServer) world).getTracker();
+ entityTracker.untrackEntity(this);
+ entityTracker.track(this);
+ }
+ // PaperSpigot end
// CraftBukkit end
private static final AxisAlignedBB a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
private static int entityCount;
@@ -0,0 +0,0 @@ public abstract class Entity {
// minecraftserver.getPlayerList().a(this, j, worldserver, worldserver1);
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
// minecraftserver.getPlayerList().changeWorld(this, j, worldserver, worldserver1);
boolean before = worldserver1.chunkProviderServer.forceChunkLoad;
worldserver1.chunkProviderServer.forceChunkLoad = true;
- worldserver1.getMinecraftServer().getPlayerList().repositionEntity(this, exit, portal);
@@ -31,17 +31,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
worldserver1.chunkProviderServer.forceChunkLoad = before;
// CraftBukkit end
this.world.methodProfiler.c("reloading");
@@ -0,0 +0,0 @@ public abstract class Entity {
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
if (entity != null) {
entity.a(this, true);
entity.n(this);
+ // PaperSpigot start - move entity to new location
+ exit.getBlock(); // force load
+ entity.setLocation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch());
+ // PaperSpigot end
/* CraftBukkit start - We need to do this...
if (j == 1 && i == 1) {
ChunkCoordinates chunkcoordinates = worldserver1.getSpawn();
BlockPosition blockposition = this.world.r(worldserver1.getSpawn());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ vehicle.teleportTo(location, false);
+ vehicle = vehicle.getBukkitEntity().getHandle();
+ entity.vehicle = vehicle;
+ vehicle.passenger = entity;
+ entity.passenger = entity;
+ }
+
+ if (passenger != null) {
@@ -81,12 +81,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // PaperSpigot start
+ if (vehicle != null) {
+ vehicle.retrack();
+ //entity.retrack();
+ }
+
+ if (passenger != null) {
+ passenger.retrack();
+ }
+ // PaperSpigot end
+
return true;
}

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dmck2b <suddenly@suddenly.coffee>
Date: Sun, 31 Aug 2014 18:12:10 +0100
Date: Fri, 28 Nov 2014 12:30:47 -0600
Subject: [PATCH] Temporary fix for rails dupe
@@ -12,15 +12,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
if (flag) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
- world.setAir(i, j, k);
- this.b(world, blockposition, iblockdata, 0);
- world.setAir(blockposition);
+ // PaperSpigot start - Rails dupe workaround
+ if (world.getType(i, j, k).getMaterial() != Material.AIR) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
+ world.setAir(i, j, k);
+ if (world.getType(blockposition).getBlock().getMaterial() != Material.AIR) {
+ this.b(world, blockposition, iblockdata, 0);
+ world.setAir(blockposition);
+ }
+ // PaperSpigot end
} else {
this.a(world, i, j, k, l, i1, block);
this.b(world, blockposition, iblockdata, block);
}
--

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 5 Aug 2014 17:56:02 -0500
Date: Fri, 28 Nov 2014 01:33:25 -0600
Subject: [PATCH] Toggle for player interact limiter
@@ -8,9 +8,9 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener {
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u());
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
boolean throttled = false;
- if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
+ // PaperSpigot - Allow disabling the player interaction limiter

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 22 Jul 2014 21:05:53 -0500
Date: Thu, 27 Nov 2014 23:53:56 -0600
Subject: [PATCH] mc-dev imports
@@ -12,18 +12,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public abstract class BlockMinecartTrackAbstract extends Block {
+
+ protected final boolean a;
+
+ public static final boolean b_(World world, int i, int j, int k) {
+ return a(world.getType(i, j, k));
+ public static boolean d(World world, BlockPosition blockposition) {
+ return d(world.getType(blockposition));
+ }
+
+ public static final boolean a(Block block) {
+ return block == Blocks.RAILS || block == Blocks.GOLDEN_RAIL || block == Blocks.DETECTOR_RAIL || block == Blocks.ACTIVATOR_RAIL;
+ public static boolean d(IBlockData iblockdata) {
+ Block block = iblockdata.getBlock();
+
+ return block == Blocks.RAIL || block == Blocks.GOLDEN_RAIL || block == Blocks.DETECTOR_RAIL || block == Blocks.ACTIVATOR_RAIL;
+ }
+
+ protected BlockMinecartTrackAbstract(boolean flag) {
@@ -33,11 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.a(CreativeModeTab.e);
+ }
+
+ public boolean e() {
+ return this.a;
+ }
+
+ public AxisAlignedBB a(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ return null;
+ }
+
@@ -45,288 +41,94 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return false;
+ }
+
+ public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
+ this.updateShape(world, i, j, k);
+ return super.a(world, i, j, k, vec3d, vec3d1);
+ public MovingObjectPosition a(World world, BlockPosition blockposition, Vec3D vec3d, Vec3D vec3d1) {
+ this.updateShape(world, blockposition);
+ return super.a(world, blockposition, vec3d, vec3d1);
+ }
+
+ public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
+ int l = iblockaccess.getData(i, j, k);
+ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) {
+ IBlockData iblockdata = iblockaccess.getType(blockposition);
+ EnumTrackPosition enumtrackposition = iblockdata.getBlock() == this ? (EnumTrackPosition) iblockdata.get(this.l()) : null;
+
+ if (l >= 2 && l <= 5) {
+ if (enumtrackposition != null && enumtrackposition.c()) {
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
+ } else {
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
+ }
+
+ }
+
+ public boolean d() {
+ return false;
+ }
+
+ public int b() {
+ return 9;
+ public boolean canPlace(World world, BlockPosition blockposition) {
+ return World.a((IBlockAccess) world, blockposition.down());
+ }
+
+ public int a(Random random) {
+ return 1;
+ }
+
+ public boolean canPlace(World world, int i, int j, int k) {
+ return World.a((IBlockAccess) world, i, j - 1, k);
+ }
+
+ public void onPlace(World world, int i, int j, int k) {
+ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ if (!world.isStatic) {
+ this.a(world, i, j, k, true);
+ iblockdata = this.a(world, blockposition, iblockdata, true);
+ if (this.a) {
+ this.doPhysics(world, i, j, k, this);
+ this.doPhysics(world, blockposition, iblockdata, this);
+ }
+ }
+
+ }
+
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
+ if (!world.isStatic) {
+ int l = world.getData(i, j, k);
+ int i1 = l;
+
+ if (this.a) {
+ i1 = l & 7;
+ }
+
+ EnumTrackPosition enumtrackposition = (EnumTrackPosition) iblockdata.get(this.l());
+ boolean flag = false;
+
+ if (!World.a((IBlockAccess) world, i, j - 1, k)) {
+ if (!World.a((IBlockAccess) world, blockposition.down())) {
+ flag = true;
+ }
+
+ if (i1 == 2 && !World.a((IBlockAccess) world, i + 1, j, k)) {
+ if (enumtrackposition == EnumTrackPosition.ASCENDING_EAST && !World.a((IBlockAccess) world, blockposition.east())) {
+ flag = true;
+ }
+
+ if (i1 == 3 && !World.a((IBlockAccess) world, i - 1, j, k)) {
+ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_WEST && !World.a((IBlockAccess) world, blockposition.west())) {
+ flag = true;
+ }
+
+ if (i1 == 4 && !World.a((IBlockAccess) world, i, j, k - 1)) {
+ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_NORTH && !World.a((IBlockAccess) world, blockposition.north())) {
+ flag = true;
+ }
+
+ if (i1 == 5 && !World.a((IBlockAccess) world, i, j, k + 1)) {
+ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_SOUTH && !World.a((IBlockAccess) world, blockposition.south())) {
+ flag = true;
+ }
+
+ if (flag) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
+ world.setAir(i, j, k);
+ this.b(world, blockposition, iblockdata, 0);
+ world.setAir(blockposition);
+ } else {
+ this.a(world, i, j, k, l, i1, block);
+ this.b(world, blockposition, iblockdata, block);
+ }
+
+ }
+ }
+
+ protected void a(World world, int i, int j, int k, int l, int i1, Block block) {}
+ protected void b(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {}
+
+ protected void a(World world, int i, int j, int k, boolean flag) {
+ if (!world.isStatic) {
+ (new MinecartTrackLogic(this, world, i, j, k)).a(world.isBlockIndirectlyPowered(i, j, k), flag);
+ }
+ protected IBlockData a(World world, BlockPosition blockposition, IBlockData iblockdata, boolean flag) {
+ return world.isStatic ? iblockdata : (new MinecartTrackLogic(this, world, blockposition, iblockdata)).a(world.isBlockIndirectlyPowered(blockposition), flag).b();
+ }
+
+ public int h() {
+ public int i() {
+ return 0;
+ }
+
+ public void remove(World world, int i, int j, int k, Block block, int l) {
+ int i1 = l;
+
+ if (this.a) {
+ i1 = l & 7;
+ }
+
+ super.remove(world, i, j, k, block, l);
+ if (i1 == 2 || i1 == 3 || i1 == 4 || i1 == 5) {
+ world.applyPhysics(i, j + 1, k, block);
+ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ super.remove(world, blockposition, iblockdata);
+ if (((EnumTrackPosition) iblockdata.get(this.l())).c()) {
+ world.applyPhysics(blockposition.up(), this);
+ }
+
+ if (this.a) {
+ world.applyPhysics(i, j, k, block);
+ world.applyPhysics(i, j - 1, k, block);
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BlockTorch.java b/src/main/java/net/minecraft/server/BlockTorch.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockTorch.java
@@ -0,0 +0,0 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class BlockTorch extends Block {
+
+ protected BlockTorch() {
+ super(Material.ORIENTABLE);
+ this.a(true);
+ this.a(CreativeModeTab.c);
+ }
+
+ public AxisAlignedBB a(World world, int i, int j, int k) {
+ return null;
+ }
+
+ public boolean c() {
+ return false;
+ }
+
+ public boolean d() {
+ return false;
+ }
+
+ public int b() {
+ return 2;
+ }
+
+ private boolean m(World world, int i, int j, int k) {
+ if (World.a((IBlockAccess) world, i, j, k)) {
+ return true;
+ } else {
+ Block block = world.getType(i, j, k);
+
+ return block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL;
+ }
+ }
+
+ public boolean canPlace(World world, int i, int j, int k) {
+ return world.c(i - 1, j, k, true) ? true : (world.c(i + 1, j, k, true) ? true : (world.c(i, j, k - 1, true) ? true : (world.c(i, j, k + 1, true) ? true : this.m(world, i, j - 1, k))));
+ }
+
+ public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
+ int j1 = i1;
+
+ if (l == 1 && this.m(world, i, j - 1, k)) {
+ j1 = 5;
+ world.applyPhysics(blockposition, this);
+ world.applyPhysics(blockposition.down(), this);
+ }
+
+ if (l == 2 && world.c(i, j, k + 1, true)) {
+ j1 = 4;
+ }
+
+ if (l == 3 && world.c(i, j, k - 1, true)) {
+ j1 = 3;
+ }
+
+ if (l == 4 && world.c(i + 1, j, k, true)) {
+ j1 = 2;
+ }
+
+ if (l == 5 && world.c(i - 1, j, k, true)) {
+ j1 = 1;
+ }
+
+ return j1;
+ }
+
+ public void a(World world, int i, int j, int k, Random random) {
+ super.a(world, i, j, k, random);
+ if (world.getData(i, j, k) == 0) {
+ this.onPlace(world, i, j, k);
+ }
+ }
+
+ public void onPlace(World world, int i, int j, int k) {
+ if (world.getData(i, j, k) == 0) {
+ if (world.c(i - 1, j, k, true)) {
+ world.setData(i, j, k, 1, 2);
+ } else if (world.c(i + 1, j, k, true)) {
+ world.setData(i, j, k, 2, 2);
+ } else if (world.c(i, j, k - 1, true)) {
+ world.setData(i, j, k, 3, 2);
+ } else if (world.c(i, j, k + 1, true)) {
+ world.setData(i, j, k, 4, 2);
+ } else if (this.m(world, i, j - 1, k)) {
+ world.setData(i, j, k, 5, 2);
+ }
+ }
+
+ this.e(world, i, j, k);
+ }
+
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ this.b(world, i, j, k, block);
+ }
+
+ protected boolean b(World world, int i, int j, int k, Block block) {
+ if (this.e(world, i, j, k)) {
+ int l = world.getData(i, j, k);
+ boolean flag = false;
+
+ if (!world.c(i - 1, j, k, true) && l == 1) {
+ flag = true;
+ }
+
+ if (!world.c(i + 1, j, k, true) && l == 2) {
+ flag = true;
+ }
+
+ if (!world.c(i, j, k - 1, true) && l == 3) {
+ flag = true;
+ }
+
+ if (!world.c(i, j, k + 1, true) && l == 4) {
+ flag = true;
+ }
+
+ if (!this.m(world, i, j - 1, k) && l == 5) {
+ flag = true;
+ }
+
+ if (flag) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
+ world.setAir(i, j, k);
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return true;
+ }
+ }
+
+ protected boolean e(World world, int i, int j, int k) {
+ if (!this.canPlace(world, i, j, k)) {
+ if (world.getType(i, j, k) == this) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
+ world.setAir(i, j, k);
+ }
+
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
+ int l = world.getData(i, j, k) & 7;
+ float f = 0.15F;
+
+ if (l == 1) {
+ this.a(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f);
+ } else if (l == 2) {
+ this.a(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
+ } else if (l == 3) {
+ this.a(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
+ } else if (l == 4) {
+ this.a(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
+ } else {
+ f = 0.1F;
+ this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
+ }
+
+ return super.a(world, i, j, k, vec3d, vec3d1);
+ }
+ public abstract IBlockState l();
+}
diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
new file mode 100644
@@ -338,94 +140,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+public class MobEffectAttackDamage extends MobEffectList {
+
+ protected MobEffectAttackDamage(int i, boolean flag, int j) {
+ super(i, flag, j);
+ protected MobEffectAttackDamage(int i, MinecraftKey minecraftkey, boolean flag, int j) {
+ super(i, minecraftkey, flag, j);
+ }
+
+ public double a(int i, AttributeModifier attributemodifier) {
+ return this.id == MobEffectList.WEAKNESS.id ? (double) (-0.5F * (float) (i + 1)) : 1.3D * (double) (i + 1);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
@@ -0,0 +0,0 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class RandomPositionGenerator {
+
+ private static Vec3D a = Vec3D.a(0.0D, 0.0D, 0.0D);
+
+ public static Vec3D a(EntityCreature entitycreature, int i, int j) {
+ return c(entitycreature, i, j, (Vec3D) null);
+ }
+
+ public static Vec3D a(EntityCreature entitycreature, int i, int j, Vec3D vec3d) {
+ a.a = vec3d.a - entitycreature.locX;
+ a.b = vec3d.b - entitycreature.locY;
+ a.c = vec3d.c - entitycreature.locZ;
+ return c(entitycreature, i, j, a);
+ }
+
+ public static Vec3D b(EntityCreature entitycreature, int i, int j, Vec3D vec3d) {
+ a.a = entitycreature.locX - vec3d.a;
+ a.b = entitycreature.locY - vec3d.b;
+ a.c = entitycreature.locZ - vec3d.c;
+ return c(entitycreature, i, j, a);
+ }
+
+ private static Vec3D c(EntityCreature entitycreature, int i, int j, Vec3D vec3d) {
+ Random random = entitycreature.aI();
+ boolean flag = false;
+ int k = 0;
+ int l = 0;
+ int i1 = 0;
+ float f = -99999.0F;
+ boolean flag1;
+
+ if (entitycreature.bY()) {
+ double d0 = (double) (entitycreature.bV().e(MathHelper.floor(entitycreature.locX), MathHelper.floor(entitycreature.locY), MathHelper.floor(entitycreature.locZ)) + 4.0F);
+ double d1 = (double) (entitycreature.bW() + (float) i);
+
+ flag1 = d0 < d1 * d1;
+ } else {
+ flag1 = false;
+ }
+
+ for (int j1 = 0; j1 < 10; ++j1) {
+ int k1 = random.nextInt(2 * i) - i;
+ int l1 = random.nextInt(2 * j) - j;
+ int i2 = random.nextInt(2 * i) - i;
+
+ if (vec3d == null || (double) k1 * vec3d.a + (double) i2 * vec3d.c >= 0.0D) {
+ k1 += MathHelper.floor(entitycreature.locX);
+ l1 += MathHelper.floor(entitycreature.locY);
+ i2 += MathHelper.floor(entitycreature.locZ);
+ if (!flag1 || entitycreature.b(k1, l1, i2)) {
+ float f1 = entitycreature.a(k1, l1, i2);
+
+ if (f1 > f) {
+ f = f1;
+ k = k1;
+ l = l1;
+ i1 = i2;
+ flag = true;
+ }
+ }
+ }
+ }
+
+ if (flag) {
+ return Vec3D.a((double) k, (double) l, (double) i1);
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@@ -434,36 +156,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package net.minecraft.server;
+
+public class TileEntityEnderChest extends TileEntity {
+public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox {
+
+ public float a;
+ public float i;
+ public int j;
+ private int k;
+ public float f;
+ public int g;
+ private int h;
+
+ public TileEntityEnderChest() {}
+
+ public void h() {
+ super.h();
+ if (++this.k % 20 * 4 == 0) {
+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
+ public void c() {
+ if (++this.h % 20 * 4 == 0) {
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
+ this.i = this.a;
+ this.f = this.a;
+ int i = this.position.getX();
+ int j = this.position.getY();
+ int k = this.position.getZ();
+ float f = 0.1F;
+ double d0;
+
+ if (this.j > 0 && this.a == 0.0F) {
+ double d1 = (double) this.x + 0.5D;
+ if (this.g > 0 && this.a == 0.0F) {
+ double d1 = (double) i + 0.5D;
+
+ d0 = (double) this.z + 0.5D;
+ this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ d0 = (double) k + 0.5D;
+ this.world.makeSound(d1, (double) j + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+
+ if (this.j == 0 && this.a > 0.0F || this.j > 0 && this.a < 1.0F) {
+ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) {
+ float f1 = this.a;
+
+ if (this.j > 0) {
+ if (this.g > 0) {
+ this.a += f;
+ } else {
+ this.a -= f;
@@ -476,44 +200,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ float f2 = 0.5F;
+
+ if (this.a < f2 && f1 >= f2) {
+ d0 = (double) this.x + 0.5D;
+ double d2 = (double) this.z + 0.5D;
+ d0 = (double) i + 0.5D;
+ double d2 = (double) k + 0.5D;
+
+ this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ this.world.makeSound(d0, (double) j + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+
+ if (this.a < 0.0F) {
+ this.a = 0.0F;
+ }
+ }
+
+ }
+
+ public boolean c(int i, int j) {
+ if (i == 1) {
+ this.j = j;
+ this.g = j;
+ return true;
+ } else {
+ return super.c(i, j);
+ }
+ }
+
+ public void s() {
+ this.u();
+ super.s();
+ }
+
+ public void a() {
+ ++this.j;
+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
+ public void y() {
+ this.E();
+ super.y();
+ }
+
+ public void b() {
+ --this.j;
+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
+ ++this.g;
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
+ public void d() {
+ --this.g;
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
+ public boolean a(EntityHuman entityhuman) {
+ return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
+ return this.world.getTileEntity(this.position) != this ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
@@ -524,17 +249,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package net.minecraft.server;
+
+public class TileEntityLightDetector extends TileEntity {
+public class TileEntityLightDetector extends TileEntity implements IUpdatePlayerListBox {
+
+ public TileEntityLightDetector() {}
+
+ public void h() {
+ public void c() {
+ if (this.world != null && !this.world.isStatic && this.world.getTime() % 20L == 0L) {
+ this.h = this.q();
+ if (this.h instanceof BlockDaylightDetector) {
+ ((BlockDaylightDetector) this.h).e(this.world, this.x, this.y, this.z);
+ this.e = this.w();
+ if (this.e instanceof BlockDaylightDetector) {
+ ((BlockDaylightDetector) this.e).d(this.world, this.position);
+ }
+ }
+
+ }
+}
--