mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Update to Minecraft 1.9
This commit is contained in:
parent
a74ba1694d
commit
cf5b4b8828
@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- <artifactId>bukkit</artifactId>
|
||||
+ <groupId>org.spigotmc</groupId>
|
||||
+ <artifactId>spigot-api</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<version>1.9-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
- <name>Bukkit</name>
|
||||
|
@ -10,9 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
*/
|
||||
@Deprecated
|
||||
public void resetTitle();
|
||||
+
|
||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
|
||||
|
||||
+ // Spigot start
|
||||
+ public class Spigot extends Entity.Spigot
|
||||
+ {
|
||||
|
@ -9,8 +9,8 @@ diff --git a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java b/src
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.event.entity;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
-import org.bukkit.event.Cancellable;
|
||||
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public CreatureSpawnEvent(final LivingEntity spawnee, final SpawnReason spawnReason) {
|
||||
@@ -0,0 +0,0 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
spawnReason = reason;
|
||||
this.spawnReason = spawnReason;
|
||||
}
|
||||
|
||||
- public boolean isCancelled() {
|
||||
@ -55,9 +55,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
* Gets the type of creature being spawned.
|
||||
* Gets the reason for why the creature is being spawned.
|
||||
*
|
||||
* @return A CreatureType value detailing the type of creature being
|
||||
* @return A SpawnReason value detailing the reason for the creature being
|
||||
@@ -0,0 +0,0 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
return spawnReason;
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender {
|
||||
* @return if the custom name is displayed
|
||||
* @return whether the entity is glowing
|
||||
*/
|
||||
public boolean isCustomNameVisible();
|
||||
boolean isGlowing();
|
||||
+
|
||||
+ // Spigot Start
|
||||
+ public class Spigot
|
||||
|
@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ <groupId>org.spigotmc</groupId>
|
||||
+ <artifactId>spigot</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<version>1.9-SNAPSHOT</version>
|
||||
- <name>CraftBukkit</name>
|
||||
- <url>http://www.bukkit.org</url>
|
||||
+ <name>Spigot</name>
|
||||
@ -41,24 +41,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
<dependency>
|
||||
- <groupId>org.bukkit</groupId>
|
||||
- <artifactId>bukkit</artifactId>
|
||||
+ <groupId>org.spigotmc</groupId>
|
||||
+ <artifactId>spigot-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
@@ -0,0 +0,0 @@
|
||||
<version>5.1.37</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>net.sf.trove4j</groupId>
|
||||
+ <artifactId>trove4j</artifactId>
|
||||
+ <version>3.0.3</version>
|
||||
+ </dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>org.spigotmc</groupId>
|
||||
+ <artifactId>spigot-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
<!-- testing -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
@@ -0,0 +0,0 @@
|
||||
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
<build>
|
||||
- <defaultGoal>clean install</defaultGoal>
|
||||
+ <defaultGoal>install</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>scriptus</artifactId>
|
||||
<version>0.2</version>
|
||||
|
@ -68,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
public void setOp(boolean value) {
|
||||
perm.setOp(value);
|
||||
public boolean isGlowing() {
|
||||
return getHandle().glowing;
|
||||
}
|
||||
+
|
||||
+ // Spigot start
|
||||
@ -108,8 +108,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 {
|
||||
PacketPlayOutTitle packetReset = new PacketPlayOutTitle(EnumTitleAction.RESET, null);
|
||||
getHandle().playerConnection.sendPacket(packetReset);
|
||||
getHandle().playerConnection.sendPacket(packetplayoutworldparticles);
|
||||
|
||||
}
|
||||
+
|
||||
+ // Spigot start
|
File diff suppressed because it is too large
Load Diff
@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Spigot Start
|
||||
+ public ServerConnection getServerConnection()
|
||||
+ {
|
||||
+ return this.q;
|
||||
+ return this.p;
|
||||
+ }
|
||||
+ // Spigot End
|
||||
public ServerConnection aq() {
|
||||
return this.q;
|
||||
public ServerConnection am() {
|
||||
return this.p;
|
||||
}
|
||||
--
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
if (this.R() < 0) {
|
||||
if (this.P() < 0) {
|
||||
this.setPort(this.propertyManager.getInt("server-port", 25565));
|
||||
}
|
||||
+ // Spigot start
|
||||
|
@ -1,194 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Tue, 11 Jun 2013 12:56:02 +1000
|
||||
Subject: [PATCH] Better Chunk Tick Selection
|
||||
|
||||
An optimized chunk ticking algorithm which better selects chunks around players which are active on the server.
|
||||
|
||||
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 Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - public
|
||||
public final boolean isClientSide;
|
||||
// CraftBukkit - longhashset
|
||||
- protected LongHashSet chunkTickList = new LongHashSet();
|
||||
+ // protected LongHashSet chunkTickList = new LongHashSet(); // Spigot
|
||||
private int L;
|
||||
public boolean allowMonsters; // CraftBukkit - public
|
||||
public boolean allowAnimals; // CraftBukkit - public
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
public long ticksPerMonsterSpawns;
|
||||
public boolean populating;
|
||||
private int tickPosition;
|
||||
+
|
||||
+ // Spigot start
|
||||
+ protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList;
|
||||
+ protected float growthOdds = 100;
|
||||
+ protected float modifiedOdds = 100;
|
||||
+ private final byte chunkTickRadius;
|
||||
+
|
||||
+ public static long chunkToKey(int x, int z)
|
||||
+ {
|
||||
+ long k = ( ( ( (long) x ) & 0xFFFF0000L ) << 16 ) | ( ( ( (long) x ) & 0x0000FFFFL ) << 0 );
|
||||
+ k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 );
|
||||
+ return k;
|
||||
+ }
|
||||
+
|
||||
+ public static int keyToX(long k)
|
||||
+ {
|
||||
+ return (int) ( ( ( k >> 16 ) & 0xFFFF0000 ) | ( k & 0x0000FFFF ) );
|
||||
+ }
|
||||
+
|
||||
+ public static int keyToZ(long k)
|
||||
+ {
|
||||
+ return (int) ( ( ( k >> 32 ) & 0xFFFF0000L ) | ( ( k >> 16 ) & 0x0000FFFF ) );
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+
|
||||
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
|
||||
|
||||
public CraftWorld getWorld() {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
|
||||
// CraftBukkit end
|
||||
+ // Spigot start
|
||||
+ this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 );
|
||||
+ this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
|
||||
+ this.chunkTickList.setAutoCompactionFactor( 0 );
|
||||
+ // Spigot end
|
||||
+
|
||||
this.L = this.random.nextInt(12000);
|
||||
this.allowMonsters = true;
|
||||
this.allowAnimals = true;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
int k;
|
||||
int l;
|
||||
|
||||
+ // Spigot start
|
||||
+ int optimalChunks = spigotConfig.chunksPerTick;
|
||||
+ // Quick conditions to allow us to exist early
|
||||
+ if ( optimalChunks > 0 ) {
|
||||
+ // Keep chunks with growth inside of the optimal chunk range
|
||||
+ int chunksPerPlayer = Math.min( 200, Math.max( 1, (int) ( ( ( optimalChunks - players.size() ) / (double) players.size() ) + 0.5 ) ) );
|
||||
+ int randRange = 3 + chunksPerPlayer / 30;
|
||||
+ // Limit to normal tick radius - including view distance
|
||||
+ randRange = ( randRange > chunkTickRadius ) ? chunkTickRadius : randRange;
|
||||
+ // odds of growth happening vs growth happening in vanilla
|
||||
+ this.growthOdds = this.modifiedOdds = Math.max( 35, Math.min( 100, ( ( chunksPerPlayer + 1 ) * 100F ) / 15F ) );
|
||||
+ // Spigot end
|
||||
for (i = 0; i < this.players.size(); ++i) {
|
||||
entityhuman = (EntityHuman) this.players.get(i);
|
||||
j = MathHelper.floor(entityhuman.locX / 16.0D);
|
||||
k = MathHelper.floor(entityhuman.locZ / 16.0D);
|
||||
l = this.q();
|
||||
|
||||
- for (int i1 = -l; i1 <= l; ++i1) {
|
||||
- for (int j1 = -l; j1 <= l; ++j1) {
|
||||
- this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(i1 + j, j1 + k));
|
||||
+ // Spigot start - Always update the chunk the player is on
|
||||
+ long key = chunkToKey( j, k );
|
||||
+ int existingPlayers = Math.max( 0, chunkTickList.get( key ) ); // filter out -1
|
||||
+ chunkTickList.put( key, (short) ( existingPlayers + 1 ) );
|
||||
+
|
||||
+ // Check and see if we update the chunks surrounding the player this tick
|
||||
+ for ( int chunk = 0; chunk < chunksPerPlayer; chunk++ )
|
||||
+ {
|
||||
+ int dx = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange );
|
||||
+ int dz = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange );
|
||||
+ long hash = chunkToKey( dx + j, dz + k );
|
||||
+ if ( !chunkTickList.contains( hash ) && this.chunkProvider.isChunkLoaded(dx + j, dz + k ) )
|
||||
+ {
|
||||
+ chunkTickList.put( hash, (short) -1 ); // no players
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Spigot End
|
||||
+ }
|
||||
|
||||
this.methodProfiler.b();
|
||||
if (this.L > 0) {
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.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 implements IAsyncTaskHandler {
|
||||
protected void h() {
|
||||
super.h();
|
||||
if (this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||
- Iterator iterator = this.chunkTickList.iterator();
|
||||
+ // Spigot start
|
||||
+ gnu.trove.iterator.TLongShortIterator iterator = this.chunkTickList.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
|
||||
+ iterator.advance();
|
||||
+ long chunkCoord = iterator.key();
|
||||
|
||||
- this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z).b(false);
|
||||
+ this.getChunkAt(World.keyToX( chunkCoord ), World.keyToZ( chunkCoord )).b(false);
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
// ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) iterator1.next();
|
||||
// int k = chunkcoordintpair1.x * 16;
|
||||
// int l = chunkcoordintpair1.z * 16;
|
||||
- for (long chunkCoord : chunkTickList.popAll()) {
|
||||
- int chunkX = LongHash.msw(chunkCoord);
|
||||
- int chunkZ = LongHash.lsw(chunkCoord);
|
||||
+ // Spigot start
|
||||
+ for (gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext(); )
|
||||
+ {
|
||||
+ iter.advance();
|
||||
+ long chunkCoord = iter.key();
|
||||
+ int chunkX = World.keyToX( chunkCoord );
|
||||
+ int chunkZ = World.keyToZ( chunkCoord );
|
||||
+ // If unloaded, or in procedd of being unloaded, drop it
|
||||
+ if ( ( !this.chunkProvider.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) )
|
||||
+ {
|
||||
+ iter.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+ // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
|
||||
int k = chunkX * 16;
|
||||
int l = chunkZ * 16;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
}
|
||||
|
||||
}
|
||||
+ // Spigot Start
|
||||
+ if ( spigotConfig.clearChunksOnTick )
|
||||
+ {
|
||||
+ chunkTickList.clear();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
}
|
||||
|
||||
protected BlockPosition a(BlockPosition blockposition) {
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
config.addDefault( "world-settings.default." + path, def );
|
||||
return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
|
||||
}
|
||||
+
|
||||
+ public int chunksPerTick;
|
||||
+ public boolean clearChunksOnTick;
|
||||
+ private void chunksPerTick()
|
||||
+ {
|
||||
+ chunksPerTick = getInt( "chunks-per-tick", 650 );
|
||||
+ log( "Chunks to Grow per Tick: " + chunksPerTick );
|
||||
+
|
||||
+ clearChunksOnTick = getBoolean( "clear-tick-list", false );
|
||||
+ log( "Clear tick list: " + clearChunksOnTick );
|
||||
+ }
|
||||
}
|
||||
--
|
@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/Block.java
|
||||
+++ b/src/main/java/net/minecraft/server/Block.java
|
||||
@@ -0,0 +0,0 @@ public class Block {
|
||||
return 0;
|
||||
private static void a(int i, String s, Block block) {
|
||||
a(i, new MinecraftKey(s), block);
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+ // Spigot start
|
||||
+ public static float range(float min, float value, float max) {
|
||||
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue();
|
||||
|
||||
- if (j == 15) {
|
||||
+ if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
|
||||
+ if (j >= (byte) range(3, (world.spigotConfig.cactusModifier / 100 * 15) + 0.5F, 15)) { // Spigot
|
||||
// world.setTypeUpdate(blockposition1, this.getBlockData()); // CraftBukkit
|
||||
IBlockData iblockdata1 = iblockdata.set(BlockCactus.AGE, Integer.valueOf(0));
|
||||
|
||||
@ -44,28 +44,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/BlockCrops.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockCrops.java
|
||||
@@ -0,0 +0,0 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement
|
||||
if (i < 7) {
|
||||
if (i < this.g()) {
|
||||
float f = a((Block) this, world, blockposition);
|
||||
|
||||
- if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
||||
- // CraftBukkit start
|
||||
+ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot // CraftBukkit start
|
||||
IBlockData data = iblockdata.set(AGE, Integer.valueOf(i + 1));
|
||||
+ if (random.nextInt((int) (world.spigotConfig.wheatModifier / 100 * (25.0F / f)) + 1) == 0) { // Spigot // CraftBukkit start
|
||||
// CraftBukkit start
|
||||
IBlockData data = this.setAge(i + 1);
|
||||
CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data));
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockGrass.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockGrass.java
|
||||
@@ -0,0 +0,0 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement {
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
if (world.getLightLevel(blockposition.up()) >= 9) {
|
||||
- for (int i = 0; i < 4; ++i) {
|
||||
+ for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot
|
||||
BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
|
||||
Block block = world.getType(blockposition1.up()).getBlock();
|
||||
IBlockData iblockdata1 = world.getType(blockposition1);
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockMushroom.java
|
||||
@ -75,23 +61,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
final int sourceX = blockposition.getX(), sourceY = blockposition.getY(), sourceZ = blockposition.getZ(); // CraftBukkit
|
||||
- if (random.nextInt(25) == 0) {
|
||||
+ if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot int i = 5;
|
||||
+ if (random.nextInt(Math.max(1, (int) world.spigotConfig.mushroomModifier / 100 * 25)) == 0) { // Spigot
|
||||
int i = 5;
|
||||
boolean flag = true;
|
||||
Iterator iterator = BlockPosition.b(blockposition.a(-4, -1, -4), blockposition.a(4, 1, 4)).iterator();
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockMycel.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockMycel.java
|
||||
@@ -0,0 +0,0 @@ public class BlockMycel extends Block {
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
if (world.getLightLevel(blockposition.up()) >= 9) {
|
||||
- for (int i = 0; i < 4; ++i) {
|
||||
+ for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot
|
||||
BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
|
||||
IBlockData iblockdata1 = world.getType(blockposition1);
|
||||
Block block = world.getType(blockposition1.up()).getBlock();
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockNetherWart.java b/src/main/java/net/minecraft/server/BlockNetherWart.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockNetherWart.java
|
||||
@ -101,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
int i = ((Integer) iblockdata.get(BlockNetherWart.AGE)).intValue();
|
||||
|
||||
- if (i < 3 && random.nextInt(10) == 0) {
|
||||
+ if (i < 3 && random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.wartModifier * 10)) == 0) { // Spigot
|
||||
+ if (i < 3 && random.nextInt(Math.max(1, (int) world.spigotConfig.wartModifier / 100 * 10)) == 0) { // Spigot
|
||||
iblockdata = iblockdata.set(BlockNetherWart.AGE, Integer.valueOf(i + 1));
|
||||
// world.setTypeAndData(blockposition, iblockdata, 2); // CraftBukkit
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(iblockdata)); // CraftBukkit
|
||||
@ -114,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue();
|
||||
|
||||
- if (j == 15) {
|
||||
+ if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
|
||||
+ if (j >= (byte) range(3, (world.spigotConfig.caneModifier /100 * 15) + 0.5F, 15)) { // Spigot
|
||||
// CraftBukkit start
|
||||
// world.setTypeUpdate(blockposition.up(), this.getBlockData()); // CraftBukkit
|
||||
BlockPosition upPos = blockposition.up();
|
||||
@ -127,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (!world.isClientSide) {
|
||||
super.b(world, blockposition, iblockdata, random);
|
||||
- if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
|
||||
+ if (world.getLightLevel(blockposition.up()) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot) {
|
||||
+ if (world.getLightLevel(blockposition.up()) >= 9 && (random.nextInt(Math.max(2, (int) ((world.spigotConfig.saplingModifier / 100 * 7) + 0.5F))) == 0)) { // Spigot) {
|
||||
// CraftBukkit start
|
||||
world.captureTreeGeneration = true;
|
||||
// CraftBukkit end
|
||||
@ -140,7 +113,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
float f = BlockCrops.a((Block) this, world, blockposition);
|
||||
|
||||
- if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
||||
+ if (random.nextInt((int) (world.growthOdds / (this == Blocks.PUMPKIN_STEM? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot
|
||||
+ if (random.nextInt((int) ((this == Blocks.PUMPKIN_STEM? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / 100 * (25.0F / f)) + 1) == 0) { // Spigot
|
||||
int i = ((Integer) iblockdata.get(BlockStem.AGE)).intValue();
|
||||
|
||||
if (i < 7) {
|
||||
@ -149,8 +122,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
clearChunksOnTick = getBoolean( "clear-tick-list", false );
|
||||
log( "Clear tick list: " + clearChunksOnTick );
|
||||
config.addDefault( "world-settings.default." + path, def );
|
||||
return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
|
||||
}
|
||||
+
|
||||
+ // Crop growth rates
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
|
||||
}
|
||||
|
||||
private void w() {
|
||||
private void x() {
|
||||
- Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(0.5D, 0.0D, 0.5D)).iterator();
|
||||
+ // Spigot start
|
||||
+ double radius = world.spigotConfig.itemMerge;
|
@ -46,9 +46,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public void addEntity(Entity entity, int i, final int j, boolean flag) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot
|
||||
if (i > this.e) {
|
||||
i = this.e;
|
||||
}
|
||||
try {
|
||||
if (this.trackedEntities.b(entity.getId())) {
|
||||
throw new IllegalStateException("Entity is already tracked!");
|
||||
@@ -0,0 +0,0 @@ public class EntityTracker {
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "player tracker clear"); // Spigot
|
||||
if (this.trackedPlayers.contains(entityplayer)) {
|
||||
this.trackedPlayers.remove(entityplayer);
|
||||
entityplayer.d(this.tracker);
|
||||
this.tracker.c(entityplayer);
|
||||
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
|
||||
@ -94,13 +94,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public void removeEntity(Entity entity) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "entity remove"); // Spigot
|
||||
entity.b(false);
|
||||
entity.die();
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.players.remove(entity);
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public void b(Collection<Entity> collection) {
|
||||
public void a(Collection<Entity> collection) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot
|
||||
// CraftBukkit start
|
||||
// this.entityList.addAll(collection);
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap {
|
||||
private final int[][] i = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
|
||||
private boolean m = true;
|
||||
private boolean wasNotEmpty; // CraftBukkit - add field
|
||||
|
||||
- public PlayerChunkMap(WorldServer worldserver) {
|
||||
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ this.a(viewDistance); // Spigot
|
||||
}
|
||||
|
||||
public WorldServer a() {
|
||||
public WorldServer getWorld() {
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@ -31,9 +31,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.tracker = new EntityTracker(this);
|
||||
- this.manager = new PlayerChunkMap(this);
|
||||
+ this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot
|
||||
this.worldProvider.a(this);
|
||||
this.chunkProvider = this.k();
|
||||
this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
|
||||
this.worldProvider.a((World) this);
|
||||
this.chunkProvider = this.n();
|
||||
this.portalTravelAgent = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
@ -12,19 +12,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
}
|
||||
|
||||
public void loadNearby(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) {
|
||||
public void loadNearby(IChunkProvider ichunkprovider, ChunkGenerator chunkgenerator) {
|
||||
+ world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot
|
||||
boolean flag = ichunkprovider.isChunkLoaded(i, j - 1);
|
||||
boolean flag1 = ichunkprovider.isChunkLoaded(i + 1, j);
|
||||
boolean flag2 = ichunkprovider.isChunkLoaded(i, j + 1);
|
||||
Chunk chunk = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ - 1);
|
||||
Chunk chunk1 = ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ);
|
||||
Chunk chunk2 = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ + 1);
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
}
|
||||
this.e();
|
||||
}
|
||||
|
||||
+ world.timings.syncChunkLoadPostTimer.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
public BlockPosition h(BlockPosition blockposition) {
|
||||
public BlockPosition f(BlockPosition blockposition) {
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@ -34,27 +34,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
if (chunk == null) {
|
||||
+ world.timings.syncChunkLoadTimer.startTiming(); // Spigot
|
||||
long k = ChunkCoordIntPair.a(i, j);
|
||||
|
||||
chunk = this.loadChunk(i, j);
|
||||
if (chunk == null) {
|
||||
if (this.chunkProvider == null) {
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
// CraftBukkit end
|
||||
chunk.loadNearby(this, this, i, j);
|
||||
chunk.loadNearby(this, this.chunkGenerator);
|
||||
+ world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
return chunk;
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
if (chunk != null) {
|
||||
chunk.setLastSaved(this.world.getTime());
|
||||
if (this.chunkProvider != null) {
|
||||
+ world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot
|
||||
this.chunkProvider.recreateStructures(chunk, i, j);
|
||||
+ world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
@ -79,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
if (nbttaglist1 != null) {
|
||||
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
}
|
||||
chunk.g(true);
|
||||
}
|
||||
}
|
||||
-
|
||||
@ -120,10 +110,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
}
|
||||
|
||||
public void aO() {
|
||||
public void aL() {
|
||||
+ SpigotTimings.serverCommandTimer.startTiming(); // Spigot
|
||||
while (!this.l.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.l.remove(0);
|
||||
while (!this.serverCommandQueue.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
|
||||
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
// CraftBukkit end
|
||||
@ -132,28 +122,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ SpigotTimings.serverCommandTimer.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
public boolean ae() {
|
||||
public boolean aa() {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
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 @@ import org.bukkit.entity.Hanging;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Painting;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
+import org.spigotmc.CustomTimingsHandler; // Spigot
|
||||
import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
||||
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
public boolean valid; // CraftBukkit
|
||||
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
|
||||
public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949
|
||||
|
||||
+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
|
||||
+
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public Entity(World world) {
|
||||
this.id = Entity.entityCount++;
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
|
||||
@ -169,13 +158,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
private void recalcPosition() {
|
||||
public void recalcPosition() {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot
|
||||
@ -186,25 +175,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
public void t_() {
|
||||
public void m() {
|
||||
+ SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot
|
||||
super.t_();
|
||||
super.m();
|
||||
this.cu();
|
||||
if (!this.world.isClientSide) {
|
||||
int i = this.bv();
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot
|
||||
this.m();
|
||||
this.n();
|
||||
+ SpigotTimings.timerEntityTickRest.startTiming(); // Spigot
|
||||
double d0 = this.locX - this.lastX;
|
||||
double d1 = this.locZ - this.lastZ;
|
||||
float f = (float) (d0 * d0 + d1 * d1);
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
this.bo = 0;
|
||||
}
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
this.aT += f2;
|
||||
+ SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
@ -214,9 +203,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
this.world.methodProfiler.a("ai");
|
||||
+ SpigotTimings.timerEntityAI.startTiming(); // Spigot
|
||||
if (this.bD()) {
|
||||
this.aY = false;
|
||||
this.aZ = 0.0F;
|
||||
if (this.cf()) {
|
||||
this.bc = false;
|
||||
this.bd = 0.0F;
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
this.doTick();
|
||||
this.world.methodProfiler.b();
|
||||
@ -226,37 +215,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("jump");
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
this.aZ *= 0.98F;
|
||||
this.ba *= 0.98F;
|
||||
this.bb *= 0.9F;
|
||||
this.be *= 0.98F;
|
||||
this.bf *= 0.9F;
|
||||
this.r();
|
||||
+ SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
|
||||
this.g(this.aZ, this.ba);
|
||||
this.g(this.bd, this.be);
|
||||
+ SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("push");
|
||||
if (!this.world.isClientSide) {
|
||||
+ SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
|
||||
this.bL();
|
||||
+ SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
+ SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
|
||||
this.cn();
|
||||
+ SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
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 @@ import jline.console.ConsoleReader;
|
||||
import joptsimple.OptionSet;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
|
||||
import org.bukkit.craftbukkit.Main;
|
||||
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot
|
||||
// CraftBukkit start
|
||||
// CraftBukkit end
|
||||
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot
|
||||
|
||||
public abstract class MinecraftServer implements Runnable, ICommandListener, IAsyncTaskHandler, IMojangStatistics {
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
protected void z() {}
|
||||
|
||||
protected void A() throws ExceptionWorldConflict { // CraftBukkit - added throws
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
protected void B() {}
|
||||
|
||||
protected void C() throws ExceptionWorldConflict { // CraftBukkit - added throws
|
||||
+ SpigotTimings.serverTickTimer.startTiming(); // Spigot
|
||||
long i = System.nanoTime();
|
||||
|
||||
@ -282,7 +270,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ org.spigotmc.CustomTimingsHandler.tick(); // Spigot
|
||||
}
|
||||
|
||||
public void B() {
|
||||
public void D() {
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
|
||||
this.methodProfiler.c("levels");
|
||||
@ -350,7 +338,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
this.methodProfiler.c("connection");
|
||||
+ SpigotTimings.connectionTimer.startTiming(); // Spigot
|
||||
this.aq().c();
|
||||
this.am().c();
|
||||
+ SpigotTimings.connectionTimer.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("players");
|
||||
+ SpigotTimings.playerListTimer.startTiming(); // Spigot
|
||||
@ -359,8 +347,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.methodProfiler.c("tickables");
|
||||
|
||||
+ SpigotTimings.tickablesTimer.startTiming(); // Spigot
|
||||
for (i = 0; i < this.p.size(); ++i) {
|
||||
((IUpdatePlayerListBox) this.p.get(i)).c();
|
||||
for (i = 0; i < this.o.size(); ++i) {
|
||||
((ITickable) this.o.get(i)).c();
|
||||
}
|
||||
+ SpigotTimings.tickablesTimer.stopTiming(); // Spigot
|
||||
|
||||
@ -370,15 +358,15 @@ 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 PacketListenerPlayIn, IUpdatePlayerList
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
// CraftBukkit end
|
||||
|
||||
private void handleCommand(String s) {
|
||||
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
|
||||
// CraftBukkit start - whole method
|
||||
this.c.info(this.player.getName() + " issued server command: " + s);
|
||||
this.LOGGER.info(this.player.getName() + " issued server command: " + s);
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
@ -422,16 +410,16 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.Bukkit;
|
||||
@@ -0,0 +0,0 @@ import com.google.common.collect.Maps;
|
||||
import java.util.Map;
|
||||
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;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
private int tickPosition;
|
||||
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
|
||||
|
||||
+ public final SpigotTimings.WorldTimingsHandler timings; // Spigot
|
||||
@ -440,16 +428,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return this.world;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
});
|
||||
this.getServer().addWorld(this.world);
|
||||
// CraftBukkit end
|
||||
+ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
|
||||
this.isClientSide = flag;
|
||||
this.N = worldprovider.getWorldBorder();
|
||||
this.getServer().addWorld(this.world); // CraftBukkit
|
||||
+ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
|
||||
}
|
||||
|
||||
public World b() {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.g.clear();
|
||||
this.methodProfiler.c("regular");
|
||||
CrashReportSystemDetails crashreportsystemdetails1;
|
||||
CrashReport crashreport1;
|
||||
|
||||
+ timings.entityTick.startTiming(); // Spigot
|
||||
// CraftBukkit start - Use field for loop variable
|
||||
@ -457,32 +445,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
entity = (Entity) this.entityList.get(this.tickPosition);
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.methodProfiler.a("tick");
|
||||
if (!entity.dead) {
|
||||
if (!entity.dead && !(entity instanceof EntityPlayer)) {
|
||||
try {
|
||||
+ SpigotTimings.tickEntityTimer.startTiming(); // Spigot
|
||||
this.g(entity);
|
||||
+ SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
|
||||
} catch (Throwable throwable1) {
|
||||
crashreport = CrashReport.a(throwable1, "Ticking entity");
|
||||
crashreportsystemdetails = crashreport.a("Entity being ticked");
|
||||
crashreport1 = CrashReport.a(throwable1, "Ticking entity");
|
||||
crashreportsystemdetails1 = crashreport1.a("Entity being ticked");
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.methodProfiler.b();
|
||||
}
|
||||
|
||||
+ timings.entityTick.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("blockEntities");
|
||||
+ timings.tileEntityTick.startTiming(); // Spigot
|
||||
this.M = true;
|
||||
// CraftBukkit start - From below, clean up tile entities before ticking them
|
||||
if (!this.c.isEmpty()) {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
if (this.isLoaded(blockposition) && this.N.a(blockposition)) {
|
||||
try {
|
||||
this.methodProfiler.a(tileentity.getClass().getSimpleName());
|
||||
+ tileentity.tickTimer.startTiming(); // Spigot
|
||||
((IUpdatePlayerListBox) tileentity).c();
|
||||
((ITickable) tileentity).c();
|
||||
this.methodProfiler.b();
|
||||
} catch (Throwable throwable2) {
|
||||
CrashReport crashreport1 = CrashReport.a(throwable2, "Ticking block entity");
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
tileentity.a(crashreportsystemdetails1);
|
||||
throw new ReportedException(crashreport1);
|
||||
@ -503,7 +489,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ timings.tileEntityPending.startTiming(); // Spigot
|
||||
this.M = false;
|
||||
/* CraftBukkit start - Moved up
|
||||
if (!this.c.isEmpty()) {
|
||||
if (!this.tileEntityListUnload.isEmpty()) {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.b.clear();
|
||||
}
|
||||
@ -518,8 +504,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) {
|
||||
+ entity.tickTimer.startTiming(); // Spigot
|
||||
// CraftBukkit end
|
||||
entity.P = entity.locX;
|
||||
entity.Q = entity.locY;
|
||||
entity.M = entity.locX;
|
||||
entity.N = entity.locY;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
}
|
||||
@ -537,12 +523,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
long time = this.worldData.getTime();
|
||||
if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) {
|
||||
+ timings.mobSpawn.startTiming(); // Spigot
|
||||
this.R.a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L);
|
||||
this.spawnerCreature.a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L);
|
||||
+ timings.mobSpawn.stopTiming(); // Spigot
|
||||
// CraftBukkit end
|
||||
}
|
||||
-
|
||||
+ // CraftBukkit end
|
||||
|
||||
+ timings.doChunkUnload.startTiming(); // Spigot
|
||||
this.methodProfiler.c("chunkSource");
|
||||
this.chunkProvider.unloadChunks();
|
||||
@ -558,7 +543,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ timings.doTickPending.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("tickBlocks");
|
||||
+ timings.doTickTiles.startTiming(); // Spigot
|
||||
this.h();
|
||||
this.j();
|
||||
+ timings.doTickTiles.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("chunkMap");
|
||||
+ timings.doChunkMap.startTiming(); // Spigot
|
||||
@ -571,11 +556,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ timings.doVillages.stopTiming(); // Spigot
|
||||
this.methodProfiler.c("portalForcer");
|
||||
+ timings.doPortalForcer.startTiming(); // Spigot
|
||||
this.Q.a(this.getTime());
|
||||
this.portalTravelAgent.a(this.getTime());
|
||||
+ timings.doPortalForcer.stopTiming(); // Spigot
|
||||
this.methodProfiler.b();
|
||||
+ timings.doSounds.startTiming(); // Spigot
|
||||
this.ak();
|
||||
this.ao();
|
||||
+ timings.doSounds.stopTiming(); // Spigot
|
||||
|
||||
this.getWorld().processChunkGC(); // CraftBukkit
|
||||
+ timings.doChunkGC.stopTiming(); // Spigot
|
||||
@ -603,13 +589,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
net.minecraft.server.Chunk chunk = world.chunkProviderServer.chunks.get(LongHash.toLong(x, z));
|
||||
net.minecraft.server.Chunk chunk = world.getChunkProviderServer().chunks.get(LongHash.toLong(x, z));
|
||||
|
||||
if (chunk == null) {
|
||||
+ world.timings.syncChunkLoadTimer.startTiming(); // Spigot
|
||||
chunk = world.chunkProviderServer.loadChunk(x, z);
|
||||
|
||||
chunkLoadPostProcess(chunk, x, z);
|
||||
chunk = world.getChunkProviderServer().getOrLoadChunkAt(x, z);
|
||||
+ world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
|
||||
}
|
||||
return chunk != null;
|
||||
@ -797,9 +781,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
|
||||
chunk.addEntities();
|
||||
|
||||
if (queuedChunk.provider.chunkProvider != null) {
|
||||
if (queuedChunk.provider.chunkGenerator != null) {
|
||||
+ queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot
|
||||
queuedChunk.provider.chunkProvider.recreateStructures(chunk, queuedChunk.x, queuedChunk.z);
|
||||
queuedChunk.provider.chunkGenerator.recreateStructures(chunk, queuedChunk.x, queuedChunk.z);
|
||||
+ queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot
|
||||
}
|
||||
|
@ -12,16 +12,16 @@ 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 {
|
||||
private long u;
|
||||
private int v;
|
||||
private ConcurrentLinkedQueue<BlockPosition> w;
|
||||
private long v;
|
||||
private int w;
|
||||
private ConcurrentLinkedQueue<BlockPosition> x;
|
||||
+ protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot
|
||||
|
||||
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
|
||||
private int neighbors = 0x1 << 12;
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
entity.af = k;
|
||||
entity.ag = this.locZ;
|
||||
entity.ac = k;
|
||||
entity.ad = this.locZ;
|
||||
this.entitySlices[k].add(entity);
|
||||
+ // Spigot start - increment creature type count
|
||||
+ // Keep this synced up with World.a(Class)
|
||||
@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
public boolean d(BlockPosition blockposition) {
|
||||
public boolean c(BlockPosition blockposition) {
|
||||
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
|
||||
@ -83,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ Long coord = it.next();
|
||||
+ int x = LongHash.msw( coord );
|
||||
+ int z = LongHash.lsw( coord );
|
||||
+ if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) )
|
||||
+ if ( !((ChunkProviderServer)server.chunkProvider).unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) )
|
||||
+ {
|
||||
+ i += server.getChunkAt( x, z ).entityCount.get( oClass );
|
||||
+ }
|
||||
@ -120,29 +120,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
- if (k <= l1) {
|
||||
+ if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 256) {
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
Iterator iterator1 = this.b.iterator();
|
||||
|
||||
+ int moblimit = (limit * i / 256) - mobcnt + 1; // Spigot - up to 1 more than limit
|
||||
label115:
|
||||
label120:
|
||||
- while (iterator1.hasNext()) {
|
||||
+ while (iterator1.hasNext() && (moblimit > 0)) { // Spigot - while more allowed
|
||||
// CraftBukkit start = use LongHash and LongObjectHashMap
|
||||
long key = ((Long) iterator1.next()).longValue();
|
||||
BlockPosition blockposition1 = getRandomPosition(worldserver, LongHash.msw(key), LongHash.lsw(key));
|
||||
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
|
||||
worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); // CraftBukkit - Added a reason for spawning this creature
|
||||
entityinsentient.die();
|
||||
}
|
||||
|
||||
- if (l2 >= entityinsentient.cJ()) {
|
||||
+ // Spigot start
|
||||
+ if ( --moblimit <= 0 )
|
||||
+ {
|
||||
+ if ( --moblimit <= 0 ) {
|
||||
+ // If we're past limit, stop spawn
|
||||
+ continue label115;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
if (l2 >= entityinsentient.bV()) {
|
||||
continue label115;
|
||||
+ // Spigot end
|
||||
continue label120;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
|
||||
// Craftbukkit end */
|
||||
|
||||
|
||||
this.W();
|
||||
this.aj();
|
||||
- if (!this.world.isClientSide && this.age >= 6000) {
|
||||
+ if (!this.world.isClientSide && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot
|
||||
// CraftBukkit start - fire ItemDespawnEvent
|
||||
@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
log( "*** WARNING *** Please use this option with caution, SpigotMC is not responsible for any issues this option may cause in the future!" );
|
||||
}
|
||||
mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 );
|
||||
log( "Mob Spawn Range: " + mobSpawnRange );
|
||||
}
|
||||
+
|
||||
+ public int itemDespawnRate;
|
@ -16,37 +16,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public int ticksLived;
|
||||
public int maxFireTicks;
|
||||
public int fireTicks;
|
||||
- protected boolean inWater;
|
||||
- public boolean inWater;
|
||||
+ public boolean inWater; // Spigot - protected -> public // PAIL
|
||||
public int noDamageTicks;
|
||||
protected boolean justCreated;
|
||||
protected boolean fireProof;
|
||||
protected DataWatcher datawatcher;
|
||||
private double ar;
|
||||
private double as;
|
||||
- public boolean ad;
|
||||
+ public boolean ad; public boolean isAddedToChunk() { return ad; } // Spigot // PAIL
|
||||
public int ae;
|
||||
public int af;
|
||||
public int ag;
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
|
||||
public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949
|
||||
|
||||
+ // Spigot start
|
||||
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
|
||||
+ // Spigot start
|
||||
+ public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
||||
+ public final boolean defaultActivationState;
|
||||
+ public long activatedTick = Integer.MIN_VALUE;
|
||||
+ public void inactiveTick() { }
|
||||
+ // Spigot end
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
public Entity(World world) {
|
||||
this.id = Entity.entityCount++;
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
this.setPosition(0.0D, 0.0D, 0.0D);
|
||||
if (world != null) {
|
||||
this.dimension = world.worldProvider.getDimension();
|
||||
this.dimension = world.worldProvider.getDimensionManager().getDimensionID();
|
||||
+ // Spigot start
|
||||
+ this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, world.spigotConfig);
|
||||
+ } else {
|
||||
@ -55,14 +46,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Spigot end
|
||||
|
||||
this.datawatcher = new DataWatcher(this);
|
||||
this.datawatcher.a(0, Byte.valueOf((byte) 0));
|
||||
this.datawatcher.register(Entity.ax, Byte.valueOf((byte) 0));
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityAgeable extends EntityCreature {
|
||||
private float bn;
|
||||
public boolean ageLocked = false; // CraftBukkit
|
||||
private float bx;
|
||||
public boolean ageLocked; // CraftBukkit
|
||||
|
||||
+ // Spigot start
|
||||
+ @Override
|
||||
@ -96,17 +87,17 @@ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile {
|
||||
private int f = -1;
|
||||
private Block g;
|
||||
private int h;
|
||||
- private boolean inGround;
|
||||
+ public boolean inGround = false; // Spigot - private -> public
|
||||
public int fromPlayer;
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
private int at;
|
||||
private Block au;
|
||||
private int av;
|
||||
- protected boolean inGround;
|
||||
+ public boolean inGround; // Spigot - protected -> public
|
||||
protected int b;
|
||||
public EntityArrow.PickupStatus fromPlayer;
|
||||
public int shake;
|
||||
public Entity shooter;
|
||||
@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile {
|
||||
private double damage = 2.0D;
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
private double damage;
|
||||
public int knockbackStrength;
|
||||
|
||||
+ // Spigot Start
|
||||
@ -115,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ {
|
||||
+ if ( this.inGround )
|
||||
+ {
|
||||
+ this.ar += 1; // Despawn counter. First int after shooter
|
||||
+ this.aw += 1; // Despawn counter. First int after shooter
|
||||
+ }
|
||||
+ super.inactiveTick();
|
||||
+ }
|
||||
@ -123,27 +114,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
public EntityArrow(World world) {
|
||||
super(world);
|
||||
this.j = 10.0D;
|
||||
this.h = -1;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFireworks extends Entity {
|
||||
private int ticksFlown;
|
||||
public int expectedLifespan;
|
||||
this.setSize(0.25F, 0.25F);
|
||||
}
|
||||
|
||||
+ // Spigot Start
|
||||
+ @Override
|
||||
+ public void inactiveTick()
|
||||
+ {
|
||||
+ public void inactiveTick() {
|
||||
+ this.ticksFlown += 1;
|
||||
+ super.inactiveTick();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+
|
||||
public EntityFireworks(World world) {
|
||||
super(world);
|
||||
this.setSize(0.25F, 0.25F);
|
||||
protected void i() {
|
||||
this.datawatcher.register(EntityFireworks.FIREWORK_ITEM, Optional.absent());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@ -174,7 +164,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+
|
||||
private void w() {
|
||||
private void x() {
|
||||
// Spigot start
|
||||
double radius = world.spigotConfig.itemMerge;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@ -182,8 +172,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
public int maxAirTicks = 300;
|
||||
ArrayList<org.bukkit.inventory.ItemStack> drops = null;
|
||||
ArrayList<org.bukkit.inventory.ItemStack> drops;
|
||||
public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
|
||||
// CraftBukkit end
|
||||
+ // Spigot start
|
||||
+ public void inactiveTick()
|
||||
@ -193,15 +183,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Spigot end
|
||||
|
||||
public void G() {
|
||||
public void Q() {
|
||||
this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
|
||||
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 {
|
||||
this.g.clear();
|
||||
this.methodProfiler.c("regular");
|
||||
CrashReportSystemDetails crashreportsystemdetails1;
|
||||
CrashReport crashreport1;
|
||||
|
||||
+ org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||
timings.entityTick.startTiming(); // Spigot
|
||||
@ -221,7 +211,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ } else {
|
||||
entity.tickTimer.startTiming(); // Spigot
|
||||
// CraftBukkit end
|
||||
entity.P = entity.locX;
|
||||
entity.M = entity.locX;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
|
||||
@ -244,8 +234,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import java.util.Set;
|
||||
+import net.minecraft.server.AxisAlignedBB;
|
||||
+import net.minecraft.server.Chunk;
|
||||
@ -275,15 +263,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.World;
|
||||
+import org.bukkit.craftbukkit.SpigotTimings;
|
||||
+import org.bukkit.entity.Creeper;
|
||||
+
|
||||
+public class ActivationRange
|
||||
+{
|
||||
+
|
||||
+ static AxisAlignedBB maxBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB miscBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB animalBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB monsterBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB maxBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB miscBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB animalBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB monsterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
|
||||
+
|
||||
+ /**
|
||||
+ * Initializes an entities type on construction to specify what group this
|
||||
@ -352,7 +339,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ maxRange = Math.max( maxRange, miscActivationRange );
|
||||
+ maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );
|
||||
+
|
||||
+ for ( Entity player : (List<Entity>) world.players )
|
||||
+ for ( EntityHuman player : world.players )
|
||||
+ {
|
||||
+
|
||||
+ player.activatedTick = MinecraftServer.currentTick;
|
||||
@ -434,14 +421,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public static boolean checkEntityImmunities(Entity entity)
|
||||
+ {
|
||||
+ // quick checks.
|
||||
+ if ( entity.inWater /* isInWater */ || entity.fireTicks > 0 )
|
||||
+ if ( entity.inWater || entity.fireTicks > 0 )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if ( !( entity instanceof EntityArrow ) )
|
||||
+ {
|
||||
+ if ( !entity.onGround || entity.passenger != null
|
||||
+ || entity.vehicle != null )
|
||||
+ if ( !entity.onGround || !entity.passengers.isEmpty() || entity.getVehicle()!= null )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
@ -461,14 +447,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).ck() /* Getter for first boolean */ )
|
||||
+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).da() /* Getter for first boolean */ )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if ( entity instanceof EntityAnimal )
|
||||
+ {
|
||||
+ EntityAnimal animal = (EntityAnimal) entity;
|
||||
+ if ( animal.isBaby() || animal.cp() /*love*/ )
|
||||
+ if ( animal.isBaby() || animal.isInLove() )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
@ -477,7 +463,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ if (entity instanceof EntityCreeper && ((EntityCreeper) entity).cn()) { // isExplosive
|
||||
+ if (entity instanceof EntityCreeper && ((EntityCreeper) entity).isIgnited()) { // isExplosive
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
@ -494,7 +480,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ {
|
||||
+ SpigotTimings.checkIfActiveTimer.startTiming();
|
||||
+ // Never safe to skip fireworks or entities not yet added to chunk
|
||||
+ if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) {
|
||||
+ // PAIL: inChunk
|
||||
+ if ( !entity.aa || entity instanceof EntityFireworks ) {
|
||||
+ SpigotTimings.checkIfActiveTimer.stopTiming();
|
||||
+ return true;
|
||||
+ }
|
||||
@ -536,8 +523,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 );
|
||||
log( "Mob Spawn Range: " + mobSpawnRange );
|
||||
itemDespawnRate = getInt( "item-despawn-rate", 6000 );
|
||||
log( "Item Despawn Rate: " + itemDespawnRate );
|
||||
}
|
||||
+
|
||||
+ public int animalActivationRange = 32;
|
||||
|
@ -42,8 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void damage(int i, EntityLiving entityliving) {
|
||||
if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
|
||||
if (this.e()) {
|
||||
- if (this.isDamaged(i, entityliving.bc())) {
|
||||
+ if (this.isDamaged(i, entityliving.bc(), entityliving)) { // Spigot
|
||||
- if (this.isDamaged(i, entityliving.getRandom())) {
|
||||
+ if (this.isDamaged(i, entityliving.getRandom(), entityliving)) { // Spigot
|
||||
entityliving.b(this);
|
||||
--this.count;
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
|
@ -20,48 +20,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void addEntity(Entity entity, int i, final int j, boolean flag) {
|
||||
org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot
|
||||
+ i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot
|
||||
if (i > this.e) {
|
||||
i = this.e;
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
maxRange = Math.max( maxRange, miscActivationRange );
|
||||
maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );
|
||||
|
||||
- for ( Entity player : (List<Entity>) world.players )
|
||||
+ for ( Entity player : (List<Entity>) (List) world.players )
|
||||
{
|
||||
|
||||
player.activatedTick = MinecraftServer.currentTick;
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
public static boolean checkEntityImmunities(Entity entity)
|
||||
{
|
||||
// quick checks.
|
||||
- if ( entity.inWater /* isInWater */ || entity.fireTicks > 0 )
|
||||
+ if ( entity.inWater || entity.fireTicks > 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).ck() /* Getter for first boolean */ )
|
||||
+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).cm() /* Getter for first boolean */ )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( entity instanceof EntityAnimal )
|
||||
{
|
||||
EntityAnimal animal = (EntityAnimal) entity;
|
||||
- if ( animal.isBaby() || animal.cp() /*love*/ )
|
||||
+ if ( animal.isBaby() || animal.isInLove() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
if (this.trackedEntities.b(entity.getId())) {
|
||||
throw new IllegalStateException("Entity is already tracked!");
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
|
@ -15,13 +15,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @Override
|
||||
+ public double getDamage()
|
||||
+ {
|
||||
+ return getHandle().j();
|
||||
+ return getHandle().k();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setDamage(double damage)
|
||||
+ {
|
||||
+ getHandle().b( damage );
|
||||
+ getHandle().c( damage );
|
||||
+ }
|
||||
};
|
||||
|
||||
|
@ -9,12 +9,12 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
- this.d(8);
|
||||
+ this.d(world.spigotConfig.hopperTransfer); // Spigot
|
||||
- this.setCooldown(8);
|
||||
+ this.setCooldown(world.spigotConfig.hopperTransfer); // Spigot
|
||||
this.update();
|
||||
return true;
|
||||
}
|
||||
@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
// ItemStack itemstack1 = addItem(iinventory, this.splitStack(i, 1), enumdirection);
|
||||
|
||||
// CraftBukkit start - Call event when pushing items into other inventories
|
||||
@ -32,19 +32,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
Inventory destinationInventory;
|
||||
// Have to special case large chests as they work oddly
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
this.getWorld().getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
this.setItem(i, itemstack);
|
||||
- this.d(8); // Delay hopper checks
|
||||
+ this.d(world.spigotConfig.hopperTransfer); // Spigot
|
||||
- this.setCooldown(8); // Delay hopper checks
|
||||
+ this.setCooldown(world.spigotConfig.hopperTransfer); // Spigot
|
||||
return false;
|
||||
}
|
||||
+ int origCount = event.getItem().getAmount(); // Spigot
|
||||
ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection);
|
||||
|
||||
if (itemstack1 == null || itemstack1.count == 0) {
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
// CraftBukkit end
|
||||
return true;
|
||||
}
|
||||
@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.setItem(i, itemstack);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
// ItemStack itemstack2 = addItem(ihopper, iinventory.splitStack(i, 1), (EnumDirection) null);
|
||||
// CraftBukkit start - Call event on collection of items from inventories into the hopper
|
||||
@ -62,15 +62,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
Inventory sourceInventory;
|
||||
// Have to special case large chests as they work oddly
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
iinventory.setItem(i, itemstack1);
|
||||
|
||||
if (ihopper instanceof TileEntityHopper) {
|
||||
- ((TileEntityHopper) ihopper).d(8); // Delay hopper checks
|
||||
+ ((TileEntityHopper) ihopper).d(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot
|
||||
- ((TileEntityHopper) ihopper).setCooldown(8); // Delay hopper checks
|
||||
+ ((TileEntityHopper) ihopper).setCooldown(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot
|
||||
} else if (ihopper instanceof EntityMinecartHopper) {
|
||||
- ((EntityMinecartHopper) ihopper).m(4); // Delay hopper minecart checks
|
||||
+ ((EntityMinecartHopper) ihopper).m(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot
|
||||
- ((EntityMinecartHopper) ihopper).setCooldown(4); // Delay hopper minecart checks
|
||||
+ ((EntityMinecartHopper) ihopper).setCooldown(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot
|
||||
}
|
||||
-
|
||||
return false;
|
||||
@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), null);
|
||||
|
||||
if (itemstack2 == null || itemstack2.count == 0) {
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
// CraftBukkit end
|
||||
return true;
|
||||
}
|
||||
@ -87,12 +87,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
iinventory.setItem(i, itemstack1);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
TileEntityHopper tileentityhopper = (TileEntityHopper) iinventory;
|
||||
|
||||
if (tileentityhopper.o()) {
|
||||
- tileentityhopper.d(8);
|
||||
+ tileentityhopper.d(tileentityhopper.world.spigotConfig.hopperTransfer); // Spigot
|
||||
if (tileentityhopper.p()) {
|
||||
- tileentityhopper.setCooldown(8);
|
||||
+ tileentityhopper.setCooldown(tileentityhopper.world.spigotConfig.hopperTransfer); // Spigot
|
||||
}
|
||||
|
||||
iinventory.update();
|
||||
|
@ -1,101 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shulman <andy.shulman@hotmail.com>
|
||||
Date: Mon, 15 Apr 2013 20:06:37 -0500
|
||||
Subject: [PATCH] Implement SpawnerSpawnEvent.
|
||||
|
||||
Adds BUKKIT-267
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
@@ -0,0 +0,0 @@ import com.google.common.collect.Lists;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
-import org.bukkit.event.entity.CreatureSpawnEvent; // CraftBukkit
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.SpawnerSpawnEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public abstract class MobSpawnerAbstract {
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
|
||||
|
||||
entity.f(nbttagcompound);
|
||||
if (entity.world != null && flag) {
|
||||
- entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ // CraftBukkit start - call SpawnerSpawnEvent, abort if cancelled
|
||||
+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound1;
|
||||
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
|
||||
|
||||
entity2.f(nbttagcompound2);
|
||||
entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch);
|
||||
+ // CraftBukkit start - call SpawnerSpawnEvent, skip if cancelled
|
||||
+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity2, this.b().getX(), this.b().getY(), this.b().getZ());
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
if (entity.world != null && flag) {
|
||||
entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null);
|
||||
}
|
||||
-
|
||||
- entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ // Spigot start - call SpawnerSpawnEvent, abort if cancelled
|
||||
+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
return entity;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.Statistic.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftStatistic;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
+ * Mob spawner event
|
||||
+ */
|
||||
+ public static SpawnerSpawnEvent callSpawnerSpawnEvent(Entity spawnee, int spawnerX, int spawnerY, int spawnerZ) {
|
||||
+ org.bukkit.craftbukkit.entity.CraftEntity entity = spawnee.getBukkitEntity();
|
||||
+ BlockState state = entity.getWorld().getBlockAt(spawnerX, spawnerY, spawnerZ).getState();
|
||||
+
|
||||
+ if (!(state instanceof CreatureSpawner)) {
|
||||
+ state = null;
|
||||
+ }
|
||||
+
|
||||
+ SpawnerSpawnEvent event = new SpawnerSpawnEvent(entity, (CreatureSpawner) state);
|
||||
+ entity.getServer().getPluginManager().callEvent(event);
|
||||
+ return event;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
* Bucket methods
|
||||
*/
|
||||
public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, EnumDirection clickedFace, ItemStack itemInHand) {
|
||||
--
|
@ -8,12 +8,12 @@ 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 PacketListenerPlayIn, IUpdatePlayerList
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
private void handleCommand(String s) {
|
||||
org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
|
||||
// CraftBukkit start - whole method
|
||||
+ if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
|
||||
this.c.info(this.player.getName() + " issued server command: " + s);
|
||||
this.LOGGER.info(this.player.getName() + " issued server command: " + s);
|
||||
|
||||
CraftPlayer player = this.getPlayer();
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
@ -11,15 +11,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
// CraftBukkit end
|
||||
|
||||
if (packethandshakinginsetprotocol.b() > 47) {
|
||||
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.8");
|
||||
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), "1.8.8" ) ); // Spigot
|
||||
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
|
||||
if (packethandshakinginsetprotocol.b() > 107) {
|
||||
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.9");
|
||||
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), "1.9" ) ); // Spigot
|
||||
this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext));
|
||||
this.b.close(chatcomponenttext);
|
||||
} else if (packethandshakinginsetprotocol.b() < 47) {
|
||||
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8.8");
|
||||
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), "1.8.8" ) ); // Spigot
|
||||
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
|
||||
} else if (packethandshakinginsetprotocol.b() < 107) {
|
||||
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.9");
|
||||
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), "1.9" ) ); // Spigot
|
||||
this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext));
|
||||
this.b.close(chatcomponenttext);
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
@ -11,25 +11,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
}
|
||||
|
||||
this.p = true;
|
||||
this.q = true;
|
||||
- if (!this.lit && this.done) {
|
||||
+ if (!this.lit && this.done && this.world.spigotConfig.randomLightUpdates) { // Spigot - also use random light updates setting to determine if we should relight
|
||||
this.n();
|
||||
this.o();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.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 {
|
||||
}
|
||||
--- 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 implements IAsyncTaskHandler {
|
||||
|
||||
protected void i() {
|
||||
this.methodProfiler.a("playerCheckLight");
|
||||
- if (!this.players.isEmpty()) {
|
||||
+ if (spigotConfig.randomLightUpdates && !this.players.isEmpty()) { // Spigot
|
||||
i = this.random.nextInt(this.players.size());
|
||||
entityhuman = (EntityHuman) this.players.get(i);
|
||||
j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5;
|
||||
int i = this.random.nextInt(this.players.size());
|
||||
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
|
||||
int j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5;
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
@ -47,21 +47,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
// Do not pass along players, as doing so can get them stuck outside of time.
|
||||
// (which for example disables inventory icon updates and prevents block breaking)
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
+ // Spigot Start
|
||||
+ for ( HumanEntity human : new java.util.ArrayList<HumanEntity>( transaction ) )
|
||||
+ {
|
||||
+ human.closeInventory();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
this.b = false;
|
||||
super.c(i);
|
||||
}
|
||||
--
|
@ -8,8 +8,8 @@ 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 PacketListenerPlayIn, IUpdatePlayerList
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u());
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
Entity entity = packetplayinuseentity.a((World) worldserver);
|
||||
+ // Spigot Start
|
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Sat, 27 Feb 2016 10:07:58 +1100
|
||||
Subject: [PATCH] Entity Mount and Dismount Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
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 implements ICommandListener {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Spigot start
|
||||
+ org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent(this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bt() instanceof EntityHuman)) {
|
||||
this.passengers.add(0, entity);
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), entity.getBukkitEntity() ) ); // Spigot
|
||||
this.passengers.remove(entity);
|
||||
entity.j = 60;
|
||||
}
|
||||
--
|
@ -1,50 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Tue, 2 Jul 2013 20:32:49 +1000
|
||||
Subject: [PATCH] Entity Mount and Dismount Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
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 implements ICommandListener {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
|
||||
this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
|
||||
this.vehicle.passenger = null;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Spigot Start
|
||||
+ if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4, true ) )
|
||||
+ {
|
||||
+ org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent( this.getBukkitEntity(), entity.getBukkitEntity() );
|
||||
+ pluginManager.callEvent( event );
|
||||
+ if ( event.isCancelled() )
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+
|
||||
if (this.vehicle != null) {
|
||||
this.vehicle.passenger = null;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
|
||||
|
||||
if (!this.world.isClientSide) {
|
||||
this.q(this.vehicle);
|
||||
--
|
@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
- private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = Maps.newHashMap();
|
||||
+ private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = new java.util.WeakHashMap(); // Spigot
|
||||
- private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> g = Maps.newHashMap();
|
||||
+ private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> g = new java.util.WeakHashMap(); // Spigot
|
||||
private final boolean isOn;
|
||||
|
||||
private boolean a(World world, BlockPosition blockposition, boolean flag) {
|
@ -12,12 +12,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
List list = this.world.getEntities(this, axisalignedbb);
|
||||
|
||||
+ if (this.ae()) { // Spigot: Add this.ae() condition (second !this.isDead near bottom of EntityLiving)
|
||||
+ if (this.isCollidable()) { // Spigot: Add isCollidable() condition (second !this.isDead near bottom of EntityLiving)
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.d(entity);
|
||||
this.c(entity);
|
||||
}
|
||||
}
|
||||
+ } // Spigot
|
||||
@ -29,14 +29,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}));
|
||||
protected void cn() {
|
||||
List list = this.world.a((Entity) this, this.getBoundingBox(), IEntitySelector.a(this));
|
||||
|
||||
- if (!list.isEmpty()) {
|
||||
+ if (this.ad() && !list.isEmpty()) { // Spigot: Add this.ad() condition
|
||||
+ if (this.isInteractable() && !list.isEmpty()) { // Spigot: Add isInteractable() condition
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
// TODO better check now?
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@ -49,15 +49,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public boolean collidesWithEntities = true;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean ad()
|
||||
+ public boolean isInteractable()
|
||||
+ {
|
||||
+ return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving)
|
||||
+ return this.collidesWithEntities && super.isInteractable(); // (first !this.isDead near bottom of EntityLiving)
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean ae()
|
||||
+ public boolean isCollidable()
|
||||
+ {
|
||||
+ return this.collidesWithEntities && super.ae(); // (second !this.isDead near bottom of EntityLiving)
|
||||
+ return this.collidesWithEntities && super.isCollidable(); // (second !this.isDead near bottom of EntityLiving)
|
||||
+ }
|
||||
+ // Spigot end
|
||||
|
||||
@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public void setCollidesWithEntities(boolean collides)
|
||||
+ {
|
||||
+ getHandle().collidesWithEntities = collides;
|
||||
+ getHandle().k = collides; // First boolean of Entity
|
||||
+ getHandle().i = collides; // First boolean of Entity
|
||||
+ }
|
||||
};
|
||||
|
@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.h[this.ticks % 100] = System.nanoTime() - i;
|
||||
this.methodProfiler.b();
|
||||
this.methodProfiler.a("snooper");
|
||||
- if (!this.n.d() && this.ticks > 100) {
|
||||
+ if (getSnooperEnabled() && !this.n.d() && this.ticks > 100) { // Spigot
|
||||
this.n.a();
|
||||
- if (!this.m.d() && this.ticks > 100) {
|
||||
+ if (getSnooperEnabled() && !this.m.d() && this.ticks > 100) { // Spigot
|
||||
this.m.a();
|
||||
}
|
||||
|
||||
- if (this.ticks % 6000 == 0) {
|
||||
+ if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot
|
||||
this.n.b();
|
||||
this.m.b();
|
||||
}
|
||||
|
||||
--
|
@ -10,20 +10,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
|
||||
|
||||
private void a(World world) {
|
||||
if (this.d == null) {
|
||||
protected void a(World world) {
|
||||
if (this.a == null) {
|
||||
- this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a());
|
||||
+ // Spigot Start
|
||||
+ if ( world.spigotConfig.saveStructureInfo )
|
||||
+ {
|
||||
this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a());
|
||||
+ } else
|
||||
+ {
|
||||
+ this.d = new PersistentStructure( this.a() );
|
||||
+ if (world.spigotConfig.saveStructureInfo) {
|
||||
+ this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a());
|
||||
+ } else {
|
||||
+ this.a = new PersistentStructure(this.a());
|
||||
+ }
|
||||
+ // Spigot End
|
||||
if (this.d == null) {
|
||||
this.d = new PersistentStructure(this.a());
|
||||
world.a(this.a(), (PersistentBase) this.d);
|
||||
if (this.a == null) {
|
||||
this.a = new PersistentStructure(this.a());
|
||||
world.a(this.a(), (PersistentBase) this.a);
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sat, 14 Sep 2013 10:16:38 +1000
|
||||
Subject: [PATCH] Update Inventory and Health for PlayerConsumeItemEvent
|
||||
|
||||
|
||||
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 {
|
||||
// Update client
|
||||
if (this instanceof EntityPlayer) {
|
||||
((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.getSlot((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.g));
|
||||
+ // Spigot Start
|
||||
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
|
||||
+ ((EntityPlayer) this).getBukkitEntity().updateScaledHealth();
|
||||
+ // Spigot End
|
||||
}
|
||||
return;
|
||||
}
|
||||
--
|
@ -8,7 +8,7 @@ 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 PacketListenerPlayIn, IUpdatePlayerList
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
private float lastPitch = Float.MAX_VALUE;
|
||||
private float lastYaw = Float.MAX_VALUE;
|
||||
private boolean justTeleported = false;
|
||||
@ -16,8 +16,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public CraftPlayer getPlayer() {
|
||||
return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity();
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
|
||||
// CraftBukkit start - fire PlayerMoveEvent
|
||||
Player player = this.getPlayer();
|
||||
+ // Spigot Start
|
||||
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.
|
||||
Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
this.lastPitch = to.getPitch();
|
||||
|
||||
// Skip the first time we do this
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
getHandle().collidesWithEntities = collides;
|
||||
getHandle().k = collides; // First boolean of Entity
|
||||
getHandle().i = collides; // First boolean of Entity
|
||||
}
|
||||
+
|
||||
+ @Override
|
@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile {
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
|
||||
if (block == this.g && i == this.h) {
|
||||
++this.ar;
|
||||
- if (this.ar >= 1200) {
|
||||
+ if (this.ar >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter
|
||||
if (block == this.au && i == this.av) {
|
||||
++this.aw;
|
||||
- if (this.aw >= 1200) {
|
||||
+ if (this.aw >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter
|
||||
this.die();
|
||||
}
|
||||
} else {
|
||||
@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
itemDespawnRate = getInt( "item-despawn-rate", 6000 );
|
||||
log( "Item Despawn Rate: " + itemDespawnRate );
|
||||
log( "*** WARNING *** Please use this option with caution, SpigotMC is not responsible for any issues this option may cause in the future!" );
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public int arrowDespawnRate;
|
@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
- if (this.aS() > 0L) {
|
||||
+ if (false && this.aS() > 0L) { // Spigot - disable
|
||||
- if (this.aP() > 0L) {
|
||||
+ if (false && this.aP() > 0L) { // Spigot - disable
|
||||
Thread thread1 = new Thread(new ThreadWatchdog(this));
|
||||
|
||||
thread1.setName("Server Watchdog");
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
public boolean isReady() {
|
||||
- return this.p && this.done && this.lit;
|
||||
- return this.q && this.done && this.lit;
|
||||
+ // Spigot Start
|
||||
+ /*
|
||||
+ * As of 1.7, Mojang added a check to make sure that only chunks which have been lit are sent to the client.
|
||||
@ -24,5 +24,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Spigot End
|
||||
}
|
||||
|
||||
public ChunkCoordIntPair j() {
|
||||
public boolean j() {
|
||||
--
|
@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import javax.crypto.SecretKey;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
|
||||
}
|
||||
|
||||
@ -40,29 +40,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
// CraftBukkit start - fire PlayerLoginEvent
|
||||
EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname);
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
this.g = LoginListener.EnumProtocolState.KEY;
|
||||
this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.Q().getPublic(), this.e));
|
||||
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin(this.j, this.server.O().getPublic(), this.e));
|
||||
} else {
|
||||
- this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
+ // Spigot start
|
||||
+ try {
|
||||
+ initUUID();
|
||||
+ new LoginHandler().fireEvents();
|
||||
+ } catch (Exception ex) {
|
||||
+ disconnect("Failed to verify username!");
|
||||
+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
|
||||
+ }
|
||||
+ new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) {
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ try {
|
||||
+ initUUID();
|
||||
+ new LoginHandler().fireEvents();
|
||||
+ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
+ } catch (Exception ex) {
|
||||
+ disconnect("Failed to verify username!");
|
||||
+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
|
||||
+ }
|
||||
+ }
|
||||
+ }.start();
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
return;
|
||||
}
|
||||
|
||||
+ new LoginHandler().fireEvents();
|
||||
+ } else if (LoginListener.this.server.T()) {
|
||||
+ } else if (LoginListener.this.server.R()) {
|
||||
+ LoginListener.c.warn("Failed to verify username but will let them in anyway!");
|
||||
+ LoginListener.this.i = LoginListener.this.a(gameprofile);
|
||||
+ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
@ -71,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer
|
||||
+ }
|
||||
+ } catch (AuthenticationUnavailableException authenticationunavailableexception) {
|
||||
+ if (LoginListener.this.server.T()) {
|
||||
+ if (LoginListener.this.server.R()) {
|
||||
+ LoginListener.c.warn("Authentication servers are down but will let them in anyway!");
|
||||
+ LoginListener.this.i = LoginListener.this.a(gameprofile);
|
||||
+ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
@ -85,7 +92,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception);
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ }).start();
|
||||
+ }
|
||||
@ -98,11 +104,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
String playerName = i.getName();
|
||||
java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
|
||||
java.util.UUID uniqueId = i.getId();
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
// CraftBukkit end
|
||||
LoginListener.c.info("UUID of player " + LoginListener.this.i.getName() + " is " + LoginListener.this.i.getId());
|
||||
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
- } else if (LoginListener.this.server.T()) {
|
||||
- } else if (LoginListener.this.server.R()) {
|
||||
- LoginListener.c.warn("Failed to verify username but will let them in anyway!");
|
||||
- LoginListener.this.i = LoginListener.this.a(gameprofile);
|
||||
- LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
@ -111,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer
|
||||
- }
|
||||
- } catch (AuthenticationUnavailableException authenticationunavailableexception) {
|
||||
- if (LoginListener.this.server.T()) {
|
||||
- if (LoginListener.this.server.R()) {
|
||||
- LoginListener.c.warn("Authentication servers are down but will let them in anyway!");
|
||||
- LoginListener.this.i = LoginListener.this.a(gameprofile);
|
||||
- LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
@ -126,10 +132,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- // CraftBukkit end
|
||||
- }
|
||||
-
|
||||
- }
|
||||
}
|
||||
- }).start();
|
||||
}
|
||||
}
|
||||
- }
|
||||
+ // Spigot end
|
||||
|
||||
protected GameProfile a(GameProfile gameprofile) {
|
@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sun, 1 Dec 2013 17:52:14 +1100
|
||||
Subject: [PATCH] Fix packed ice generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
|
||||
@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator {
|
||||
Block block = world.getType(blockposition.a(i1, k, j1)).getBlock();
|
||||
|
||||
if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) {
|
||||
- this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition.a(i1, k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot
|
||||
}
|
||||
|
||||
if (k != 0 && l > 1) {
|
||||
block = world.getType(blockposition.a(i1, -k, j1)).getBlock();
|
||||
if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) {
|
||||
- this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator {
|
||||
Block block1 = world.getType(blockposition1).getBlock();
|
||||
|
||||
if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) {
|
||||
- this.a(world, blockposition1, Blocks.PACKED_ICE.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition1, Blocks.PACKED_ICE.getBlockData()); // Spigot
|
||||
blockposition1 = blockposition1.down();
|
||||
--l1;
|
||||
if (l1 <= 0) {
|
||||
--
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
this.b.close(chatcomponenttext);
|
||||
} else {
|
||||
this.b.a((PacketListener) (new LoginListener(this.a, this.b)));
|
||||
this.b.setPacketListener(new LoginListener(this.a, this.b));
|
||||
+ // Spigot Start
|
||||
+ if (org.spigotmc.SpigotConfig.bungee) {
|
||||
+ String[] split = packethandshakinginsetprotocol.hostname.split("\00");
|
||||
@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ } else
|
||||
+ {
|
||||
+ chatcomponenttext = new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
|
||||
+ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
|
||||
+ this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext));
|
||||
+ this.b.close(chatcomponenttext);
|
||||
+ return;
|
||||
+ }
|
||||
@ -41,14 +41,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot End
|
||||
((LoginListener) this.b.getPacketListener()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname
|
||||
((LoginListener) this.b.i()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname
|
||||
}
|
||||
break;
|
||||
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
// Spigot start
|
||||
public void initUUID()
|
||||
{
|
||||
@ -74,38 +74,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
// Spigot end
|
||||
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
|
||||
this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.Q().getPublic(), this.e));
|
||||
} else {
|
||||
// Spigot start
|
||||
- try {
|
||||
- initUUID();
|
||||
- new LoginHandler().fireEvents();
|
||||
- } catch (Exception ex) {
|
||||
- disconnect("Failed to verify username!");
|
||||
- server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
|
||||
- }
|
||||
+ initUUID();
|
||||
+ new Thread(new Runnable() {
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ try{
|
||||
+ new LoginHandler().fireEvents();
|
||||
+ } catch (Exception ex) {
|
||||
+ disconnect("Failed to verify username!");
|
||||
+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
|
||||
+ }
|
||||
+ }
|
||||
+ }).start();
|
||||
// Spigot end
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
|
||||
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
private final Queue<NetworkManager.QueuedPacket> i = Queues.newConcurrentLinkedQueue();
|
||||
private final ReentrantReadWriteLock j = new ReentrantReadWriteLock();
|
||||
public Channel channel;
|
||||
@ -118,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
private PacketListener m;
|
||||
private IChatBaseComponent n;
|
||||
private boolean o;
|
||||
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
|
||||
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
this.b = agenericfuturelistener;
|
||||
}
|
||||
}
|
||||
@ -137,11 +110,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet<PacketHandshakingI
|
||||
|
||||
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
this.a = packetdataserializer.e();
|
||||
this.a = packetdataserializer.g();
|
||||
- this.hostname = packetdataserializer.c(255);
|
||||
+ this.hostname = packetdataserializer.c(Short.MAX_VALUE); // Spigot
|
||||
this.port = packetdataserializer.readUnsignedShort();
|
||||
this.d = EnumProtocol.a(packetdataserializer.e());
|
||||
this.d = EnumProtocol.a(packetdataserializer.g());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
@ -10,18 +10,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
|
||||
}
|
||||
|
||||
protected void n() {
|
||||
- this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true));
|
||||
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); // Spigot
|
||||
this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, 1.0D, true));
|
||||
this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
|
||||
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityPigZombie.class}));
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
|
||||
- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false));
|
||||
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); // Spigot
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true));
|
||||
- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false));
|
||||
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); // Spigot
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true));
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@ -29,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
|
||||
antiXrayInstance = new AntiXray( this );
|
||||
arrowDespawnRate = getInt( "arrow-despawn-rate", 1200 );
|
||||
log( "Arrow Despawn Rate: " + arrowDespawnRate );
|
||||
}
|
||||
+
|
||||
+ public boolean zombieAggressiveTowardsVillager;
|
@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Tue, 3 Dec 2013 11:07:48 +1100
|
||||
Subject: [PATCH] Clear Flower Pot on Drop
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockFlowerPot.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java
|
||||
@@ -0,0 +0,0 @@ public class BlockFlowerPot extends BlockContainer {
|
||||
|
||||
if (tileentityflowerpot != null && tileentityflowerpot.b() != null) {
|
||||
a(world, blockposition, new ItemStack(tileentityflowerpot.b(), 1, tileentityflowerpot.c()));
|
||||
+ tileentityflowerpot.a( null, 0 ); // Spigot
|
||||
}
|
||||
|
||||
super.remove(world, blockposition, iblockdata);
|
||||
--
|
@ -10,32 +10,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
private final List<IUpdatePlayerListBox> p = Lists.newArrayList();
|
||||
private final List<ITickable> o = Lists.newArrayList();
|
||||
protected final ICommandHandler b;
|
||||
public final MethodProfiler methodProfiler = new MethodProfiler();
|
||||
- private final ServerConnection q;
|
||||
+ private ServerConnection q; // Spigot
|
||||
private final ServerPing r = new ServerPing();
|
||||
private final Random s = new Random();
|
||||
private String serverIp;
|
||||
- private final ServerConnection p;
|
||||
+ private ServerConnection p; // Spigot
|
||||
private final ServerPing q = new ServerPing();
|
||||
private final Random r = new Random();
|
||||
private final DataConverterManager dataConverterManager;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
this.e = proxy;
|
||||
MinecraftServer.l = this;
|
||||
this.W = gameprofilerepository;
|
||||
this.X = usercache;
|
||||
// this.universe = file; // CraftBukkit
|
||||
- this.q = new ServerConnection(this);
|
||||
+ // this.q = new ServerConnection(this); // Spigot
|
||||
this.Z = new UserCache(this, file1);
|
||||
this.b = this.h();
|
||||
- this.p = new ServerConnection(this);
|
||||
+ // this.p = new ServerConnection(this); // Spigot
|
||||
this.b = this.i();
|
||||
// this.convertable = new WorldLoaderServer(file); // CraftBukkit - moved to DedicatedServer.init
|
||||
this.dataConverterManager = dataconvertermanager;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
}
|
||||
// Spigot End
|
||||
public ServerConnection aq() {
|
||||
- return this.q;
|
||||
+ return this.q == null ? this.q = new ServerConnection(this) : this.q; // Spigot
|
||||
public ServerConnection am() {
|
||||
- return this.p;
|
||||
+ return this.p == null ? this.p = new ServerConnection(this) : this.p; // Spigot
|
||||
}
|
||||
|
||||
public boolean as() {
|
||||
public boolean ao() {
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
|
||||
private void a(World world) {
|
||||
if (this.d == null) {
|
||||
protected void a(World world) {
|
||||
if (this.a == null) {
|
||||
// Spigot Start
|
||||
- if ( world.spigotConfig.saveStructureInfo )
|
||||
+ if ( world.spigotConfig.saveStructureInfo && !this.a().equals( "Mineshaft" ) )
|
||||
{
|
||||
this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a());
|
||||
} else
|
||||
- if (world.spigotConfig.saveStructureInfo) {
|
||||
+ if (world.spigotConfig.saveStructureInfo && !this.a().equals( "Mineshaft" )) {
|
||||
this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a());
|
||||
} else {
|
||||
this.a = new PersistentStructure(this.a());
|
||||
--
|
@ -1,412 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Thu, 16 May 2013 18:51:05 +1000
|
||||
Subject: [PATCH] Orebfuscator
|
||||
|
||||
|
||||
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 {
|
||||
blockposition = new BlockPosition(this);
|
||||
if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) {
|
||||
this.world.setAir(blockposition);
|
||||
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
|
||||
} else if (!this.world.isClientSide) {
|
||||
this.die();
|
||||
return;
|
||||
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
|
||||
return;
|
||||
}
|
||||
this.world.setTypeAndData(blockposition, this.block, 3);
|
||||
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
|
||||
// CraftBukkit end
|
||||
if (block instanceof BlockFalling) {
|
||||
((BlockFalling) block).a_(this.world, blockposition);
|
||||
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
||||
@@ -0,0 +0,0 @@ public class Explosion {
|
||||
blockposition = (BlockPosition) iterator.next();
|
||||
Block block = this.world.getType(blockposition).getBlock();
|
||||
|
||||
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
|
||||
if (flag) {
|
||||
double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat());
|
||||
double d1 = (double) ((float) blockposition.getY() + this.world.random.nextFloat());
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
||||
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
|
||||
this.b = chunk.locZ;
|
||||
this.d = flag;
|
||||
this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i);
|
||||
+ chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world);
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
|
||||
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet<PacketListenerPlayOut>
|
||||
private int[] b;
|
||||
private PacketPlayOutMapChunk.ChunkMap[] c;
|
||||
private boolean d;
|
||||
+ private World world; // Spigot
|
||||
|
||||
public PacketPlayOutMapChunkBulk() {}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet<PacketListenerPlayOut>
|
||||
this.b[j] = chunk.locZ;
|
||||
this.c[j] = packetplayoutmapchunk_chunkmap;
|
||||
}
|
||||
-
|
||||
+
|
||||
+ world = ((Chunk) list.get(0)).getWorld(); // Spigot
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet<PacketListenerPlayOut>
|
||||
}
|
||||
|
||||
for (i = 0; i < this.a.length; ++i) {
|
||||
+ world.spigotConfig.antiXrayInstance.obfuscate(this.a[i], this.b[i], this.c[i].b, this.c[i].a, world); // Spigot
|
||||
packetdataserializer.writeBytes(this.c[i].a);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerInteractManager {
|
||||
}
|
||||
|
||||
}
|
||||
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
|
||||
}
|
||||
|
||||
public void a(BlockPosition blockposition) {
|
||||
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 {
|
||||
this.d(blockposition.up(), block);
|
||||
this.d(blockposition.north(), block);
|
||||
this.d(blockposition.south(), block);
|
||||
+ spigotConfig.antiXrayInstance.updateNearbyBlocks(this, blockposition); // Spigot
|
||||
}
|
||||
|
||||
public void a(BlockPosition blockposition, Block block, EnumDirection enumdirection) {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
return this.worldProvider.p()[this.getLightLevel(blockposition)];
|
||||
}
|
||||
|
||||
- public IBlockData getType(BlockPosition blockposition) {
|
||||
+ // Spigot start
|
||||
+ public IBlockData getType(BlockPosition blockposition)
|
||||
+ {
|
||||
+ return getType( blockposition, true );
|
||||
+ }
|
||||
+
|
||||
+ public IBlockData getType(BlockPosition blockposition, boolean useCaptured) {
|
||||
// CraftBukkit start - tree generation
|
||||
- if (captureTreeGeneration) {
|
||||
+ if (captureTreeGeneration && useCaptured) {
|
||||
+ // Spigot end
|
||||
Iterator<BlockState> it = capturedBlockStates.iterator();
|
||||
while (it.hasNext()) {
|
||||
BlockState previous = it.next();
|
||||
diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/AntiXray.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import gnu.trove.set.TByteSet;
|
||||
+import gnu.trove.set.hash.TByteHashSet;
|
||||
+import net.minecraft.server.Block;
|
||||
+import net.minecraft.server.BlockPosition;
|
||||
+import net.minecraft.server.Blocks;
|
||||
+import net.minecraft.server.World;
|
||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
+
|
||||
+public class AntiXray
|
||||
+{
|
||||
+
|
||||
+ private static final CustomTimingsHandler update = new CustomTimingsHandler( "xray - update" );
|
||||
+ private static final CustomTimingsHandler obfuscate = new CustomTimingsHandler( "xray - obfuscate" );
|
||||
+ /*========================================================================*/
|
||||
+ // Used to keep track of which blocks to obfuscate
|
||||
+ private final boolean[] obfuscateBlocks = new boolean[ Short.MAX_VALUE ];
|
||||
+ // Used to select a random replacement ore
|
||||
+ private final byte[] replacementOres;
|
||||
+
|
||||
+ public AntiXray(SpigotWorldConfig config)
|
||||
+ {
|
||||
+ // Set all listed blocks as true to be obfuscated
|
||||
+ for ( int id : ( config.engineMode == 1 ) ? config.hiddenBlocks : config.replaceBlocks )
|
||||
+ {
|
||||
+ obfuscateBlocks[id] = true;
|
||||
+ }
|
||||
+
|
||||
+ // For every block
|
||||
+ TByteSet blocks = new TByteHashSet();
|
||||
+ for ( Integer i : config.hiddenBlocks )
|
||||
+ {
|
||||
+ Block block = Block.getById( i );
|
||||
+ // Check it exists and is not a tile entity
|
||||
+ if ( block != null && !block.isTileEntity() )
|
||||
+ {
|
||||
+ // Add it to the set of replacement blocks
|
||||
+ blocks.add( (byte) (int) i );
|
||||
+ }
|
||||
+ }
|
||||
+ // Bake it to a flat array of replacements
|
||||
+ replacementOres = blocks.toArray();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Starts the timings handler, then updates all blocks within the set radius
|
||||
+ * of the given coordinate, revealing them if they are hidden ores.
|
||||
+ */
|
||||
+ public void updateNearbyBlocks(World world, BlockPosition position)
|
||||
+ {
|
||||
+ if ( world.spigotConfig.antiXray )
|
||||
+ {
|
||||
+ update.startTiming();
|
||||
+ updateNearbyBlocks( world, position, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower
|
||||
+ update.stopTiming();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Starts the timings handler, and then removes all non exposed ores from
|
||||
+ * the chunk buffer.
|
||||
+ */
|
||||
+ public void obfuscateSync(int chunkX, int chunkY, int bitmask, byte[] buffer, World world)
|
||||
+ {
|
||||
+ if ( world.spigotConfig.antiXray )
|
||||
+ {
|
||||
+ obfuscate.startTiming();
|
||||
+ obfuscate( chunkX, chunkY, bitmask, buffer, world );
|
||||
+ obfuscate.stopTiming();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Removes all non exposed ores from the chunk buffer.
|
||||
+ */
|
||||
+ public void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world)
|
||||
+ {
|
||||
+ // If the world is marked as obfuscated
|
||||
+ if ( world.spigotConfig.antiXray )
|
||||
+ {
|
||||
+ // Initial radius to search around for air
|
||||
+ int initialRadius = 1;
|
||||
+ // Which block in the buffer we are looking at, anywhere from 0 to 16^4
|
||||
+ int index = 0;
|
||||
+ // The iterator marking which random ore we should use next
|
||||
+ int randomOre = 0;
|
||||
+
|
||||
+ // Chunk corner X and Z blocks
|
||||
+ int startX = chunkX << 4;
|
||||
+ int startZ = chunkY << 4;
|
||||
+
|
||||
+ byte replaceWithTypeId;
|
||||
+ switch ( world.getWorld().getEnvironment() )
|
||||
+ {
|
||||
+ case NETHER:
|
||||
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.NETHERRACK);
|
||||
+ break;
|
||||
+ case THE_END:
|
||||
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.END_STONE);
|
||||
+ break;
|
||||
+ default:
|
||||
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.STONE);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ // Chunks can have up to 16 sections
|
||||
+ for ( int i = 0; i < 16; i++ )
|
||||
+ {
|
||||
+ // If the bitmask indicates this chunk is sent...
|
||||
+ if ( ( bitmask & 1 << i ) != 0 )
|
||||
+ {
|
||||
+ // Work through all blocks in the chunk, y,z,x
|
||||
+ for ( int y = 0; y < 16; y++ )
|
||||
+ {
|
||||
+ for ( int z = 0; z < 16; z++ )
|
||||
+ {
|
||||
+ for ( int x = 0; x < 16; x++ )
|
||||
+ {
|
||||
+ // For some reason we can get too far ahead of ourselves (concurrent modification on bulk chunks?) so if we do, just abort and move on
|
||||
+ if ( index >= buffer.length )
|
||||
+ {
|
||||
+ index++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Grab the block ID in the buffer.
|
||||
+ // TODO: extended IDs are not yet supported
|
||||
+ int blockId = (buffer[index << 1] & 0xFF)
|
||||
+ | ((buffer[(index << 1) + 1] & 0xFF) << 8);
|
||||
+ blockId >>>= 4;
|
||||
+ // Check if the block should be obfuscated
|
||||
+ if ( obfuscateBlocks[blockId] )
|
||||
+ {
|
||||
+ // The world isn't loaded, bail out
|
||||
+ if ( !isLoaded( world, new BlockPosition( startX + x, ( i << 4 ) + y, startZ + z ), initialRadius ) )
|
||||
+ {
|
||||
+ index++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ // On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate
|
||||
+ if ( !hasTransparentBlockAdjacent( world, new BlockPosition( startX + x, ( i << 4 ) + y, startZ + z ), initialRadius ) )
|
||||
+ {
|
||||
+ int newId = blockId;
|
||||
+ switch ( world.spigotConfig.engineMode )
|
||||
+ {
|
||||
+ case 1:
|
||||
+ // Replace with replacement material
|
||||
+ newId = replaceWithTypeId & 0xFF;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ // Replace with random ore.
|
||||
+ if ( randomOre >= replacementOres.length )
|
||||
+ {
|
||||
+ randomOre = 0;
|
||||
+ }
|
||||
+ newId = replacementOres[randomOre++] & 0xFF;
|
||||
+ break;
|
||||
+ }
|
||||
+ newId <<= 4;
|
||||
+ buffer[index << 1] = (byte) (newId & 0xFF);
|
||||
+ buffer[(index << 1) + 1] = (byte) ((newId >> 8) & 0xFF);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ index++;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void updateNearbyBlocks(World world, BlockPosition position, int radius, boolean updateSelf)
|
||||
+ {
|
||||
+ // If the block in question is loaded
|
||||
+ if ( world.isLoaded( position ) )
|
||||
+ {
|
||||
+ // Get block id
|
||||
+ Block block = world.getType(position).getBlock();
|
||||
+
|
||||
+ // See if it needs update
|
||||
+ if ( updateSelf && obfuscateBlocks[Block.getId( block )] )
|
||||
+ {
|
||||
+ // Send the update
|
||||
+ world.notify( position );
|
||||
+ }
|
||||
+
|
||||
+ // Check other blocks for updates
|
||||
+ if ( radius > 0 )
|
||||
+ {
|
||||
+ updateNearbyBlocks( world, position.east(), radius - 1, true );
|
||||
+ updateNearbyBlocks( world, position.west(), radius - 1, true );
|
||||
+ updateNearbyBlocks( world, position.up(), radius - 1, true );
|
||||
+ updateNearbyBlocks( world, position.down(), radius - 1, true );
|
||||
+ updateNearbyBlocks( world, position.south(), radius - 1, true );
|
||||
+ updateNearbyBlocks( world, position.north(), radius - 1, true );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static boolean isLoaded(World world, BlockPosition position, int radius)
|
||||
+ {
|
||||
+ return world.isLoaded( position )
|
||||
+ && ( radius == 0 ||
|
||||
+ ( isLoaded( world, position.east(), radius - 1 )
|
||||
+ && isLoaded( world, position.west(), radius - 1 )
|
||||
+ && isLoaded( world, position.up(), radius - 1 )
|
||||
+ && isLoaded( world, position.down(), radius - 1 )
|
||||
+ && isLoaded( world, position.south(), radius - 1 )
|
||||
+ && isLoaded( world, position.north(), radius - 1 ) ) );
|
||||
+ }
|
||||
+
|
||||
+ private static boolean hasTransparentBlockAdjacent(World world, BlockPosition position, int radius)
|
||||
+ {
|
||||
+ return !isSolidBlock(world.getType(position, false).getBlock()) /* isSolidBlock */
|
||||
+ || ( radius > 0
|
||||
+ && ( hasTransparentBlockAdjacent( world, position.east(), radius - 1 )
|
||||
+ || hasTransparentBlockAdjacent( world, position.west(), radius - 1 )
|
||||
+ || hasTransparentBlockAdjacent( world, position.up(), radius - 1 )
|
||||
+ || hasTransparentBlockAdjacent( world, position.down(), radius - 1 )
|
||||
+ || hasTransparentBlockAdjacent( world, position.south(), radius - 1 )
|
||||
+ || hasTransparentBlockAdjacent( world, position.north(), radius - 1 ) ) );
|
||||
+ }
|
||||
+
|
||||
+ private static boolean isSolidBlock(Block block) {
|
||||
+ // Mob spawners are treated as solid blocks as far as the
|
||||
+ // game is concerned for lighting and other tasks but for
|
||||
+ // rendering they can be seen through therefor we special
|
||||
+ // case them so that the antixray doesn't show the fake
|
||||
+ // blocks around them.
|
||||
+ return block.isOccluding() && block != Blocks.MOB_SPAWNER && block != Blocks.BARRIER;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.spigotmc;
|
||||
|
||||
+import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
arrowDespawnRate = getInt( "arrow-despawn-rate", 1200 );
|
||||
log( "Arrow Despawn Rate: " + arrowDespawnRate );
|
||||
}
|
||||
+
|
||||
+ public boolean antiXray;
|
||||
+ public int engineMode;
|
||||
+ public List<Integer> hiddenBlocks;
|
||||
+ public List<Integer> replaceBlocks;
|
||||
+ public AntiXray antiXrayInstance;
|
||||
+ private void antiXray()
|
||||
+ {
|
||||
+ antiXray = getBoolean( "anti-xray.enabled", true );
|
||||
+ log( "Anti X-Ray: " + antiXray );
|
||||
+
|
||||
+ engineMode = getInt( "anti-xray.engine-mode", 1 );
|
||||
+ log( "\tEngine Mode: " + engineMode );
|
||||
+
|
||||
+ if ( SpigotConfig.version < 5 )
|
||||
+ {
|
||||
+ set( "anti-xray.blocks", null );
|
||||
+ }
|
||||
+ hiddenBlocks = getList( "anti-xray.hide-blocks", Arrays.asList( new Integer[]
|
||||
+ {
|
||||
+ 14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130
|
||||
+ } ) );
|
||||
+ log( "\tHidden Blocks: " + hiddenBlocks );
|
||||
+
|
||||
+ replaceBlocks = getList( "anti-xray.replace-blocks", Arrays.asList( new Integer[]
|
||||
+ {
|
||||
+ 1, 5
|
||||
+ } ) );
|
||||
+ log( "\tReplace Blocks: " + replaceBlocks );
|
||||
+
|
||||
+ antiXrayInstance = new AntiXray( this );
|
||||
+ }
|
||||
}
|
||||
--
|
@ -1,135 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Fri, 13 Dec 2013 11:45:47 +1100
|
||||
Subject: [PATCH] Optimize DataWatcher
|
||||
|
||||
Use primitive orientated collections, as well as more effective copies across collections.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/DataWatcher.java
|
||||
+++ b/src/main/java/net/minecraft/server/DataWatcher.java
|
||||
@@ -0,0 +0,0 @@ public class DataWatcher {
|
||||
|
||||
private final Entity a;
|
||||
private boolean b = true;
|
||||
- private static final Map<Class<?>, Integer> c = Maps.newHashMap();
|
||||
- private final Map<Integer, DataWatcher.WatchableObject> d = Maps.newHashMap();
|
||||
+ // Spigot Start
|
||||
+ private static final gnu.trove.map.TObjectIntMap classToId = new gnu.trove.map.hash.TObjectIntHashMap( 10, 0.5f, -1 );
|
||||
+ private final gnu.trove.map.TIntObjectMap dataValues = new gnu.trove.map.hash.TIntObjectHashMap( 10, 0.5f, -1 );
|
||||
+ // These exist as an attempt at backwards compatability for (broken) NMS plugins
|
||||
+ private static final Map<Class<?>, Integer> c = gnu.trove.TDecorators.wrap( classToId );
|
||||
+ private final Map<Integer, DataWatcher.WatchableObject> d = gnu.trove.TDecorators.wrap( dataValues );
|
||||
+ // Spigot End
|
||||
private boolean e;
|
||||
private ReadWriteLock f = new ReentrantReadWriteLock();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class DataWatcher {
|
||||
}
|
||||
|
||||
public <T> void a(int i, T t0) {
|
||||
- Integer integer = (Integer) DataWatcher.c.get(t0.getClass());
|
||||
+ int integer = classToId.get(t0.getClass()); // Spigot
|
||||
|
||||
- if (integer == null) {
|
||||
+ if (integer == -1) { // Spigot
|
||||
throw new IllegalArgumentException("Unknown data type: " + t0.getClass());
|
||||
} else if (i > 31) {
|
||||
throw new IllegalArgumentException("Data value id is too big with " + i + "! (Max is " + 31 + ")");
|
||||
- } else if (this.d.containsKey(Integer.valueOf(i))) {
|
||||
+ } else if (this.dataValues.containsKey(i)) { // Spigot
|
||||
throw new IllegalArgumentException("Duplicate id value for " + i + "!");
|
||||
} else {
|
||||
- DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(integer.intValue(), i, t0);
|
||||
+ DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(integer, i, t0); // Spigot
|
||||
|
||||
this.f.writeLock().lock();
|
||||
- this.d.put(Integer.valueOf(i), datawatcher_watchableobject);
|
||||
+ this.dataValues.put(i, datawatcher_watchableobject); // Spigot
|
||||
this.f.writeLock().unlock();
|
||||
this.b = false;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class DataWatcher {
|
||||
DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(j, i, (Object) null);
|
||||
|
||||
this.f.writeLock().lock();
|
||||
- this.d.put(Integer.valueOf(i), datawatcher_watchableobject);
|
||||
+ this.dataValues.put(i, datawatcher_watchableobject); // Spigot
|
||||
this.f.writeLock().unlock();
|
||||
this.b = false;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class DataWatcher {
|
||||
DataWatcher.WatchableObject datawatcher_watchableobject;
|
||||
|
||||
try {
|
||||
- datawatcher_watchableobject = (DataWatcher.WatchableObject) this.d.get(Integer.valueOf(i));
|
||||
+ datawatcher_watchableobject = (DataWatcher.WatchableObject) this.dataValues.get(i); // Spigot
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Getting synched entity data");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Synched entity data");
|
||||
@@ -0,0 +0,0 @@ public class DataWatcher {
|
||||
|
||||
if (this.e) {
|
||||
this.f.readLock().lock();
|
||||
- Iterator iterator = this.d.values().iterator();
|
||||
+ Iterator iterator = this.dataValues.valueCollection().iterator(); // Spigot
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next();
|
||||
@@ -0,0 +0,0 @@ public class DataWatcher {
|
||||
|
||||
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
this.f.readLock().lock();
|
||||
- Iterator iterator = this.d.values().iterator();
|
||||
+ Iterator iterator = this.dataValues.valueCollection().iterator(); // Spigot
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next();
|
||||
@@ -0,0 +0,0 @@ public class DataWatcher {
|
||||
}
|
||||
|
||||
public List<DataWatcher.WatchableObject> c() {
|
||||
- ArrayList arraylist = null;
|
||||
+ ArrayList arraylist = Lists.newArrayList(); // Spigot
|
||||
|
||||
this.f.readLock().lock();
|
||||
|
||||
- DataWatcher.WatchableObject datawatcher_watchableobject;
|
||||
-
|
||||
- for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(datawatcher_watchableobject)) {
|
||||
- datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next();
|
||||
- if (arraylist == null) {
|
||||
- arraylist = Lists.newArrayList();
|
||||
- }
|
||||
- }
|
||||
+ arraylist.addAll(this.dataValues.valueCollection()); // Spigot
|
||||
|
||||
this.f.readLock().unlock();
|
||||
return arraylist;
|
||||
@@ -0,0 +0,0 @@ public class DataWatcher {
|
||||
}
|
||||
|
||||
static {
|
||||
- DataWatcher.c.put(Byte.class, Integer.valueOf(0));
|
||||
- DataWatcher.c.put(Short.class, Integer.valueOf(1));
|
||||
- DataWatcher.c.put(Integer.class, Integer.valueOf(2));
|
||||
- DataWatcher.c.put(Float.class, Integer.valueOf(3));
|
||||
- DataWatcher.c.put(String.class, Integer.valueOf(4));
|
||||
- DataWatcher.c.put(ItemStack.class, Integer.valueOf(5));
|
||||
- DataWatcher.c.put(BlockPosition.class, Integer.valueOf(6));
|
||||
- DataWatcher.c.put(Vector3f.class, Integer.valueOf(7));
|
||||
+ // Spigot Start - remove valueOf
|
||||
+ classToId.put(Byte.class, 0);
|
||||
+ classToId.put(Short.class, 1);
|
||||
+ classToId.put(Integer.class, 2);
|
||||
+ classToId.put(Float.class, 3);
|
||||
+ classToId.put(String.class, 4);
|
||||
+ classToId.put(ItemStack.class, 5);
|
||||
+ classToId.put(BlockPosition.class, 6);
|
||||
+ classToId.put(Vector3f.class, 7);
|
||||
+ // Spigot End
|
||||
}
|
||||
|
||||
public static class WatchableObject {
|
||||
--
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL);
|
||||
+ nbttagcompound.setInt("Spigot.ticksLived", this.ticksLived);
|
||||
// CraftBukkit end
|
||||
if (this.getCustomName() != null && this.getCustomName().length() > 0) {
|
||||
if (this.getCustomName() != null && !this.getCustomName().isEmpty()) {
|
||||
nbttagcompound.setString("CustomName", this.getCustomName());
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
if (this instanceof EntityLiving) {
|
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
this.world.methodProfiler.a("checkDespawn");
|
||||
this.D();
|
||||
this.L();
|
||||
this.world.methodProfiler.b();
|
||||
+ // Spigot Start
|
||||
+ if ( this.fromMobSpawner )
|
||||
@ -31,38 +31,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Spigot End
|
||||
this.world.methodProfiler.a("sensing");
|
||||
this.bk.a();
|
||||
this.bu.a();
|
||||
this.world.methodProfiler.b();
|
||||
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- 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 {
|
||||
SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());
|
||||
if (!event.isCancelled()) {
|
||||
entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ // Spigot Start
|
||||
+ if ( entity.world.spigotConfig.nerfSpawnerMobs )
|
||||
+ {
|
||||
+ entity.fromMobSpawner = true;
|
||||
+ }
|
||||
+ // Spigot End
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
|
||||
SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());
|
||||
if (!event.isCancelled()) {
|
||||
entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).prepare(world.D(new BlockPosition(entity)), (GroupDataEntity) null);
|
||||
}
|
||||
-
|
||||
+ // Spigot Start
|
||||
+ if ( entity.world.spigotConfig.nerfSpawnerMobs )
|
||||
+ {
|
||||
+ entity.fromMobSpawner = true;
|
||||
+ }
|
||||
+ // Spigot End
|
||||
}
|
||||
// Spigot end
|
||||
}
|
||||
ChunkRegionLoader.a(entity, world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
world.triggerEffect(2004, blockposition, 0);
|
||||
if (entityinsentient != null) {
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
@ -11,11 +11,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
this.a(MinecraftEncryption.b());
|
||||
DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.R());
|
||||
DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().isEmpty() ? "*" : this.getServerIp()) + ":" + this.P());
|
||||
|
||||
+ if (!org.spigotmc.SpigotConfig.lateBind) {
|
||||
try {
|
||||
this.aq().a(inetaddress, this.R());
|
||||
this.am().a(inetaddress, this.P());
|
||||
} catch (IOException ioexception) {
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
|
||||
@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
+ if (org.spigotmc.SpigotConfig.lateBind) {
|
||||
+ try {
|
||||
+ this.aq().a(inetaddress, this.R());
|
||||
+ this.am().a(inetaddress, this.P());
|
||||
+ } catch (IOException ioexception) {
|
||||
+ DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
|
||||
+ DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()});
|
||||
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (false && this.aS() > 0L) { // Spigot - disable
|
||||
if (false && this.aP() > 0L) { // Spigot - disable
|
||||
Thread thread1 = new Thread(new ThreadWatchdog(this));
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
@ -15,11 +15,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.r && this.world.getTime() != this.lastSaved || this.q) {
|
||||
if (this.s && this.world.getTime() != this.lastSaved || this.r) {
|
||||
return true;
|
||||
}
|
||||
- } else if (this.r && this.world.getTime() >= this.lastSaved + 600L) {
|
||||
+ } else if (this.r && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // Spigot - Only save if we've passed 2 auto save intervals without modification
|
||||
- } else if (this.s && this.world.getTime() >= this.lastSaved + 600L) {
|
||||
+ } else if (this.s && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // Spigot - Only save if we've passed 2 auto save intervals without modification
|
||||
return true;
|
||||
}
|
||||
|
@ -1,84 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Tue, 11 Jun 2013 12:17:37 +1000
|
||||
Subject: [PATCH] More Efficient GetCubes
|
||||
|
||||
|
||||
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 {
|
||||
IBlockData iblockdata = Blocks.STONE.getBlockData();
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
|
||||
- for (int k1 = i; k1 < j; ++k1) {
|
||||
- for (int l1 = i1; l1 < j1; ++l1) {
|
||||
- if (this.isLoaded(blockposition_mutableblockposition.c(k1, 64, l1))) {
|
||||
- for (int i2 = k - 1; i2 < l; ++i2) {
|
||||
- blockposition_mutableblockposition.c(k1, i2, l1);
|
||||
- if (flag && flag1) {
|
||||
- entity.h(false);
|
||||
- } else if (!flag && !flag1) {
|
||||
- entity.h(true);
|
||||
- }
|
||||
-
|
||||
- IBlockData iblockdata1 = iblockdata;
|
||||
+ // Spigot start
|
||||
+ int ystart = ( ( k - 1 ) < 0 ) ? 0 : ( k - 1 );
|
||||
+ for ( int chunkx = ( i >> 4 ); chunkx <= ( ( j - 1 ) >> 4 ); chunkx++ )
|
||||
+ {
|
||||
+ int cx = chunkx << 4;
|
||||
+ for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ )
|
||||
+ {
|
||||
+ if ( !this.isChunkLoaded( chunkx, chunkz, true ) )
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+ int cz = chunkz << 4;
|
||||
+ Chunk chunk = this.getChunkAt( chunkx, chunkz );
|
||||
+ // Compute ranges within chunk
|
||||
+ int xstart = ( i < cx ) ? cx : i;
|
||||
+ int xend = ( j < ( cx + 16 ) ) ? j : ( cx + 16 );
|
||||
+ int zstart = ( i1 < cz ) ? cz : i1;
|
||||
+ int zend = ( j1 < ( cz + 16 ) ) ? j1 : ( cz + 16 );
|
||||
+ // Loop through blocks within chunk
|
||||
+ for ( int x = xstart; x < xend; x++ )
|
||||
+ {
|
||||
+ for ( int z = zstart; z < zend; z++ )
|
||||
+ {
|
||||
+ for ( int y = ystart; y < l; y++ )
|
||||
+ {
|
||||
+ BlockPosition blockposition = new BlockPosition( x, y, z );
|
||||
+
|
||||
+ if (flag && flag1) {
|
||||
+ entity.h(false);
|
||||
+ } else if (!flag && !flag1) {
|
||||
+ entity.h(true);
|
||||
+ }
|
||||
|
||||
- if (worldborder.a((BlockPosition) blockposition_mutableblockposition) || !flag1) {
|
||||
- iblockdata1 = this.getType(blockposition_mutableblockposition);
|
||||
+ IBlockData block;
|
||||
+ if (!this.getWorldBorder().a(blockposition) && flag1) {
|
||||
+ block = Blocks.STONE.getBlockData();
|
||||
+ } else
|
||||
+ {
|
||||
+ block = chunk.getBlockData( blockposition );
|
||||
+ }
|
||||
+ if ( block != null )
|
||||
+ {
|
||||
+ block.getBlock().a(this, blockposition, block, axisalignedbb, arraylist, entity);
|
||||
+ }
|
||||
}
|
||||
-
|
||||
- iblockdata1.getBlock().a(this, blockposition_mutableblockposition, iblockdata1, axisalignedbb, arraylist, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Spigot end
|
||||
|
||||
double d0 = 0.25D;
|
||||
List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0));
|
||||
--
|
@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public final double[] recentTps = new double[ 3 ];
|
||||
+ // Spigot end
|
||||
|
||||
public MinecraftServer(OptionSet options, Proxy proxy, File file1) {
|
||||
public MinecraftServer(OptionSet options, Proxy proxy, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
|
||||
this.e = proxy;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
this.isRunning = false;
|
||||
@ -36,21 +36,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
try {
|
||||
if (this.init()) {
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
this.r.setServerInfo(new ServerPing.ServerData("1.8.8", 47));
|
||||
this.a(this.r);
|
||||
this.q.setServerInfo(new ServerPing.ServerData("1.9", 107));
|
||||
this.a(this.q);
|
||||
|
||||
+ // Spigot start
|
||||
+ Arrays.fill( recentTps, 20 );
|
||||
+ long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick;
|
||||
while (this.isRunning) {
|
||||
- long j = az();
|
||||
- long k = j - this.ab;
|
||||
- long j = av();
|
||||
- long k = j - this.aa;
|
||||
-
|
||||
- if (k > 2000L && this.ab - this.R >= 15000L) {
|
||||
- if (k > 2000L && this.aa - this.Q >= 15000L) {
|
||||
- if (server.getWarnOnOverload()) // CraftBukkit
|
||||
- MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)});
|
||||
- k = 2000L;
|
||||
- this.R = this.ab;
|
||||
- this.Q = this.aa;
|
||||
- }
|
||||
-
|
||||
- if (k < 0L) {
|
||||
@ -67,15 +67,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
- i += k;
|
||||
- this.ab = j;
|
||||
- this.aa = j;
|
||||
- if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit
|
||||
- this.A();
|
||||
- this.C();
|
||||
- i = 0L;
|
||||
- } else {
|
||||
- while (i > 50L) {
|
||||
- MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
- i -= 50L;
|
||||
- this.A();
|
||||
- this.C();
|
||||
- }
|
||||
+ if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 )
|
||||
+ {
|
||||
@ -88,8 +88,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ lastTick = curTime;
|
||||
|
||||
- Thread.sleep(Math.max(1L, 50L - i));
|
||||
+ this.A();
|
||||
this.Q = true;
|
||||
+ this.C();
|
||||
this.P = true;
|
||||
}
|
||||
+ // Spigot end
|
||||
} else {
|
@ -9,19 +9,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/PacketStatusListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java
|
||||
@@ -0,0 +0,0 @@ public class PacketStatusListener implements PacketStatusInListener {
|
||||
}
|
||||
}
|
||||
|
||||
ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size());
|
||||
+ // Spigot Start
|
||||
+ if ( !profiles.isEmpty() )
|
||||
+ {
|
||||
+ java.util.Collections.shuffle( profiles ); // This sucks, its inefficient but we have no simple way of doing it differently
|
||||
+ profiles = profiles.subList( 0, Math.min( profiles.size(), org.spigotmc.SpigotConfig.playerSample ) ); // Cap the sample to n (or less) displayed players, ie: Vanilla behaviour
|
||||
+ }
|
||||
+ // Spigot End
|
||||
playerSample.a(profiles.toArray(new GameProfile[profiles.size()]));
|
||||
ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size());
|
||||
+ // Spigot Start
|
||||
+ if ( !profiles.isEmpty() )
|
||||
+ {
|
||||
+ java.util.Collections.shuffle( profiles ); // This sucks, its inefficient but we have no simple way of doing it differently
|
||||
+ profiles = profiles.subList( 0, Math.min( profiles.size(), org.spigotmc.SpigotConfig.playerSample ) ); // Cap the sample to n (or less) displayed players, ie: Vanilla behaviour
|
||||
+ }
|
||||
+ // Spigot End
|
||||
playerSample.a(profiles.toArray(new GameProfile[profiles.size()]));
|
||||
|
||||
ServerPing ping = new ServerPing();
|
||||
ServerPing ping = new ServerPing();
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
@ -11,9 +11,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
private static final Logger bH = LogManager.getLogger();
|
||||
private static final Logger bQ = LogManager.getLogger();
|
||||
- private String locale = "en_US";
|
||||
+ public String locale = "en_US"; // Spigot
|
||||
+ public String locale = "en_US"; // Spigot private -> public
|
||||
public PlayerConnection playerConnection;
|
||||
public final MinecraftServer server;
|
||||
public final PlayerInteractManager playerInteractManager;
|
@ -11,46 +11,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- 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 implements ICommandListener {
|
||||
public long activatedTick = Integer.MIN_VALUE;
|
||||
public boolean fromMobSpawner;
|
||||
public void inactiveTick() { }
|
||||
+ protected int numCollisions = 0;
|
||||
// Spigot end
|
||||
|
||||
public void d(EntityHuman entityhuman) {}
|
||||
|
||||
+ int numCollisions = 0; // Spigot
|
||||
public void collide(Entity entity) {
|
||||
if (entity.passenger != this && entity.vehicle != this) {
|
||||
if (!entity.noclip && !this.noclip) {
|
||||
public Entity(World world) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
}));
|
||||
List list = this.world.a((Entity) this, this.getBoundingBox(), IEntitySelector.a(this));
|
||||
|
||||
if (this.ad() && !list.isEmpty()) { // Spigot: Add this.ad() condition
|
||||
+ numCollisions -= world.spigotConfig.maxCollisionsPerEntity; // Spigot
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
+ if (numCollisions > world.spigotConfig.maxCollisionsPerEntity) { break; } // Spigot
|
||||
if (this.isInteractable() && !list.isEmpty()) { // Spigot: Add isInteractable() condition
|
||||
- for (int i = 0; i < list.size(); ++i) {
|
||||
+ numCollisions -= world.spigotConfig.maxCollisionsPerEntity; // Spigot
|
||||
+ for (int i = 0; i < list.size() && numCollisions < world.spigotConfig.maxCollisionsPerEntity; ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
// TODO better check now?
|
||||
// CraftBukkit start - Only handle mob (non-player) collisions every other tick
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
-
|
||||
+ entity.numCollisions++; // Spigot
|
||||
+ numCollisions++; // Spigot
|
||||
this.s(entity);
|
||||
this.C(entity);
|
||||
}
|
||||
+ numCollisions = 0; // Spigot
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
maxBulkChunk = getInt( "max-bulk-chunks", 10 );
|
||||
log( "Sending up to " + maxBulkChunk + " chunks per packet" );
|
||||
enableZombiePigmenPortalSpawns = getBoolean( "enable-zombie-pigmen-portal-spawns", true );
|
||||
log( "Allow Zombie Pigmen to spawn from portal blocks: " + enableZombiePigmenPortalSpawns );
|
||||
}
|
||||
+
|
||||
+ public int maxCollisionsPerEntity;
|
@ -8,7 +8,7 @@ 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 PacketListenerPlayIn, IUpdatePlayerList
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
this.minecraftServer.getPlayerList().sendMessage(chatmessage1, false);
|
||||
}
|
||||
|
@ -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 PacketListenerPlayIn, IUpdatePlayerList
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize();
|
||||
boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45;
|
||||
// CraftBukkit - Add invalidItems check
|
||||
- boolean flag2 = itemstack == null || itemstack.getItem() != null && !invalidItems.contains(Item.getId(itemstack.getItem()));
|
||||
+ boolean flag2 = itemstack == null || itemstack.getItem() != null && (!invalidItems.contains(Item.getId(itemstack.getItem())) || !org.spigotmc.SpigotConfig.filterCreativeItems); // Spigot
|
@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Tue, 28 Jan 2014 20:35:35 +1100
|
||||
Subject: [PATCH] Allow Configuring Chunks per Packet
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
Chunk chunk;
|
||||
|
||||
- while (iterator1.hasNext() && arraylist.size() < 10) {
|
||||
+ while (iterator1.hasNext() && arraylist.size() < this.world.spigotConfig.maxBulkChunk) { // Spigot
|
||||
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator1.next();
|
||||
|
||||
if (chunkcoordintpair != null) {
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
enableZombiePigmenPortalSpawns = getBoolean( "enable-zombie-pigmen-portal-spawns", true );
|
||||
log( "Allow Zombie Pigmen to spawn from portal blocks: " + enableZombiePigmenPortalSpawns );
|
||||
}
|
||||
+
|
||||
+ public int maxBulkChunk;
|
||||
+ private void bulkChunkCount()
|
||||
+ {
|
||||
+ maxBulkChunk = getInt( "max-bulk-chunks", 10 );
|
||||
+ log( "Sending up to " + maxBulkChunk + " chunks per packet" );
|
||||
+ }
|
||||
}
|
||||
--
|
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
- private void setVanillaCommands() {
|
||||
+ private void setVanillaCommands(boolean first) { // Spigot
|
||||
Map<String, ICommand> commands = new CommandDispatcher().getCommands();
|
||||
Map<String, ICommand> commands = new CommandDispatcher(console).getCommands();
|
||||
for (ICommand cmd : commands.values()) {
|
||||
- commandMap.register("minecraft", new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null))));
|
||||
+ // Spigot start
|
@ -9,34 +9,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
@@ -0,0 +0,0 @@ public class EntityLightning extends EntityWeather {
|
||||
// CraftBukkit start
|
||||
public boolean isEffect = false;
|
||||
|
||||
private int c;
|
||||
private final boolean d;
|
||||
public boolean isEffect; // CraftBukkit
|
||||
+ public boolean isSilent = false; // Spigot
|
||||
+
|
||||
public EntityLightning(World world, double d0, double d1, double d2) {
|
||||
this(world, d0, d1, d2, false);
|
||||
}
|
||||
|
||||
public EntityLightning(World world, double d0, double d1, double d2, boolean flag) {
|
||||
super(world);
|
||||
@@ -0,0 +0,0 @@ public class EntityLightning extends EntityWeather {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ }
|
||||
|
||||
}
|
||||
|
||||
+ // Spigot start
|
||||
+ public EntityLightning(World world, double d0, double d1, double d2, boolean isEffect, boolean isSilent)
|
||||
+ {
|
||||
+ this( world, d0, d1, d2, isEffect );
|
||||
+ this.isSilent = isSilent;
|
||||
}
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+
|
||||
public SoundCategory bz() {
|
||||
return SoundCategory.WEATHER;
|
||||
}
|
||||
|
||||
public void t_() {
|
||||
super.t_();
|
||||
public void m() {
|
||||
super.m();
|
||||
- if (this.lifeTicks == 2) {
|
||||
+ if (!isSilent && this.lifeTicks == 2) { // Spigot
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
//this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
|
||||
// this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dc, SoundCategory.d, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
|
||||
float pitch = 0.8F + this.random.nextFloat() * 0.2F;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
int j = MathHelper.floor(d1);
|
||||
int k = MathHelper.floor(d2);
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
private int a = 63;
|
||||
protected boolean e;
|
||||
protected boolean d;
|
||||
- public final List<Entity> entityList = Lists.newArrayList();
|
||||
+ // Spigot start - guard entity list from removals
|
||||
+ public final List<Entity> entityList = new java.util.ArrayList<Entity>()
|
||||
@ -39,17 +39,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ };
|
||||
+ // Spigot end
|
||||
protected final List<Entity> g = Lists.newArrayList();
|
||||
public final List<TileEntity> h = Lists.newArrayList();
|
||||
protected final List<Entity> f = Lists.newArrayList();
|
||||
public final List<TileEntity> tileEntityList = Lists.newArrayList();
|
||||
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
private int tickPosition;
|
||||
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
|
||||
|
||||
// Spigot start
|
||||
+ private boolean guardEntityList;
|
||||
protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList;
|
||||
protected float growthOdds = 100;
|
||||
protected float modifiedOdds = 100;
|
||||
public final SpigotTimings.WorldTimingsHandler timings; // Spigot
|
||||
+ private boolean guardEntityList; // Spigot
|
||||
|
||||
public CraftWorld getWorld() {
|
||||
return this.world;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||
@ -59,13 +59,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) {
|
||||
entity = (Entity) this.entityList.get(this.tickPosition);
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.getChunkAt(j, k).b(entity);
|
||||
this.getChunkAt(j, l).b(entity);
|
||||
}
|
||||
|
||||
+ guardEntityList = false; // Spigot
|
||||
this.entityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable
|
||||
+ guardEntityList = true; // Spigot
|
||||
this.b(entity);
|
||||
this.c(entity);
|
||||
}
|
||||
|
||||
this.methodProfiler.b();
|
@ -9,20 +9,26 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@
|
||||
-package net.minecraft.server;
|
||||
+ package net.minecraft.server;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Objects;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.everyoneSleeping();
|
||||
}
|
||||
|
||||
+ if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking
|
||||
int i = entity.ae;
|
||||
int j = entity.ag;
|
||||
int i = entity.ab;
|
||||
int j = entity.ad;
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.entityList.remove(index);
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ } // Spigot
|
||||
this.b(entity);
|
||||
this.c(entity);
|
||||
}
|
||||
|
||||
--
|
@ -30,10 +30,10 @@ 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 PacketListenerPlayIn, IUpdatePlayerList
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
this.player.resetIdleTimer();
|
||||
} else {
|
||||
PlayerConnection.c.warn(this.player.getName() + " tried to set an invalid carried item");
|
||||
PlayerConnection.LOGGER.warn(this.player.getName() + " tried to set an invalid carried item");
|
||||
- this.disconnect("Nope!"); // CraftBukkit
|
||||
+ this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit //Spigot "Nope" -> Descriptive reason
|
||||
}
|
@ -9,13 +9,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||
double deltaX = this.locX - player.locX;
|
||||
double deltaZ = this.locZ - player.locZ;
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
}
|
||||
|
||||
if (this.bF == 1) {
|
||||
- this.world.a(1028, new BlockPosition(this), 0);
|
||||
+ // CraftBukkit start - Use relative location for far away sounds
|
||||
+ // this.world.a(1028, new BlockPosition(this), 0);
|
||||
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ double deltaX = this.locX - player.locX;
|
||||
+ double deltaZ = this.locZ - player.locZ;
|
||||
+ double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
+ if ( world.spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > world.spigotConfig.dragonDeathSoundRadius * world.spigotConfig.dragonDeathSoundRadius ) continue; // Spigot
|
||||
if (distanceSquared > viewDistance * viewDistance) {
|
||||
double deltaLength = Math.sqrt(distanceSquared);
|
||||
double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
|
||||
+ if (distanceSquared > viewDistance * viewDistance) {
|
||||
+ double deltaLength = Math.sqrt(distanceSquared);
|
||||
+ double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
|
||||
+ double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance;
|
||||
+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1028, new BlockPosition((int) relativeX, (int) this.locY, (int) relativeZ), 0, true));
|
||||
+ } else {
|
||||
+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1028, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0, true));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityWither.java
|
@ -1,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: hcherndon <hcherndon@gmail.com>
|
||||
Date: Sat, 15 Feb 2014 01:51:20 -0600
|
||||
Subject: [PATCH] Unfinalize the isDisconnected() method by bukkit.
|
||||
|
||||
This would literally mean the world to me. You have no idea how much this method being final is fucking me over right now. (Working with NPC's and what not.)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||
}
|
||||
|
||||
// CraftBukkit start - Add "isDisconnected" method
|
||||
- public final boolean isDisconnected() {
|
||||
+ public boolean isDisconnected() { // Spigot
|
||||
return !this.player.joining && !this.networkManager.channel.config().isAutoRead();
|
||||
}
|
||||
|
||||
--
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
}
|
||||
|
||||
protected boolean aR() {
|
||||
protected boolean aO() {
|
||||
+ server.getLogger().info( "**** Beginning UUID conversion, this may take A LONG time ****"); // Spigot, let the user know whats up!
|
||||
boolean flag = false;
|
||||
|
@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
+ entityhuman.hookedFish = null;
|
||||
return itemstack;
|
||||
return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
|
||||
}
|
||||
// CraftBukkit end
|
||||
--
|
@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
||||
NetworkManager.g.debug(throwable);
|
||||
this.close(chatmessage);
|
||||
+ if (MinecraftServer.getServer().isDebugging()) throwable.printStackTrace(); // Spigot
|
||||
}
|
||||
|
||||
protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) throws Exception {
|
||||
protected void a(ChannelHandlerContext channelhandlercontext, Packet<?> packet) throws Exception {
|
||||
--
|
@ -36,6 +36,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Spigot End
|
||||
} catch (Exception exception) {
|
||||
WorldNBTStorage.a.warn("Failed to load player data for " + entityhuman.getName());
|
||||
WorldNBTStorage.b.warn("Failed to load player data for " + entityhuman.getName());
|
||||
}
|
||||
--
|
@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/UserCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/UserCache.java
|
||||
@@ -0,0 +0,0 @@ public class UserCache {
|
||||
this.e.remove(gameprofile);
|
||||
this.e.addFirst(gameprofile);
|
||||
this.f.remove(gameprofile);
|
||||
this.f.addFirst(gameprofile);
|
||||
} else {
|
||||
- gameprofile = a(this.f, s1);
|
||||
+ gameprofile = a(this.f, s); // Spigot - use correct case for offline players
|
||||
- gameprofile = a(this.g, s1);
|
||||
+ gameprofile = a(this.g, s); // Spigot - use correct case for offline players
|
||||
if (gameprofile != null) {
|
||||
this.a(gameprofile);
|
||||
usercache_usercacheentry = (UserCache.UserCacheEntry) this.c.get(s1);
|
||||
usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(s1);
|
||||
--
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user