Paper/CraftBukkit-Patches/0081-Block-data-values-that-crash-the-client.patch
Zach Brown cab333b217 Rebase (Update) from upstream SpigotMC
Don't send requests of every player was found in the global api cache SpigotMC/Spigot@841270ff1e
Correctly set the response code for the cached lookups and return the ... SpigotMC/Spigot@f170b7899c
Don't try and re-set the global api cache on reload SpigotMC/Spigot@b410a00a66
Use a compile time sneaky throw hack. SpigotMC/Spigot@508462b96b
Fix a missed rename in WorldGenGroundBush SpigotMC/Spigot@0614d8fae9
2014-11-28 14:19:07 -06:00

62 lines
2.2 KiB
Diff

From 997afb5aad670c728af441e671881a5d72a76a3c 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 b1213f0..cbcc9e9 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -143,7 +143,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] ) );
}
}
}
@@ -426,6 +426,17 @@ public class Chunk {
}
}
+ // Spigot start - prevent invalid data values
+ public static int checkData( Block block, int data )
+ {
+ if (block == Blocks.DOUBLE_PLANT )
+ {
+ return data < 6 || data >= 8 ? data : 0;
+ }
+ return data;
+ }
+ // Spigot end
+
public boolean a(int i, int j, int k, Block block, int l) {
int i1 = k << 4 | i;
@@ -480,7 +491,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 {
@@ -545,8 +556,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.9.1