Shave nearly 2mb off jar size by not embedding our copy of trove since Minecraft now includes it.

This commit is contained in:
md_5 2014-06-21 16:30:09 +10:00
parent b4f8ae96a2
commit 463e6f351e
8 changed files with 33 additions and 42 deletions

View file

@ -1,11 +1,11 @@
From ae912a83567434a436fad96553d8f1ff5114db6a Mon Sep 17 00:00:00 2001
From 4c0a6720e1aa3018860c091f0eab1744a7009ec6 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 2 Jul 2013 13:07:39 +1000
Subject: [PATCH] POM Changes
diff --git a/pom.xml b/pom.xml
index b2e2002..c1073e5 100644
index b2e2002..df02bd3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,12 +1,12 @@
@ -101,16 +101,7 @@ index b2e2002..c1073e5 100644
<!-- testing -->
<dependency>
<groupId>junit</groupId>
@@ -147,19 +108,24 @@
<version>1.3</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>net.sf.trove4j</groupId>
+ <artifactId>trove4j</artifactId>
+ <version>3.0.3</version>
+ </dependency>
</dependencies>
@@ -151,15 +112,15 @@
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
<build>
@ -129,7 +120,7 @@ index b2e2002..c1073e5 100644
</configuration>
<executions>
<execution>
@@ -212,7 +178,7 @@
@@ -212,7 +173,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>

View file

@ -1,11 +1,11 @@
From e380a7c833bf83afcc83bbc477466f1266441288 Mon Sep 17 00:00:00 2001
From 4973ff00be3ca5a6c77b3e8b2877efd627c72df3 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
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index fab5025..93b7a72 100644
index fab5025..870bddc 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -62,7 +62,7 @@ public abstract class World implements IBlockAccess {
@ -22,7 +22,7 @@ index fab5025..93b7a72 100644
int[] I;
+ // Spigot start
+ protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList;
+ protected final net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap chunkTickList;
+ protected float growthOdds = 100;
+ protected float modifiedOdds = 100;
+ private final byte chunkTickRadius;
@ -54,7 +54,7 @@ index fab5025..93b7a72 100644
// 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 = new net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
+ this.chunkTickList.setAutoCompactionFactor( 0 );
+ // Spigot end
@ -115,7 +115,7 @@ index fab5025..93b7a72 100644
this.methodProfiler.b();
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 3fa3a81..9b5b370 100644
index 3fa3a81..a30b79e 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -307,10 +307,20 @@ public class WorldServer extends World {
@ -124,7 +124,7 @@ index 3fa3a81..9b5b370 100644
- for (long chunkCoord : this.chunkTickList.popAll()) {
+ // Spigot start
+ for (gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext();) {
+ for (net.minecraft.util.gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext();) {
+ iter.advance();
+ long chunkCoord = iter.key();
+ int chunkX = World.keyToX(chunkCoord);

View file

@ -1,18 +1,18 @@
From ce050d2da89fea40fc1459aaa5a03ba3f9e6172c Mon Sep 17 00:00:00 2001
From e71213a20ac3894089923747de1bf84f672beb31 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 17:29:54 +1000
Subject: [PATCH] Fix Mob Spawning Relative to View Distance
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index ade0c35..0eabadf 100644
index ade0c35..1ac9804 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -40,6 +40,7 @@ public class Chunk {
public int r;
public long s;
private int x;
+ protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot
+ protected net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot
public Chunk(World world, int i, int j) {
this.sections = new ChunkSection[16];

View file

@ -1,4 +1,4 @@
From 37f3e3718d4d554cf96839442b7f07be32cb80d0 Mon Sep 17 00:00:00 2001
From 9e11fada287c50bda72a5b4a38b871d6ab5a9de9 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
@ -115,7 +115,7 @@ index 2db45ad..97fe53c 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 6da7de6..84fe64c 100644
index abfa88b..3dfa0ec 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -233,9 +233,16 @@ public abstract class World implements IBlockAccess {
@ -147,14 +147,14 @@ index 6da7de6..84fe64c 100644
public void b(int i, int j, int k, Block block, int l) {
diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
new file mode 100644
index 0000000..d326d18
index 0000000..d0fc0a9
--- /dev/null
+++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -0,0 +1,227 @@
+package org.spigotmc;
+
+import gnu.trove.set.TByteSet;
+import gnu.trove.set.hash.TByteHashSet;
+import net.minecraft.util.gnu.trove.set.TByteSet;
+import net.minecraft.util.gnu.trove.set.hash.TByteHashSet;
+import net.minecraft.server.Block;
+import net.minecraft.server.Blocks;
+import net.minecraft.server.World;

View file

@ -1,4 +1,4 @@
From 0b941f57067c60c8c616fd9e1ad80e6e68cc392e Mon Sep 17 00:00:00 2001
From 3cdcdf3689a73973e3cb39db068e568b1eb82832 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
@ -6,7 +6,7 @@ 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 90a2a80..cca6bd9 100644
index 90a2a80..f30e9f8 100644
--- a/src/main/java/net/minecraft/server/DataWatcher.java
+++ b/src/main/java/net/minecraft/server/DataWatcher.java
@@ -14,8 +14,13 @@ public class DataWatcher {
@ -16,11 +16,11 @@ index 90a2a80..cca6bd9 100644
- private static final HashMap c = new HashMap();
- private final Map d = new HashMap();
+ // 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 );
+ private static final net.minecraft.util.gnu.trove.map.TObjectIntMap classToId = new net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap( 10, 0.5f, -1 );
+ private final net.minecraft.util.gnu.trove.map.TIntObjectMap dataValues = new net.minecraft.util.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 c = gnu.trove.TDecorators.wrap( classToId );
+ private final Map d = gnu.trove.TDecorators.wrap( dataValues );
+ private static final Map c = net.minecraft.util.gnu.trove.TDecorators.wrap( classToId );
+ private final Map d = net.minecraft.util.gnu.trove.TDecorators.wrap( dataValues );
+ // Spigot End
private boolean e;
private ReadWriteLock f = new ReentrantReadWriteLock();

View file

@ -1,4 +1,4 @@
From 16561bbd9dae7bc87542e67953ced80164fc7f9c Mon Sep 17 00:00:00 2001
From ac7a5cda836e537f9e65b102669c14c3125042cd Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Tue, 7 Jan 2014 15:56:26 +0000
Subject: [PATCH] Allow statistics to be disabled/forced
@ -40,7 +40,7 @@ index 819896f..897e88b 100644
super.setStatistic(entityhuman, statistic, i);
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index af73544..54d9117 100644
index af73544..ca87886 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -10,10 +10,13 @@ import java.util.HashMap;
@ -48,7 +48,7 @@ index af73544..54d9117 100644
import java.util.Map;
import java.util.logging.Level;
+
+import gnu.trove.map.hash.TObjectIntHashMap;
+import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;

View file

@ -1,4 +1,4 @@
From 1773a7d0466bd589b631eb382ba152ef7f59fc58 Mon Sep 17 00:00:00 2001
From 79629b915ac0ca95348c8666cdcde4443b0f7104 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Wed, 12 Feb 2014 20:44:14 +0000
Subject: [PATCH] Allow vanilla commands to be the main version of a command
@ -138,7 +138,7 @@ index 4c13657..66094ed 100644
private void loadPlugin(Plugin plugin) {
try {
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0d0c7b0..4703768 100644
index 95e9f72..b40801e 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -8,8 +8,10 @@ import java.lang.reflect.Method;
@ -151,7 +151,7 @@ index 0d0c7b0..4703768 100644
+import java.util.Set;
import java.util.logging.Level;
import gnu.trove.map.hash.TObjectIntHashMap;
import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap;
@@ -284,4 +286,16 @@ public class SpigotConfig
{
filterCreativeItems = getBoolean( "settings.filter-creative-items", true );

View file

@ -1,11 +1,11 @@
From 6b67defb92e04c855fb01fe6a1bddd7ebe746cd4 Mon Sep 17 00:00:00 2001
From 129b22a1e1c40e55fede0417d3bef984844b4c3f Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Mon, 10 Mar 2014 09:03:28 +1100
Subject: [PATCH] Guard Entity List
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index e557b4f..091b04d 100644
index 1d8caf9..3ad24a3 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -31,7 +31,32 @@ import org.bukkit.event.weather.ThunderChangeEvent;
@ -47,7 +47,7 @@ index e557b4f..091b04d 100644
// Spigot start
+ private boolean guardEntityList;
protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList;
protected final net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap chunkTickList;
protected float growthOdds = 100;
protected float modifiedOdds = 100;
@@ -1354,6 +1380,7 @@ public abstract class World implements IBlockAccess {