62 lines
2.2 KiB
Diff
62 lines
2.2 KiB
Diff
|
From e6ed2f4e16c26134c5b177a3f37df5fa0c7c711b Mon Sep 17 00:00:00 2001
|
||
|
From: Thinkofdeath <thethinkofdeath@gmail.com>
|
||
|
Date: Wed, 15 Jan 2014 21:52:47 +0000
|
||
|
Subject: [PATCH] Block data values that crash the client
|
||
|
|
||
|
|
||
|
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||
|
index 51ebb7e..944170b 100644
|
||
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||
|
@@ -115,7 +115,7 @@ public class Chunk {
|
||
|
}
|
||
|
|
||
|
this.sections[l1].setTypeId(l, j1 & 15, i1, block);
|
||
|
- this.sections[l1].setData(l, j1 & 15, i1, abyte[k1]);
|
||
|
+ this.sections[l1].setData(l, j1 & 15, i1, checkData( block, abyte[k1] ) );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
@@ -398,6 +398,17 @@ public class Chunk {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+ // Spigot start - prevent invalid data values
|
||
|
+ private static int checkData( Block block, int l )
|
||
|
+ {
|
||
|
+ if (block == Block.b( "minecraft:double_plant" ) )
|
||
|
+ {
|
||
|
+ return l == 7 ? 0 : l;
|
||
|
+ }
|
||
|
+ return l;
|
||
|
+ }
|
||
|
+ // Spigot end
|
||
|
+
|
||
|
public boolean a(int i, int j, int k, Block block, int l) {
|
||
|
int i1 = k << 4 | i;
|
||
|
|
||
|
@@ -452,7 +463,7 @@ public class Chunk {
|
||
|
if (chunksection.getTypeId(i, j & 15, k) != block) {
|
||
|
return false;
|
||
|
} else {
|
||
|
- chunksection.setData(i, j & 15, k, l);
|
||
|
+ chunksection.setData(i, j & 15, k, checkData( block, l ) );
|
||
|
if (flag) {
|
||
|
this.initLighting();
|
||
|
} else {
|
||
|
@@ -522,8 +533,9 @@ public class Chunk {
|
||
|
return false;
|
||
|
} else {
|
||
|
this.n = true;
|
||
|
- chunksection.setData(i, j & 15, k, l);
|
||
|
- if (chunksection.getTypeId(i, j & 15, k) instanceof IContainer) {
|
||
|
+ Block block = chunksection.getTypeId( i, j & 15, k );
|
||
|
+ chunksection.setData(i, j & 15, k, checkData( block, l ) );
|
||
|
+ if (block instanceof IContainer) {
|
||
|
TileEntity tileentity = this.e(i, j, k);
|
||
|
|
||
|
if (tileentity != null) {
|
||
|
--
|
||
|
1.8.4.msysgit.0
|
||
|
|