Archiviert
13
0

Fix crashes when beacons have invalid effects

Dieser Commit ist enthalten in:
Thinkofdeath 2014-12-27 14:03:18 +00:00
Ursprung 89ebcc2143
Commit c76552e4a5

Datei anzeigen

@ -1,5 +1,5 @@
--- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityBeacon.java 2014-11-28 17:43:43.389707429 +0000
+++ src/main/java/net/minecraft/server/TileEntityBeacon.java 2014-11-28 17:38:23.000000000 +0000
--- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityBeacon.java 2014-12-27 14:03:08.349290689 +0000
+++ src/main/java/net/minecraft/server/TileEntityBeacon.java 2014-12-27 14:03:08.349290689 +0000
@@ -5,6 +5,11 @@
import java.util.Iterator;
import java.util.List;
@ -43,6 +43,17 @@
public TileEntityBeacon() {}
@@ -169,8 +198,8 @@
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- this.k = nbttagcompound.getInt("Primary");
- this.l = nbttagcompound.getInt("Secondary");
+ this.k = validateEffect(nbttagcompound.getInt("Primary")); // CraftBukkit
+ this.l = validateEffect(nbttagcompound.getInt("Secondary")); // CraftBukkit
this.j = nbttagcompound.getInt("Levels");
}
@@ -182,7 +211,7 @@
}
@ -52,3 +63,28 @@
}
public ItemStack getItem(int i) {
@@ -282,11 +311,11 @@
break;
case 1:
- this.k = j;
+ this.k = validateEffect(j); // CraftBukkit
break;
case 2:
- this.l = j;
+ this.l = validateEffect(j); // CraftBukkit
}
}
@@ -307,4 +336,10 @@
return super.c(i, j);
}
}
+
+ // CraftBukkit start
+ public int validateEffect(int i) {
+ return i < 0 || i >= MobEffectList.byId.length || MobEffectList.byId[i] == null ? 0 : i;
+ }
+ // CraftBukkit end
}