Commits

md_5 authored d548daac2f9
SPIGOT-7446: BlockState#update not updating a spawner's type to null
No tags

src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java

Modified
25 25 }
26 26
27 27 Optional<EntityTypes<?>> type = EntityTypes.by(spawnData.getEntityToSpawn());
28 28 return type.map(entityTypes -> EntityType.fromName(EntityTypes.getKey(entityTypes).getPath())).orElse(null);
29 29 }
30 30
31 31 @Override
32 32 public void setSpawnedType(EntityType entityType) {
33 33 if (entityType == null) {
34 34 this.getSnapshot().getSpawner().spawnPotentials = SimpleWeightedRandomList.empty(); // need clear the spawnPotentials to avoid nextSpawnData being replaced later
35 - this.getSnapshot().getSpawner().nextSpawnData = null;
35 + this.getSnapshot().getSpawner().nextSpawnData = new MobSpawnerData();
36 36 return;
37 37 }
38 38 Preconditions.checkArgument(entityType != EntityType.UNKNOWN, "Can't spawn EntityType %s from mob spawners!", entityType);
39 39
40 40 RandomSource rand = (this.isPlaced()) ? this.getWorldHandle().getRandom() : RandomSource.create();
41 41 this.getSnapshot().setEntityId(EntityTypes.byString(entityType.getName()).get(), rand);
42 42 }
43 43
44 44 @Override
45 45 public String getCreatureTypeName() {

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut