mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 01:04:29 +00:00
Modded loot, drops, spawns, mobs and effects ask the modules through host-typed content services
This commit is contained in:
1 parent
f404dec7d7
commit
fbbc9ce4ac
24 files changed
+1178
-944
No files matched your search
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.core.content;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An ambient effect that plays now, in host terms: what {@code com.volmit.service.AmbientEffects.Effect} says. The
|
||||
* adapter carries out the parts it has, in the order sound, particles, commands, potion.
|
||||
*/
|
||||
public record ContentEffect(Sound sound, Particles particles, List<Command> commands, Potion potion) {
|
||||
/** A sound, with blocks offset from the player and the volume and pitch decided. */
|
||||
public record Sound(String key, int offsetX, int offsetY, int offsetZ, float volume, float pitch) {
|
||||
}
|
||||
|
||||
/** Particles {@code forward} blocks ahead of the player and {@code sideways} to the right, on the surface there. */
|
||||
public record Particles(String key, double forward, double sideways, double jitterX, double jitterZ, int lift, int count,
|
||||
double altX, double altY, double altZ, double extra) {
|
||||
}
|
||||
|
||||
/** Commands run offset from the player. */
|
||||
public record Command(ContentEntity.Command command, double offsetX, double offsetY, double offsetZ) {
|
||||
}
|
||||
|
||||
/** A potion effect for the player; one with a stronger amplifier already on the player stays. */
|
||||
public record Potion(String key, int strength, int ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.core.content;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An entity a module decided on, in host terms: what {@code com.volmit.entity.EntitySpec} says, for adapters that cannot
|
||||
* name IrisApi types. Everything random was decided by the module; the adapter creates and configures the entity.
|
||||
*/
|
||||
public record ContentEntity(String type, String specialType, String reason, String customName, Flags flags, Equipment equipment,
|
||||
List<ContentEntity> passengers, List<ContentItem.Attribute> attributes, List<String> lootTables,
|
||||
long lootShuffleSeed, ContentEntity leashHolder, SpawnEffect spawnEffect, boolean riseOutOfGround,
|
||||
String pandaMainGene, String pandaHiddenGene, boolean applySettingsToSpecial,
|
||||
List<Command> commands) {
|
||||
/** Whether the entity is a mob of another plugin. */
|
||||
public boolean isSpecial() {
|
||||
return !specialType.isEmpty();
|
||||
}
|
||||
|
||||
/** What an entity can be set to be, whatever its kind. */
|
||||
public record Flags(boolean customNameVisible, boolean aware, boolean ai, boolean glowing, boolean gravity,
|
||||
boolean invulnerable, boolean silent, boolean pickupItems, boolean removable,
|
||||
boolean keepEntity, boolean baby) {
|
||||
}
|
||||
|
||||
/** The items an entity wears and holds; null for an empty slot. */
|
||||
public record Equipment(ContentItem helmet, ContentItem chestplate, ContentItem leggings, ContentItem boots,
|
||||
ContentItem mainHand, ContentItem offHand) {
|
||||
}
|
||||
|
||||
/** Sound and particles shown around an entity that appears; the adapter makes the random choices of the particle motion. */
|
||||
public record SpawnEffect(String sound, int soundDistance, double minPitch, double maxPitch, double volume,
|
||||
String particle, int particleOffset, int particleCount, double altX, double altY,
|
||||
double altZ, boolean randomAltX, boolean randomAltY, boolean randomAltZ, double extra) {
|
||||
}
|
||||
|
||||
/** Console commands run when an entity appears; {@code {x}}, {@code {y}} and {@code {z}} stand for its block position. */
|
||||
public record Command(List<String> commands, long delay, boolean repeat, long repeatDelay) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.core.content;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An item a module decided on, in host terms: what {@code com.volmit.item.ItemDrop} says, for adapters that cannot name
|
||||
* IrisApi types. The module made every random choice; the adapter only creates the item on its platform.
|
||||
*
|
||||
* @param damage the fraction of the item's durability already used, or null to leave it undamaged
|
||||
*/
|
||||
public record ContentItem(String item, int amount, String displayName, List<String> lore, List<Enchantment> enchantments,
|
||||
List<Attribute> attributes, boolean unbreakable, List<String> flags, Integer customModel,
|
||||
Double damage, String leatherColor, String dyeColor, Map<String, Object> customNbt) {
|
||||
/** An enchantment at the level the module decided. */
|
||||
public record Enchantment(String key, int level) {
|
||||
}
|
||||
|
||||
/** An attribute modifier with the amount the module decided. */
|
||||
public record Attribute(String attribute, String name, String operation, double amount) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.core.content;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** Where a container's items come from and what a broken block drops, in host terms. */
|
||||
public final class ContentLoot {
|
||||
private ContentLoot() {
|
||||
}
|
||||
|
||||
/** One source of a container's items, in the order their items are added. */
|
||||
public sealed interface Part permits Items, PlatformTable {
|
||||
}
|
||||
|
||||
/** Items a module drew from one of the pack's loot tables. */
|
||||
public record Items(List<ContentItem> items) implements Part {
|
||||
}
|
||||
|
||||
/** A loot table of the platform, which the adapter draws with {@code seed} so the same container always gets the same items. */
|
||||
public record PlatformTable(String key, long seed) implements Part {
|
||||
}
|
||||
|
||||
/**
|
||||
* What the modules drop for a broken block.
|
||||
*
|
||||
* @param replacesVanillaDrops whether the platform's own drops of the block are not dropped
|
||||
*/
|
||||
public record BlockDrops(List<ContentItem> drops, boolean replacesVanillaDrops) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.core.content;
|
||||
|
||||
import art.arcane.iris.core.modules.ModuleServices;
|
||||
import art.arcane.iris.core.modules.PlatformBlockStates;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.entity.EntitySpec;
|
||||
import com.volmit.item.ItemAttribute;
|
||||
import com.volmit.item.ItemDrop;
|
||||
import com.volmit.item.ItemEnchantment;
|
||||
import com.volmit.service.AmbientEffects;
|
||||
import com.volmit.service.BlockDrops;
|
||||
import com.volmit.service.EntitySpawns;
|
||||
import com.volmit.service.Loot;
|
||||
import com.volmit.world.BlockPosition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* What the pack's modules say about loot, block drops, spawns and ambient effects, for adapters that cannot name IrisApi
|
||||
* types: the questions take plain values and the answers are the host types of this package. The modded adapters, which
|
||||
* fill containers, drop blocks, spawn mobs and play effects themselves, ask here instead of reading the pack's classes.
|
||||
*/
|
||||
public final class ContentServices {
|
||||
private ContentServices() {
|
||||
}
|
||||
|
||||
/**
|
||||
* The sources of the loot of the container at {@code x}, {@code worldY}, {@code z}, in the order their items are added.
|
||||
*
|
||||
* @param containerKey the platform's key for the block when it is a storage chest an object may have given loot, else null
|
||||
*/
|
||||
public static List<ContentLoot.Part> containerLoot(Engine engine, int x, int worldY, int z, String containerKey, boolean nativeLootDefined) {
|
||||
BlockState container = containerKey == null ? null : BlockState.parse(PlatformBlockStates.namespaced(containerKey));
|
||||
Loot.Site site = new Loot.Site(position(engine, x, worldY, z), container, nativeLootDefined, false);
|
||||
List<ContentLoot.Part> parts = new ArrayList<>();
|
||||
for (Loot.Source source : ModuleServices.lootTables(engine, site)) {
|
||||
switch (source) {
|
||||
case Loot.Table table -> parts.add(new ContentLoot.Items(tableItems(engine, x, worldY, z, table.key())));
|
||||
case Loot.PlatformTable table -> parts.add(new ContentLoot.PlatformTable(table.key(), table.seed()));
|
||||
}
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
/** The items the pack's loot table {@code tableKey} gives at the spot. */
|
||||
public static List<ContentItem> tableItems(Engine engine, int x, int worldY, int z, String tableKey) {
|
||||
Loot.Site site = new Loot.Site(position(engine, x, worldY, z), null, false, false);
|
||||
return ModuleServices.lootItems(engine, site, tableKey).stream().map(ContentServices::itemOf).toList();
|
||||
}
|
||||
|
||||
/** What the modules drop for the block with the platform's key {@code blockKey} broken at the spot. */
|
||||
public static ContentLoot.BlockDrops blockDrops(Engine engine, int x, int worldY, int z, String blockKey) {
|
||||
BlockDrops.Result result = ModuleServices.blockDrops(engine, new BlockDrops.Broken(position(engine, x, worldY, z),
|
||||
BlockState.parse(PlatformBlockStates.namespaced(blockKey))));
|
||||
return new ContentLoot.BlockDrops(result.drops().stream().map(ContentServices::itemOf).toList(), result.replacesVanillaDrops());
|
||||
}
|
||||
|
||||
/** What the first module with something to spawn in the chunk plans. */
|
||||
public static Optional<ContentSpawns.Plan> planChunkSpawn(Engine engine, int chunkX, int chunkZ, int livingEntities, boolean initial) {
|
||||
return planned(engine, new EntitySpawns.Chunk(chunkX, chunkZ, livingEntities, initial));
|
||||
}
|
||||
|
||||
/** What the first module that knows the spawner plans at the marker block. */
|
||||
public static Optional<ContentSpawns.Plan> planMarkerSpawn(Engine engine, int x, int worldY, int z, String marker, String spawner, boolean initial) {
|
||||
return planned(engine, new EntitySpawns.Marker(position(engine, x, worldY, z), marker, spawner, initial));
|
||||
}
|
||||
|
||||
/** What the marker with the tag {@code tag} does; empty for a tag no module knows. */
|
||||
public static Optional<ContentSpawns.MarkerRule> markerRule(Engine engine, String tag) {
|
||||
return ModuleServices.markerRule(engine, tag)
|
||||
.map(rule -> new ContentSpawns.MarkerRule(rule.spawners(), rule.emptyAbove(), rule.removeOnChange()));
|
||||
}
|
||||
|
||||
/** The entity of the pack named {@code key} as a module would spawn it; empty for an unknown key. */
|
||||
public static Optional<ContentEntity> entity(Engine engine, String key) {
|
||||
return ModuleServices.entity(engine, key).map(ContentServices::entityOf);
|
||||
}
|
||||
|
||||
/** The ambient effects due for a player standing at the spot. */
|
||||
public static List<ContentEffect> ambientEffects(Engine engine, int x, int worldY, int z) {
|
||||
return ModuleServices.ambientEffects(engine, position(engine, x, worldY, z)).stream().map(ContentServices::effectOf).toList();
|
||||
}
|
||||
|
||||
private static Optional<ContentSpawns.Plan> planned(Engine engine, EntitySpawns.Site site) {
|
||||
return ModuleServices.planSpawn(engine, site).map(planned -> new ContentSpawns.Plan(planned, attemptsOf(engine, planned.plan())));
|
||||
}
|
||||
|
||||
private static List<ContentSpawns.Attempt> attemptsOf(Engine engine, EntitySpawns.Plan plan) {
|
||||
List<ContentSpawns.Attempt> attempts = new ArrayList<>();
|
||||
for (EntitySpawns.Attempt attempt : plan.attempts()) {
|
||||
attempts.add(new ContentSpawns.Attempt(attempt.at().x(), attempt.at().y() + engine.getMinHeight(), attempt.at().z(),
|
||||
entityOf(attempt.entity()), ContentSpawns.surfaceOf(attempt.surface()), attempt.minLight(), attempt.maxLight(),
|
||||
attempt.checkSurface()));
|
||||
}
|
||||
return attempts;
|
||||
}
|
||||
|
||||
private static BlockPosition position(Engine engine, int x, int worldY, int z) {
|
||||
return new BlockPosition(x, worldY - engine.getMinHeight(), z);
|
||||
}
|
||||
|
||||
private static ContentItem itemOf(ItemDrop drop) {
|
||||
return new ContentItem(drop.item(), drop.amount(), drop.displayName(), drop.lore(),
|
||||
drop.enchantments().stream().map(ContentServices::enchantmentOf).toList(),
|
||||
drop.attributes().stream().map(ContentServices::attributeOf).toList(), drop.unbreakable(), drop.flags(),
|
||||
drop.customModel(), drop.damage(), drop.leatherColor(), drop.dyeColor(), drop.customNbt());
|
||||
}
|
||||
|
||||
private static ContentItem.Enchantment enchantmentOf(ItemEnchantment enchantment) {
|
||||
return new ContentItem.Enchantment(enchantment.key(), enchantment.level());
|
||||
}
|
||||
|
||||
private static ContentItem.Attribute attributeOf(ItemAttribute attribute) {
|
||||
return new ContentItem.Attribute(attribute.attribute(), attribute.name(), attribute.operation(), attribute.amount());
|
||||
}
|
||||
|
||||
private static ContentEntity entityOf(EntitySpec spec) {
|
||||
return new ContentEntity(spec.type(), spec.specialType(), spec.reason(), spec.customName(), flagsOf(spec.flags()),
|
||||
equipmentOf(spec.equipment()), spec.passengers().stream().map(ContentServices::entityOf).toList(),
|
||||
spec.attributes().stream().map(ContentServices::attributeOf).toList(), spec.lootTables(), spec.lootShuffleSeed(),
|
||||
spec.leashHolder() == null ? null : entityOf(spec.leashHolder()), spawnEffectOf(spec.spawnEffect()),
|
||||
spec.riseOutOfGround(), spec.pandaMainGene(), spec.pandaHiddenGene(), spec.applySettingsToSpecial(),
|
||||
spec.commands().stream().map(ContentServices::commandOf).toList());
|
||||
}
|
||||
|
||||
private static ContentEntity.Flags flagsOf(EntitySpec.Flags flags) {
|
||||
return new ContentEntity.Flags(flags.customNameVisible(), flags.aware(), flags.ai(), flags.glowing(), flags.gravity(),
|
||||
flags.invulnerable(), flags.silent(), flags.pickupItems(), flags.removable(), flags.keepEntity(), flags.baby());
|
||||
}
|
||||
|
||||
private static ContentEntity.Equipment equipmentOf(EntitySpec.Equipment equipment) {
|
||||
return new ContentEntity.Equipment(optionalItem(equipment.helmet()), optionalItem(equipment.chestplate()),
|
||||
optionalItem(equipment.leggings()), optionalItem(equipment.boots()), optionalItem(equipment.mainHand()),
|
||||
optionalItem(equipment.offHand()));
|
||||
}
|
||||
|
||||
private static ContentItem optionalItem(ItemDrop drop) {
|
||||
return drop == null ? null : itemOf(drop);
|
||||
}
|
||||
|
||||
private static ContentEntity.SpawnEffect spawnEffectOf(EntitySpec.SpawnEffect effect) {
|
||||
if (effect == null) {
|
||||
return null;
|
||||
}
|
||||
return new ContentEntity.SpawnEffect(effect.sound(), effect.soundDistance(), effect.minPitch(), effect.maxPitch(),
|
||||
effect.volume(), effect.particle(), effect.particleOffset(), effect.particleCount(), effect.altX(), effect.altY(),
|
||||
effect.altZ(), effect.randomAltX(), effect.randomAltY(), effect.randomAltZ(), effect.extra());
|
||||
}
|
||||
|
||||
private static ContentEntity.Command commandOf(EntitySpec.Command command) {
|
||||
return new ContentEntity.Command(command.commands(), command.delay(), command.repeat(), command.repeatDelay());
|
||||
}
|
||||
|
||||
private static ContentEffect effectOf(AmbientEffects.Effect effect) {
|
||||
return new ContentEffect(soundOf(effect.sound()), particlesOf(effect.particles()),
|
||||
effect.commands().stream().map(command -> new ContentEffect.Command(commandOf(command.command()),
|
||||
command.offsetX(), command.offsetY(), command.offsetZ())).toList(),
|
||||
effect.potion() == null ? null : new ContentEffect.Potion(effect.potion().key(), effect.potion().strength(), effect.potion().ticks()));
|
||||
}
|
||||
|
||||
private static ContentEffect.Sound soundOf(AmbientEffects.Sound sound) {
|
||||
return sound == null ? null : new ContentEffect.Sound(sound.key(), sound.offsetX(), sound.offsetY(), sound.offsetZ(),
|
||||
sound.volume(), sound.pitch());
|
||||
}
|
||||
|
||||
private static ContentEffect.Particles particlesOf(AmbientEffects.Particles particles) {
|
||||
return particles == null ? null : new ContentEffect.Particles(particles.key(), particles.forward(), particles.sideways(),
|
||||
particles.jitterX(), particles.jitterZ(), particles.lift(), particles.count(), particles.altX(), particles.altY(),
|
||||
particles.altZ(), particles.extra());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.core.content;
|
||||
|
||||
import art.arcane.iris.core.modules.ModuleServices;
|
||||
import com.volmit.service.EntitySpawns;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** What the modules plan to spawn, in host terms. */
|
||||
public final class ContentSpawns {
|
||||
private ContentSpawns() {
|
||||
}
|
||||
|
||||
/** The ground or fluid an entity spawns on. */
|
||||
public enum Surface {
|
||||
LAND, ANIMAL, WATER, OVERWORLD, LAVA
|
||||
}
|
||||
|
||||
/**
|
||||
* One entity to spawn at a block, if the light there lies in the range (when {@link #restrictsLight()}) and, when
|
||||
* {@code checkSurface}, the block below suits the entity's surface and the space it needs is free.
|
||||
*
|
||||
* @param x world X
|
||||
* @param worldY world Y
|
||||
* @param z world Z
|
||||
* @param checkSurface whether to check the surface and the free space
|
||||
*/
|
||||
public record Attempt(int x, int worldY, int z, ContentEntity entity, Surface surface, int minLight, int maxLight,
|
||||
boolean checkSurface) {
|
||||
/** Whether the light level matters. */
|
||||
public boolean restrictsLight() {
|
||||
return minLight > 0 || maxLight < 15;
|
||||
}
|
||||
}
|
||||
|
||||
/** What a marker does: the keys of its spawners, whether it needs free space above it and whether it goes away when its block changes. */
|
||||
public record MarkerRule(List<String> spawners, boolean emptyAbove, boolean removeOnChange) {
|
||||
}
|
||||
|
||||
/** Entities to spawn, tried one after the other; tell the plan how many appeared, so the spawner's rate limits count them. */
|
||||
public static final class Plan {
|
||||
private final ModuleServices.PlannedSpawn planned;
|
||||
private final List<Attempt> attempts;
|
||||
|
||||
Plan(ModuleServices.PlannedSpawn planned, List<Attempt> attempts) {
|
||||
this.planned = planned;
|
||||
this.attempts = List.copyOf(attempts);
|
||||
}
|
||||
|
||||
public List<Attempt> attempts() {
|
||||
return attempts;
|
||||
}
|
||||
|
||||
/** Whether the marker that led here is used up and should be removed. */
|
||||
public boolean exhaustsMarker() {
|
||||
return planned.plan().exhaustsMarker();
|
||||
}
|
||||
|
||||
/** Reports how many of the planned entities appeared. */
|
||||
public void spawned(int count) {
|
||||
planned.spawned(count);
|
||||
}
|
||||
}
|
||||
|
||||
static Surface surfaceOf(EntitySpawns.Surface surface) {
|
||||
return Surface.valueOf(surface.name());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user