Fix NPE in mob spawner blocks on non-bukkit implementations

Dieser Commit ist enthalten in:
wizjany 2013-03-17 22:11:29 -04:00
Ursprung 2e8119bdb1
Commit 422cba101d

Datei anzeigen

@ -147,8 +147,8 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
values.put("MaxSpawnDelay", new ShortTag("MaxSpawnDelay", maxSpawnDelay)); values.put("MaxSpawnDelay", new ShortTag("MaxSpawnDelay", maxSpawnDelay));
values.put("MaxNearbyEntities", new ShortTag("MaxNearbyEntities", maxNearbyEntities)); values.put("MaxNearbyEntities", new ShortTag("MaxNearbyEntities", maxNearbyEntities));
values.put("RequiredPlayerRange", new ShortTag("RequiredPlayerRange", requiredPlayerRange)); values.put("RequiredPlayerRange", new ShortTag("RequiredPlayerRange", requiredPlayerRange));
values.put("SpawnData", new CompoundTag("SpawnData", spawnData.getValue())); values.put("SpawnData", new CompoundTag("SpawnData", spawnData == null ? null : spawnData.getValue()));
values.put("SpawnPotentials", new ListTag("SpawnPotentials", CompoundTag.class, spawnPotentials.getValue())); values.put("SpawnPotentials", new ListTag("SpawnPotentials", CompoundTag.class, spawnPotentials == null ? null : spawnPotentials.getValue()));
return new CompoundTag(getNbtId(), values); return new CompoundTag(getNbtId(), values);
} }
@ -192,14 +192,14 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
} catch (InvalidFormatException e) { // leave tag as null, handle later } catch (InvalidFormatException e) { // leave tag as null, handle later
} }
this.spawnCount = spawnCountTag.getValue(); this.spawnCount = spawnCountTag == null ? null : spawnCountTag.getValue();
this.spawnRange = spawnRangeTag.getValue(); this.spawnRange = spawnRangeTag == null ? null : spawnRangeTag.getValue();
this.minSpawnDelay = minSpawnDelayTag.getValue(); this.minSpawnDelay = minSpawnDelayTag == null ? null : minSpawnDelayTag.getValue();
this.maxSpawnDelay = maxSpawnDelayTag.getValue(); this.maxSpawnDelay = maxSpawnDelayTag == null ? null : maxSpawnDelayTag.getValue();
this.maxNearbyEntities = maxNearbyEntitiesTag.getValue(); this.maxNearbyEntities = maxNearbyEntitiesTag == null ? null : maxNearbyEntitiesTag.getValue();
this.requiredPlayerRange = requiredPlayerRangeTag.getValue(); this.requiredPlayerRange = requiredPlayerRangeTag == null ? null : requiredPlayerRangeTag.getValue();
this.spawnPotentials = new ListTag("SpawnPotentials", CompoundTag.class, spawnPotentialsTag.getValue()); this.spawnPotentials = new ListTag("SpawnPotentials", CompoundTag.class, spawnPotentialsTag == null ? null : spawnPotentialsTag.getValue());
this.spawnData = new CompoundTag("SpawnData", spawnDataTag.getValue()); this.spawnData = new CompoundTag("SpawnData", spawnDataTag == null ? null : spawnDataTag.getValue());
} }
} }