Update netty & kindof hacky fix for anvil mishaps

This commit is contained in:
md_5 2013-04-12 13:57:00 +10:00
parent 3c9f16cf72
commit c7cc53537f
7 changed files with 66 additions and 34 deletions

View File

@ -1,14 +1,14 @@
From ed8f394566a78a2660472fa790bb50f1c780a281 Mon Sep 17 00:00:00 2001 From 9fcce5b028144d7682bd590fa97feaf303bd3272 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 19 Jan 2013 01:11:30 -0500 Date: Sat, 19 Jan 2013 01:11:30 -0500
Subject: [PATCH] Skip entity.move() if we are not moving anywhere. Subject: [PATCH] Skip entity.move() if we are not moving anywhere.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 7890d6f..8e743ec 100644 index 51a5b38..1044e4d 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -430,6 +430,7 @@ public abstract class Entity { @@ -417,6 +417,7 @@ public abstract class Entity {
} }
public void move(double d0, double d1, double d2) { public void move(double d0, double d1, double d2) {

View File

@ -1,4 +1,4 @@
From eac5b5044c9871541b4503fa158232f5c4a020e5 Mon Sep 17 00:00:00 2001 From 867a1f6e0321859d2573cdfa83b46376396981b9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 10 Jan 2013 00:18:11 -0500 Date: Thu, 10 Jan 2013 00:18:11 -0500
Subject: [PATCH] Improved Timings System Subject: [PATCH] Improved Timings System
@ -26,7 +26,7 @@ index 8b280ab..31e3fce 100644
// CraftBukkit start - If we didn't need to load the chunk run the callback now // CraftBukkit start - If we didn't need to load the chunk run the callback now
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 8e743ec..8feb1d3 100644 index 1044e4d..171e7e0 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -14,6 +14,7 @@ import org.bukkit.block.BlockFace; @@ -14,6 +14,7 @@ import org.bukkit.block.BlockFace;
@ -37,7 +37,7 @@ index 8e743ec..8feb1d3 100644
import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.painting.PaintingBreakByEntityEvent; import org.bukkit.event.painting.PaintingBreakByEntityEvent;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
@@ -111,6 +112,8 @@ public abstract class Entity { @@ -110,6 +111,8 @@ public abstract class Entity {
public EnumEntitySize at; public EnumEntitySize at;
public boolean valid = false; // CraftBukkit public boolean valid = false; // CraftBukkit
@ -46,7 +46,7 @@ index 8e743ec..8feb1d3 100644
public Entity(World world) { public Entity(World world) {
this.id = entityCount++; this.id = entityCount++;
this.l = 1.0D; this.l = 1.0D;
@@ -431,6 +434,7 @@ public abstract class Entity { @@ -418,6 +421,7 @@ public abstract class Entity {
public void move(double d0, double d1, double d2) { public void move(double d0, double d1, double d2) {
if (d0 == 0 && d1 == 0 && d2 == 0) { return; } // Spigot if (d0 == 0 && d1 == 0 && d2 == 0) { return; } // Spigot
@ -54,7 +54,7 @@ index 8e743ec..8feb1d3 100644
if (this.Z) { if (this.Z) {
this.boundingBox.d(d0, d1, d2); this.boundingBox.d(d0, d1, d2);
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
@@ -730,6 +734,7 @@ public abstract class Entity { @@ -717,6 +721,7 @@ public abstract class Entity {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
} }
@ -63,10 +63,10 @@ index 8e743ec..8feb1d3 100644
protected void C() { protected void C() {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 9210d96..14854ac 100644 index 21819ee..787db39 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -513,6 +513,7 @@ public abstract class EntityLiving extends Entity { @@ -497,6 +497,7 @@ public abstract class EntityLiving extends Entity {
} }
public void l_() { public void l_() {
@ -74,7 +74,7 @@ index 9210d96..14854ac 100644
super.l_(); super.l_();
if (!this.world.isStatic) { if (!this.world.isStatic) {
int i; int i;
@@ -539,7 +540,9 @@ public abstract class EntityLiving extends Entity { @@ -523,7 +524,9 @@ public abstract class EntityLiving extends Entity {
} }
} }
@ -84,7 +84,7 @@ index 9210d96..14854ac 100644
double d0 = this.locX - this.lastX; double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ; double d1 = this.locZ - this.lastZ;
float f = (float) (d0 * d0 + d1 * d1); float f = (float) (d0 * d0 + d1 * d1);
@@ -630,6 +633,7 @@ public abstract class EntityLiving extends Entity { @@ -614,6 +617,7 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.aE += f2; this.aE += f2;
@ -92,7 +92,7 @@ index 9210d96..14854ac 100644
} }
// CraftBukkit start - Delegate so we can handle providing a reason for health being regained // CraftBukkit start - Delegate so we can handle providing a reason for health being regained
@@ -1267,6 +1271,7 @@ public abstract class EntityLiving extends Entity { @@ -1252,6 +1256,7 @@ public abstract class EntityLiving extends Entity {
} }
public void c() { public void c() {
@ -100,7 +100,7 @@ index 9210d96..14854ac 100644
if (this.bX > 0) { if (this.bX > 0) {
--this.bX; --this.bX;
} }
@@ -1318,6 +1323,7 @@ public abstract class EntityLiving extends Entity { @@ -1303,6 +1308,7 @@ public abstract class EntityLiving extends Entity {
this.aA = this.yaw; this.aA = this.yaw;
} }
} }
@ -108,7 +108,7 @@ index 9210d96..14854ac 100644
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.world.methodProfiler.a("jump"); this.world.methodProfiler.a("jump");
@@ -1336,6 +1342,7 @@ public abstract class EntityLiving extends Entity { @@ -1321,6 +1327,7 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.world.methodProfiler.a("travel"); this.world.methodProfiler.a("travel");
@ -116,7 +116,7 @@ index 9210d96..14854ac 100644
this.bD *= 0.98F; this.bD *= 0.98F;
this.bE *= 0.98F; this.bE *= 0.98F;
this.bF *= 0.9F; this.bF *= 0.9F;
@@ -1344,11 +1351,14 @@ public abstract class EntityLiving extends Entity { @@ -1329,11 +1336,14 @@ public abstract class EntityLiving extends Entity {
this.aO *= this.bE(); this.aO *= this.bE();
this.e(this.bD, this.bE); this.e(this.bD, this.bE);
this.aO = f; this.aO = f;

View File

@ -1,14 +1,14 @@
From d55bf0e93b31f79467195af477860b32dba05a1e Mon Sep 17 00:00:00 2001 From 588b88aa24e2ef3f6754056631600c5cf0b1c4dc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 18 Jan 2013 19:31:14 -0500 Date: Fri, 18 Jan 2013 19:31:14 -0500
Subject: [PATCH] Reduce number of LivingEntity collision checks. Subject: [PATCH] Reduce number of LivingEntity collision checks.
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 14854ac..322e37f 100644 index 787db39..bdbd72a 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1430,12 +1430,20 @@ public abstract class EntityLiving extends Entity { @@ -1415,12 +1415,20 @@ public abstract class EntityLiving extends Entity {
} }
protected void bg() { protected void bg() {

View File

@ -1,4 +1,4 @@
From a5e2821e1124465ae5b999e89ba22a19150f762b Mon Sep 17 00:00:00 2001 From 6b9fe9fa4f37f41758621439d6fc94589816420f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 3 Feb 2013 05:10:21 -0500 Date: Sun, 3 Feb 2013 05:10:21 -0500
Subject: [PATCH] Entity Activation Range Subject: [PATCH] Entity Activation Range
@ -9,10 +9,10 @@ This will drastically cut down on tick timings for entities that are not in rang
This change can have dramatic impact on gameplay if configured too low. Balance according to your servers desired gameplay. This change can have dramatic impact on gameplay if configured too low. Balance according to your servers desired gameplay.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 8feb1d3..482fecb 100644 index 171e7e0..4ea11ef 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -89,7 +89,7 @@ public abstract class Entity { @@ -88,7 +88,7 @@ public abstract class Entity {
public int ticksLived; public int ticksLived;
public int maxFireTicks; public int maxFireTicks;
public int fireTicks; // CraftBukkit - private -> public public int fireTicks; // CraftBukkit - private -> public
@ -21,7 +21,7 @@ index 8feb1d3..482fecb 100644
public int noDamageTicks; public int noDamageTicks;
private boolean justCreated; private boolean justCreated;
protected boolean fireProof; protected boolean fireProof;
@@ -112,8 +112,14 @@ public abstract class Entity { @@ -111,8 +111,14 @@ public abstract class Entity {
public EnumEntitySize at; public EnumEntitySize at;
public boolean valid = false; // CraftBukkit public boolean valid = false; // CraftBukkit
@ -36,7 +36,7 @@ index 8feb1d3..482fecb 100644
public Entity(World world) { public Entity(World world) {
this.id = entityCount++; this.id = entityCount++;
this.l = 1.0D; this.l = 1.0D;
@@ -154,7 +160,12 @@ public abstract class Entity { @@ -153,7 +159,12 @@ public abstract class Entity {
this.setPosition(0.0D, 0.0D, 0.0D); this.setPosition(0.0D, 0.0D, 0.0D);
if (world != null) { if (world != null) {
this.dimension = world.worldProvider.dimension; this.dimension = world.worldProvider.dimension;

View File

@ -1,4 +1,4 @@
From 4c6632fc189e01d8cf3ab5d519c78ae31c08c398 Mon Sep 17 00:00:00 2001 From 5a8a674d460ed4ff7502a58cef09557f78532eb6 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Thu, 14 Feb 2013 17:32:20 +1100 Date: Thu, 14 Feb 2013 17:32:20 +1100
Subject: [PATCH] Netty Subject: [PATCH] Netty
@ -32,7 +32,7 @@ Subject: [PATCH] Netty
Commons Attribution-ShareAlike 3.0 Unported license. Commons Attribution-ShareAlike 3.0 Unported license.
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index fce45f8..55e6dc0 100644 index fce45f8..95514d8 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -132,6 +132,11 @@ @@ -132,6 +132,11 @@
@ -42,7 +42,7 @@ index fce45f8..55e6dc0 100644
+ <dependency> + <dependency>
+ <groupId>io.netty</groupId> + <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId> + <artifactId>netty-all</artifactId>
+ <version>4.0.0.Beta3</version> + <version>4.0.0.CR1</version>
+ </dependency> + </dependency>
</dependencies> </dependencies>
@ -229,10 +229,10 @@ index 84dcfcc..a30f217 100644
private static final int RECENT_TICKS; private static final int RECENT_TICKS;
diff --git a/src/main/java/org/spigotmc/netty/CipherCodec.java b/src/main/java/org/spigotmc/netty/CipherCodec.java diff --git a/src/main/java/org/spigotmc/netty/CipherCodec.java b/src/main/java/org/spigotmc/netty/CipherCodec.java
new file mode 100644 new file mode 100644
index 0000000..54928b4 index 0000000..5e3a5f9
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/netty/CipherCodec.java +++ b/src/main/java/org/spigotmc/netty/CipherCodec.java
@@ -0,0 +1,49 @@ @@ -0,0 +1,59 @@
+package org.spigotmc.netty; +package org.spigotmc.netty;
+ +
+import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBuf;
@ -250,8 +250,16 @@ index 0000000..54928b4
+ +
+ private Cipher encrypt; + private Cipher encrypt;
+ private Cipher decrypt; + private Cipher decrypt;
+ private byte[] heapIn = new byte[0]; + private ThreadLocal<byte[]> heapInLocal = new EmptyByteThreadLocal();
+ private byte[] heapOut = new byte[0]; + private ThreadLocal<byte[]> heapOutLocal = new EmptyByteThreadLocal();
+
+ private static class EmptyByteThreadLocal extends ThreadLocal<byte[]> {
+
+ @Override
+ protected byte[] initialValue() {
+ return new byte[0];
+ }
+ }
+ +
+ public CipherCodec(Cipher encrypt, Cipher decrypt) { + public CipherCodec(Cipher encrypt, Cipher decrypt) {
+ this.encrypt = encrypt; + this.encrypt = encrypt;
@ -269,12 +277,14 @@ index 0000000..54928b4
+ } + }
+ +
+ private void cipher(ByteBuf in, ByteBuf out, Cipher cipher) throws ShortBufferException { + private void cipher(ByteBuf in, ByteBuf out, Cipher cipher) throws ShortBufferException {
+ byte[] heapIn = heapInLocal.get();
+ int readableBytes = in.readableBytes(); + int readableBytes = in.readableBytes();
+ if (heapIn.length < readableBytes) { + if (heapIn.length < readableBytes) {
+ heapIn = new byte[readableBytes]; + heapIn = new byte[readableBytes];
+ } + }
+ in.readBytes(heapIn, 0, readableBytes); + in.readBytes(heapIn, 0, readableBytes);
+ +
+ byte[] heapOut = heapOutLocal.get();
+ int outputSize = cipher.getOutputSize(readableBytes); + int outputSize = cipher.getOutputSize(readableBytes);
+ if (heapOut.length < outputSize) { + if (heapOut.length < outputSize) {
+ heapOut = new byte[outputSize]; + heapOut = new byte[outputSize];

View File

@ -1,4 +1,4 @@
From 39127f9cade7372cad29c50fdafb2c5eea11b0a5 Mon Sep 17 00:00:00 2001 From 70a96d7f8788457918d0589525e52ae25150f14b Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sun, 17 Mar 2013 19:02:50 +1100 Date: Sun, 17 Mar 2013 19:02:50 +1100
Subject: [PATCH] Faster UUID for entities Subject: [PATCH] Faster UUID for entities
@ -6,10 +6,10 @@ Subject: [PATCH] Faster UUID for entities
It is overkill to create a new SecureRandom on each entity create and then use it to make a new Entity ID for every entity instance created. Instead we will just use a pseudo random UUID based off the random instance we already have. It is overkill to create a new SecureRandom on each entity create and then use it to make a new Entity ID for every entity instance created. Instead we will just use a pseudo random UUID based off the random instance we already have.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 482fecb..52ecc09 100644 index 4ea11ef..aafaf17 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -154,7 +154,7 @@ public abstract class Entity { @@ -153,7 +153,7 @@ public abstract class Entity {
this.ai = false; this.ai = false;
this.as = 0; this.as = 0;
this.invulnerable = false; this.invulnerable = false;

View File

@ -0,0 +1,22 @@
From ca336d318f06163f3aeeb47fa2ae28c31a459c7d Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 29 Mar 2013 13:56:36 +1000
Subject: [PATCH] Anvil Exploit Fix
diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java
index a1d930c..540b2dc 100644
--- a/src/main/java/net/minecraft/server/Container.java
+++ b/src/main/java/net/minecraft/server/Container.java
@@ -337,7 +337,7 @@ public abstract class Container {
}
} else if (k == 4 && playerinventory.getCarried() == null && i >= 0) {
slot2 = (Slot) this.c.get(i);
- if (slot2 != null && slot2.d()) {
+ if (slot2 != null && slot2.d() && slot2.a(entityhuman)) { // Spigot
itemstack1 = slot2.a(j == 0 ? 1 : slot2.getItem().count);
slot2.a(entityhuman, itemstack1);
entityhuman.drop(itemstack1);
--
1.8.2.1