3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 13:00:06 +01:00
Dieser Commit ist enthalten in:
md_5 2013-12-01 15:36:32 +11:00
Ursprung eb2ab6b421
Commit 0e6412942d
6 geänderte Dateien mit 50 neuen und 67 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
From 27be6c4e1c2e911cd92968c1a58b16e5ee7302a0 Mon Sep 17 00:00:00 2001 From 31c2cbada240f1ffe7e4d5bee414fba7da33def0 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 17:17:20 +1000 Date: Fri, 21 Jun 2013 17:17:20 +1000
Subject: [PATCH] Crop Growth Rates Subject: [PATCH] Crop Growth Rates
@ -26,22 +26,20 @@ index dca832f..ad4e3a2 100644
+ // Spigot end + // Spigot end
} }
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index 421af04..5c7910d 100644 index 421af04..183fb43 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java --- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -23,8 +23,8 @@ public class BlockCactus extends Block { @@ -23,7 +23,7 @@ public class BlockCactus extends Block {
if (l < 3) { if (l < 3) {
int i1 = world.getData(i, j, k); int i1 = world.getData(i, j, k);
- if (i1 == 15) { - if (i1 == 15) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit
+ if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot + if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit
world.setData(i, j, k, 0, 4); world.setData(i, j, k, 0, 4);
this.doPhysics(world, i, j + 1, k, this); this.doPhysics(world, i, j + 1, k, this);
} else {
diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java
index 942d6ab..ef670e8 100644 index 942d6ab..c46879c 100644
--- a/src/main/java/net/minecraft/server/BlockCrops.java --- a/src/main/java/net/minecraft/server/BlockCrops.java
+++ b/src/main/java/net/minecraft/server/BlockCrops.java +++ b/src/main/java/net/minecraft/server/BlockCrops.java
@@ -27,9 +27,8 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement @@ -27,9 +27,8 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement
@ -52,7 +50,7 @@ index 942d6ab..ef670e8 100644
- ++l; - ++l;
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
+ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot + if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, ++l); // CraftBukkit
} }
} }
} }
@ -98,27 +96,18 @@ index 6ac6d94..a401f65 100644
int j1 = j + random.nextInt(5) - 3; int j1 = j + random.nextInt(5) - 3;
int k1 = k + random.nextInt(3) - 1; int k1 = k + random.nextInt(3) - 1;
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index a1350f6..246b951 100644 index a1350f6..6c04ad2 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java --- a/src/main/java/net/minecraft/server/BlockReed.java
+++ b/src/main/java/net/minecraft/server/BlockReed.java +++ b/src/main/java/net/minecraft/server/BlockReed.java
@@ -24,12 +24,11 @@ public class BlockReed extends Block { @@ -24,7 +24,7 @@ public class BlockReed extends Block {
if (l < 3) { if (l < 3) {
int i1 = world.getData(i, j, k); int i1 = world.getData(i, j, k);
- if (i1 == 15) { - if (i1 == 15) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit + if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
- world.setData(i, j, k, 0, 4); org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit
- } else { world.setData(i, j, k, 0, 4);
- world.setData(i, j, k, i1 + 1, 4); } else {
- }
+ if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
+ world.setData(i, j, k, 0, 4);
+ } else {
+ world.setData(i, j, k, i1 + 1, 4);
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java
index 830eb65..24c95ef 100644 index 830eb65..24c95ef 100644
--- a/src/main/java/net/minecraft/server/BlockSapling.java --- a/src/main/java/net/minecraft/server/BlockSapling.java
@ -133,7 +122,7 @@ index 830eb65..24c95ef 100644
} }
} }
diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java
index 4fae805..9c8e816 100644 index 4fae805..a90fab1 100644
--- a/src/main/java/net/minecraft/server/BlockStem.java --- a/src/main/java/net/minecraft/server/BlockStem.java
+++ b/src/main/java/net/minecraft/server/BlockStem.java +++ b/src/main/java/net/minecraft/server/BlockStem.java
@@ -26,7 +26,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { @@ -26,7 +26,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
@ -141,7 +130,7 @@ index 4fae805..9c8e816 100644
float f = this.n(world, i, j, k); float f = this.n(world, i, j, k);
- if (random.nextInt((int) (25.0F / f) + 1) == 0) { - if (random.nextInt((int) (25.0F / f) + 1) == 0) {
+ if (random.nextInt((int) (world.growthOdds / (this.id == Block.PUMPKIN_STEM.id ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot + if (random.nextInt((int) (world.growthOdds / (this == Blocks.PUMPKIN_STEM? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
if (l < 7) { if (l < 7) {

Datei anzeigen

@ -1,14 +1,14 @@
From 4aa2e37f77d90bcae16a89d4aff9727bd4a1fcab Mon Sep 17 00:00:00 2001 From 525c6917d05ab948ff62e430b5f383f6541fae9c Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Tue, 11 Jun 2013 12:17:37 +1000 Date: Tue, 11 Jun 2013 12:17:37 +1000
Subject: [PATCH] More Efficient GetCubes 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 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f0a8024..a8dbc44 100644 index 9a2da15..7bf2225 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1015,16 +1015,42 @@ public abstract class World implements IBlockAccess { @@ -1015,23 +1015,42 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c); int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
@ -47,21 +47,15 @@ index f0a8024..a8dbc44 100644
+ { + {
+ for ( int y = ystart; y < l; y++ ) + for ( int y = ystart; y < l; y++ )
+ { + {
+ int blkid = chunk.getTypeId( x - cx, y, z - cz ); + Block block = chunk.getType(x - cx, y, z - cz );
+ if ( blkid > 0 ) + if ( block != null )
+ { + {
+ Block block = Block.byId[blkid]; + block.a( this, x, y, z, axisalignedbb, this.M, entity );
+
+ if ( block != null )
+ {
+ block.a( this, x, y, z, axisalignedbb, this.M, entity );
+ // SPIGOT TODO: THIS DIFF
+ }
+ } + }
} }
-
block.a(this, k1, i2, l1, axisalignedbb, this.M, entity); - block.a(this, k1, i2, l1, axisalignedbb, this.M, entity);
@@ -1032,6 +1058,7 @@ public abstract class World implements IBlockAccess { }
} }
} }
} }

Datei anzeigen

@ -1,4 +1,4 @@
From d4776c8e08161059f62919e41423f47216e7db43 Mon Sep 17 00:00:00 2001 From 2e44ad82193e6afedb8f43093e8c68eab962ef79 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, 7 Mar 2013 20:12:46 +1100 Date: Thu, 7 Mar 2013 20:12:46 +1100
Subject: [PATCH] Async Operation Catching Subject: [PATCH] Async Operation Catching
@ -6,7 +6,7 @@ Subject: [PATCH] Async Operation Catching
Catch and throw an exception when a potentially unsafe operation occurs on a thread other than the main server thread. Catch and throw an exception when a potentially unsafe operation occurs on a thread other than the main server thread.
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index ad4e3a2..32f8c3f 100644 index ad4e3a2..c063ca1 100644
--- a/src/main/java/net/minecraft/server/Block.java --- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java
@@ -433,9 +433,13 @@ public class Block { @@ -433,9 +433,13 @@ public class Block {
@ -19,7 +19,7 @@ index ad4e3a2..32f8c3f 100644
+ } + }
- public void remove(World world, int i, int j, int k, Block block, int l) {} - public void remove(World world, int i, int j, int k, Block block, int l) {}
+ public void remove(World world, int i, int j, int k, int l, int i1) { + public void remove(World world, int i, int j, int k, Block block, int l) {
+ if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous block remove!"); // Spigot + if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous block remove!"); // Spigot
+ } + }
@ -66,7 +66,7 @@ index 9f818cf..8052ea6 100644
this.trackedPlayers.remove(entityplayer); this.trackedPlayers.remove(entityplayer);
entityplayer.removeQueue.add(Integer.valueOf(this.tracker.getId())); entityplayer.removeQueue.add(Integer.valueOf(this.tracker.getId()));
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/World.java b/src/main/java/net/minecraft/server/World.java
index c91ae63..967565b 100644 index 3f9eb56..b21bff3 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -896,6 +896,7 @@ public abstract class World implements IBlockAccess { @@ -896,6 +896,7 @@ public abstract class World implements IBlockAccess {
@ -85,7 +85,7 @@ index c91ae63..967565b 100644
entity.die(); entity.die();
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
this.players.remove(entity); this.players.remove(entity);
@@ -2398,6 +2400,7 @@ public abstract class World implements IBlockAccess { @@ -2390,6 +2392,7 @@ public abstract class World implements IBlockAccess {
} }
public void a(List list) { public void a(List list) {

Datei anzeigen

@ -1,11 +1,11 @@
From 5778aaae32fd276df37a9941ec8c281431bd3803 Mon Sep 17 00:00:00 2001 From ee9e6ca1ffb8d21f7ba22952c3949e15f3ab3ef3 Mon Sep 17 00:00:00 2001
From: Mike Primm <mike@primmhome.com> From: Mike Primm <mike@primmhome.com>
Date: Wed, 16 Jan 2013 15:27:22 -0600 Date: Wed, 16 Jan 2013 15:27:22 -0600
Subject: [PATCH] Sync Free Chunk Reference Cache Subject: [PATCH] Sync Free Chunk Reference Cache
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/World.java b/src/main/java/net/minecraft/server/World.java
index 967565b..93c476c 100644 index b21bff3..f7fa2fe 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -290,20 +290,18 @@ public abstract class World implements IBlockAccess { @@ -290,20 +290,18 @@ public abstract class World implements IBlockAccess {
@ -25,7 +25,7 @@ index 967565b..93c476c 100644
- result = this.lastChunkAccessed; - result = this.lastChunkAccessed;
+ //synchronized (this.chunkLock) { + //synchronized (this.chunkLock) {
+ Chunk result = this.lastChunkAccessed; // Exploit fact that read is atomic + Chunk result = this.lastChunkAccessed; // Exploit fact that read is atomic
+ if (result == null || result.x != i || result.z != j) { + if (result == null || result.locX != i || result.locZ != j) {
+ result = this.chunkProvider.getOrCreateChunk(i, j); + result = this.chunkProvider.getOrCreateChunk(i, j);
+ this.lastChunkAccessed = result; // Exploit fact that write is atomic + this.lastChunkAccessed = result; // Exploit fact that write is atomic
} }

Datei anzeigen

@ -1,4 +1,4 @@
From 75e5b9146eb945a1f5418ebab5da804264db3067 Mon Sep 17 00:00:00 2001 From ec7ff8fd9912318adb6bbb213fd478c7cde5f1ed 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
@ -198,7 +198,7 @@ index 811f1a4..3de32fe 100644
private static Map i = new HashMap(); private static Map i = new HashMap();
private static Map j = new HashMap(); private static Map j = new HashMap();
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/World.java b/src/main/java/net/minecraft/server/World.java
index 93c476c..b1f294d 100644 index f7fa2fe..4a9d48b 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -13,6 +13,7 @@ import java.util.concurrent.Callable; @@ -13,6 +13,7 @@ import java.util.concurrent.Callable;
@ -226,7 +226,7 @@ index 93c476c..b1f294d 100644
} }
protected abstract IChunkProvider j(); protected abstract IChunkProvider j();
@@ -1250,6 +1254,7 @@ public abstract class World implements IBlockAccess { @@ -1242,6 +1246,7 @@ public abstract class World implements IBlockAccess {
this.f.clear(); this.f.clear();
this.methodProfiler.c("regular"); this.methodProfiler.c("regular");
@ -234,7 +234,7 @@ index 93c476c..b1f294d 100644
for (i = 0; i < this.entityList.size(); ++i) { for (i = 0; i < this.entityList.size(); ++i) {
entity = (Entity) this.entityList.get(i); entity = (Entity) this.entityList.get(i);
@@ -1272,7 +1277,9 @@ public abstract class World implements IBlockAccess { @@ -1264,7 +1269,9 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.a("tick"); this.methodProfiler.a("tick");
if (!entity.dead) { if (!entity.dead) {
try { try {
@ -244,7 +244,7 @@ index 93c476c..b1f294d 100644
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
crashreport = CrashReport.a(throwable1, "Ticking entity"); crashreport = CrashReport.a(throwable1, "Ticking entity");
crashreportsystemdetails = crashreport.a("Entity being ticked"); crashreportsystemdetails = crashreport.a("Entity being ticked");
@@ -1297,7 +1304,9 @@ public abstract class World implements IBlockAccess { @@ -1289,7 +1296,9 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.b(); this.methodProfiler.b();
} }
@ -254,7 +254,7 @@ index 93c476c..b1f294d 100644
this.N = true; this.N = true;
Iterator iterator = this.tileEntityList.iterator(); Iterator iterator = this.tileEntityList.iterator();
@@ -1312,8 +1321,11 @@ public abstract class World implements IBlockAccess { @@ -1304,8 +1313,11 @@ public abstract class World implements IBlockAccess {
if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) { if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) {
try { try {
@ -266,7 +266,7 @@ index 93c476c..b1f294d 100644
crashreport = CrashReport.a(throwable2, "Ticking block entity"); crashreport = CrashReport.a(throwable2, "Ticking block entity");
crashreportsystemdetails = crashreport.a("Block entity being ticked"); crashreportsystemdetails = crashreport.a("Block entity being ticked");
tileentity.a(crashreportsystemdetails); tileentity.a(crashreportsystemdetails);
@@ -1333,6 +1345,8 @@ public abstract class World implements IBlockAccess { @@ -1325,6 +1337,8 @@ public abstract class World implements IBlockAccess {
} }
} }
@ -275,7 +275,7 @@ index 93c476c..b1f294d 100644
this.N = false; this.N = false;
if (!this.b.isEmpty()) { if (!this.b.isEmpty()) {
this.tileEntityList.removeAll(this.b); this.tileEntityList.removeAll(this.b);
@@ -1371,6 +1385,7 @@ public abstract class World implements IBlockAccess { @@ -1363,6 +1377,7 @@ public abstract class World implements IBlockAccess {
this.a.clear(); this.a.clear();
} }
@ -283,7 +283,7 @@ index 93c476c..b1f294d 100644
this.methodProfiler.b(); this.methodProfiler.b();
this.methodProfiler.b(); this.methodProfiler.b();
} }
@@ -1393,6 +1408,7 @@ public abstract class World implements IBlockAccess { @@ -1385,6 +1400,7 @@ public abstract class World implements IBlockAccess {
byte b0 = 32; byte b0 = 32;
if (!flag || this.b(i - b0, 0, j - b0, i + b0, 0, j + b0)) { if (!flag || this.b(i - b0, 0, j - b0, i + b0, 0, j + b0)) {
@ -291,7 +291,7 @@ index 93c476c..b1f294d 100644
entity.T = entity.locX; entity.T = entity.locX;
entity.U = entity.locY; entity.U = entity.locY;
entity.V = entity.locZ; entity.V = entity.locZ;
@@ -1454,6 +1470,7 @@ public abstract class World implements IBlockAccess { @@ -1446,6 +1462,7 @@ public abstract class World implements IBlockAccess {
entity.passenger = null; entity.passenger = null;
} }
} }

Datei anzeigen

@ -1,4 +1,4 @@
From 9ab09589f7ca0433a1c6aac5b6f6cc847e82995d Mon Sep 17 00:00:00 2001 From b6377ce207cad41a8ff913d19889573b70a245ff 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, 16 May 2013 18:51:05 +1000 Date: Thu, 16 May 2013 18:51:05 +1000
Subject: [PATCH] Orebfuscator Subject: [PATCH] Orebfuscator
@ -103,7 +103,7 @@ index 3028404..e24d4b5 100644
} }
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/World.java b/src/main/java/net/minecraft/server/World.java
index b276a3d..57511c8 100644 index 4a9d48b..7f8d224 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -464,6 +464,7 @@ public abstract class World implements IBlockAccess { @@ -464,6 +464,7 @@ public abstract class World implements IBlockAccess {
@ -116,7 +116,7 @@ index b276a3d..57511c8 100644
public void b(int i, int j, int k, Block block, int l) { 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 diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
new file mode 100644 new file mode 100644
index 0000000..c165304 index 0000000..6413ac0
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/AntiXray.java +++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -0,0 +1,204 @@ @@ -0,0 +1,204 @@
@ -153,9 +153,9 @@ index 0000000..c165304
+ // If we are obfuscating it + // If we are obfuscating it
+ if ( obfuscateBlocks[i] ) + if ( obfuscateBlocks[i] )
+ { + {
+ Block block = Block.byId[i]; + Block block = Block.e(i);
+ // Check it exists and is not a tile entity + // Check it exists and is not a tile entity
+ if ( block != null && !block.t() /* isTileEntity */ ) + if ( block != null && !block.isTileEntity() )
+ { + {
+ // Add it to the set of replacement blocks + // Add it to the set of replacement blocks
+ blocks.add( (byte) i ); + blocks.add( (byte) i );
@ -249,7 +249,7 @@ index 0000000..c165304
+ { + {
+ case 1: + case 1:
+ // Replace with stone + // Replace with stone
+ buffer[index] = (byte) Block.STONE.id; + buffer[index] = 1;
+ break; + break;
+ case 2: + case 2:
+ // Replace with random ore. + // Replace with random ore.
@ -278,10 +278,10 @@ index 0000000..c165304
+ if ( world.isLoaded( x, y, z ) ) + if ( world.isLoaded( x, y, z ) )
+ { + {
+ // Get block id + // Get block id
+ int id = world.getTypeId( x, y, z ); + Block block = world.getType(x, y, z);
+ +
+ // See if it needs update + // See if it needs update
+ if ( updateSelf && obfuscateBlocks[id] ) + if ( updateSelf && obfuscateBlocks[Block.b(block)] )
+ { + {
+ // Send the update + // Send the update
+ world.notify( x, y, z ); + world.notify( x, y, z );
@ -314,7 +314,7 @@ index 0000000..c165304
+ +
+ private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius) + private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius)
+ { + {
+ return !Block.l( world.getTypeId( x, y, z ) ) /* isSolidBlock */ + return !world.getType(x, y, z).r() /* isSolidBlock */
+ || ( radius > 0 + || ( radius > 0
+ && ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 ) + && ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 )
+ || hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 ) + || hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 )