mirror of
https://github.com/craftaro/EpicSpawners.git
synced 2025-01-07 03:07:06 +08:00
Merge pull request #30 from xsmeths/development
fix for continuous egg entity spawn causing infinite chickens
This commit is contained in:
commit
965d3deab2
@ -208,7 +208,7 @@ public class BlockListeners implements Listener {
|
||||
try {
|
||||
creatureSpawner.setSpawnedType(spawnerTier.getEntities().get(0));
|
||||
} catch (Exception ex) {
|
||||
creatureSpawner.setSpawnedType(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) ? EntityType.EGG : EntityType.DROPPED_ITEM);
|
||||
creatureSpawner.setSpawnedType(ServerVersion.isServerVersionBelow(ServerVersion.V1_9) ? EntityType.EGG : EntityType.DROPPED_ITEM);
|
||||
}
|
||||
|
||||
spawner.updateDelay();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.craftaro.epicspawners.spawners.spawner;
|
||||
|
||||
import com.craftaro.core.compatibility.ServerVersion;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.SpawnerData;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.SpawnerTier;
|
||||
@ -238,7 +239,11 @@ public class SpawnerDataImpl implements SpawnerData {
|
||||
public void addDefaultTier() {
|
||||
SpawnerTier tier = new SpawnerTierImpl(this);
|
||||
tier.addCondition(new SpawnConditionNearbyPlayers(16, 1));
|
||||
tier.addCondition(new SpawnConditionHeight(0, 265));
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_17)) {
|
||||
tier.addCondition(new SpawnConditionHeight(0, 265));
|
||||
} else {
|
||||
tier.addCondition(new SpawnConditionHeight(-64, 320));
|
||||
}
|
||||
tier.addCondition(new SpawnConditionBiome(Biome.values()));
|
||||
tier.addCondition(new SpawnConditionLightDark(SpawnConditionLightDark.Type.BOTH));
|
||||
tier.addCondition(new SpawnConditionStorm(false));
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.craftaro.epicspawners.spawners.spawner;
|
||||
|
||||
import com.craftaro.core.compatibility.CompatibleBiome;
|
||||
import com.craftaro.core.compatibility.ServerVersion;
|
||||
import com.craftaro.core.configuration.Config;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
|
||||
@ -262,7 +263,11 @@ public class SpawnerManagerImpl implements SpawnerManager {
|
||||
} else {
|
||||
tier.addCondition(new SpawnConditionBiome(Biome.values()));
|
||||
// TODO: These values should probably be *world* dependent as even in older versions, the max build height could be higher (vanilla spawners probably work up there too?)
|
||||
tier.addCondition(new SpawnConditionHeight(-64, 320));
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_17)) {
|
||||
tier.addCondition(new SpawnConditionHeight(0, 265));
|
||||
} else {
|
||||
tier.addCondition(new SpawnConditionHeight(-64, 320));
|
||||
}
|
||||
}
|
||||
if (Monster.class.isAssignableFrom(type.getEntityClass())) {
|
||||
tier.addCondition(new SpawnConditionLightDark(SpawnConditionLightDark.Type.DARK));
|
||||
|
@ -120,7 +120,7 @@ public class AppearanceTask extends BukkitRunnable {
|
||||
EntityType next = spawnerTier.getEntities().get(0);
|
||||
spawner.getCreatureSpawner().setSpawnedType(next);
|
||||
} catch (Exception failure) {
|
||||
spawner.getCreatureSpawner().setSpawnedType(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) ? EntityType.EGG : EntityType.DROPPED_ITEM);
|
||||
spawner.getCreatureSpawner().setSpawnedType(ServerVersion.isServerVersionBelow(ServerVersion.V1_9) ? EntityType.EGG : EntityType.DROPPED_ITEM);
|
||||
if (itemStack.getType() == Material.AIR) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user