mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 08:44:50 +00:00
ObjectLoot, ObjectVanillaLoot and PlacementMarker: the loot and marker lists of an object placement as module-owned types of IrisApi annotations and BlockSpec
This commit is contained in:
1 parent
d18972048c
commit
4f852f9c47
11 files changed
+291
-252
No files matched your search
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.ResourceRef;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Snippet("object-loot")
|
||||
@Desc("Represents loot within this object")
|
||||
public final class ObjectLoot implements ObjectLootEntry {
|
||||
@MinItems(1)
|
||||
@Desc("The list of blocks this loot table should apply to")
|
||||
private List<BlockSpec> filter = List.of();
|
||||
@Desc("Exactly match the block data or not")
|
||||
private boolean exact = false;
|
||||
@Desc("The loot table name")
|
||||
@Required
|
||||
@ResourceRef(LootTable.class)
|
||||
private String name;
|
||||
@Desc("The weight of this loot table being chosen")
|
||||
@MinNumber(1)
|
||||
private int weight = 1;
|
||||
|
||||
public ObjectLoot() {
|
||||
}
|
||||
|
||||
/** A table for every container of the placement. */
|
||||
public ObjectLoot(String name, int weight) {
|
||||
this.name = name;
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int weight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exact() {
|
||||
return exact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockSpec> filter() {
|
||||
return filter == null ? List.of() : Collections.unmodifiableList(filter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* One loot table an object placement gives its containers: which table, how often it is picked among the placement's
|
||||
* tables, and which of the object's containers it is for.
|
||||
*/
|
||||
public interface ObjectLootEntry {
|
||||
/** The table: a key of the pack's loot tables, or a key of the platform's. */
|
||||
String name();
|
||||
|
||||
/** How often the table is picked among equals; a table with no weight is never picked. */
|
||||
int weight();
|
||||
|
||||
/** Whether the table applies to the exact state of the blocks in {@link #filter}, not to every state of their kind of block. */
|
||||
boolean exact();
|
||||
|
||||
/** The blocks the table is for; none means every container the placement holds. */
|
||||
List<BlockSpec> filter();
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Snippet("object-vanilla-loot")
|
||||
@Desc("Represents vanilla loot within this object")
|
||||
public final class ObjectVanillaLoot implements ObjectLootEntry {
|
||||
@MinItems(1)
|
||||
@Desc("The list of blocks this loot table should apply to")
|
||||
private List<BlockSpec> filter = List.of();
|
||||
@Desc("Exactly match the block data or not")
|
||||
private boolean exact = false;
|
||||
@Desc("The vanilla loot table key")
|
||||
@Required
|
||||
@Ref(Reference.LOOT_TABLE)
|
||||
private String name;
|
||||
@Desc("The weight of this loot table being chosen")
|
||||
@MinNumber(1)
|
||||
private int weight = 1;
|
||||
|
||||
public ObjectVanillaLoot() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int weight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exact() {
|
||||
return exact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockSpec> filter() {
|
||||
return filter == null ? List.of() : Collections.unmodifiableList(filter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.ResourceRef;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** Blocks of an object placement that get a {@link SpawnMarker}, an entry of the placement's {@code markers}. */
|
||||
@Snippet("object-marker")
|
||||
@Desc("Find blocks to mark")
|
||||
public final class PlacementMarker {
|
||||
@MinItems(1)
|
||||
@Required
|
||||
@Desc("Find block types to mark")
|
||||
private List<BlockSpec> mark = List.of();
|
||||
@MinNumber(1)
|
||||
@MaxNumber(16)
|
||||
@Desc("The maximum amount of markers to place. Use these sparingly!")
|
||||
private int maximumMarkers = 8;
|
||||
@Desc("If true, markers will only be placed if the block matches the mark list perfectly.")
|
||||
private boolean exact = false;
|
||||
@Required
|
||||
@ResourceRef(SpawnMarker.class)
|
||||
@Desc("The marker to add")
|
||||
private String marker;
|
||||
|
||||
public PlacementMarker() {
|
||||
}
|
||||
|
||||
/** The blocks that get a marker. */
|
||||
public List<BlockSpec> mark() {
|
||||
return mark == null ? List.of() : Collections.unmodifiableList(mark);
|
||||
}
|
||||
|
||||
public int maximumMarkers() {
|
||||
return maximumMarkers;
|
||||
}
|
||||
|
||||
public boolean exact() {
|
||||
return exact;
|
||||
}
|
||||
|
||||
/** The key of the {@link SpawnMarker} to place. */
|
||||
public String marker() {
|
||||
return marker;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package art.arcane.iris.engine.object.loot;
|
||||
|
||||
import art.arcane.iris.engine.object.material.IrisBlockData;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
|
||||
public interface IObjectLoot {
|
||||
KList<IrisBlockData> getFilter();
|
||||
KList<PlatformBlockState> getFilter(IrisData manager);
|
||||
boolean isExact();
|
||||
String getName();
|
||||
int getWeight();
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 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.engine.object.loot;
|
||||
|
||||
import art.arcane.iris.builtin.loot.LootTable;
|
||||
import art.arcane.iris.engine.object.material.IrisBlockData;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.object.annotations.ArrayType;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.iris.engine.object.annotations.RegistryListResource;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.iris.util.common.data.B;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("object-loot")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents loot within this object")
|
||||
@Data
|
||||
public class IrisObjectLoot implements IObjectLoot {
|
||||
private final transient AtomicCache<KList<PlatformBlockState>> filterCache = new AtomicCache<>();
|
||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||
@Desc("The list of blocks this loot table should apply to")
|
||||
private KList<IrisBlockData> filter = new KList<>();
|
||||
@Desc("Exactly match the block data or not")
|
||||
private boolean exact = false;
|
||||
@Desc("The loot table name")
|
||||
@Required
|
||||
@RegistryListResource(LootTable.class)
|
||||
private String name;
|
||||
@Desc("The weight of this loot table being chosen")
|
||||
@MinNumber(1)
|
||||
private int weight = 1;
|
||||
|
||||
public KList<PlatformBlockState> getFilter(IrisData rdata) {
|
||||
return filterCache.aquire(() ->
|
||||
{
|
||||
KList<PlatformBlockState> b = new KList<>();
|
||||
|
||||
for (IrisBlockData i : filter) {
|
||||
PlatformBlockState bx = i.getBlockData(rdata);
|
||||
|
||||
if (bx != null) {
|
||||
b.add(bx);
|
||||
}
|
||||
}
|
||||
|
||||
return b;
|
||||
});
|
||||
}
|
||||
|
||||
public boolean matchesFilter(IrisData manager, PlatformBlockState data) {
|
||||
for (PlatformBlockState filterState : getFilter(manager)) {
|
||||
if (B.matches(filterState, data)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package art.arcane.iris.engine.object.loot;
|
||||
|
||||
import art.arcane.iris.engine.object.material.IrisBlockData;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.object.annotations.ArrayType;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.iris.engine.object.annotations.RegistryListFunction;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.iris.engine.object.annotations.functions.LootTableKeyFunction;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("object-vanilla-loot")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents vanilla loot within this object")
|
||||
@Data
|
||||
public class IrisObjectVanillaLoot implements IObjectLoot {
|
||||
private final transient AtomicCache<KList<PlatformBlockState>> filterCache = new AtomicCache<>();
|
||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||
@Desc("The list of blocks this loot table should apply to")
|
||||
private KList<IrisBlockData> filter = new KList<>();
|
||||
@Desc("Exactly match the block data or not")
|
||||
private boolean exact = false;
|
||||
@Desc("The vanilla loot table key")
|
||||
@Required
|
||||
@RegistryListFunction(LootTableKeyFunction.class)
|
||||
private String name;
|
||||
@Desc("The weight of this loot table being chosen")
|
||||
@MinNumber(1)
|
||||
private int weight = 1;
|
||||
|
||||
public KList<PlatformBlockState> getFilter(IrisData rdata) {
|
||||
return filterCache.aquire(() ->
|
||||
{
|
||||
KList<PlatformBlockState> b = new KList<>();
|
||||
|
||||
for (IrisBlockData i : filter) {
|
||||
PlatformBlockState bx = i.getBlockData(rdata);
|
||||
|
||||
if (bx != null) {
|
||||
b.add(bx);
|
||||
}
|
||||
}
|
||||
|
||||
return b;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 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.engine.object.marker;
|
||||
|
||||
import art.arcane.iris.builtin.spawn.SpawnMarker;
|
||||
import art.arcane.iris.engine.object.material.IrisBlockData;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.object.annotations.ArrayType;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MaxNumber;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.iris.engine.object.annotations.RegistryListResource;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("object-marker")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Find blocks to mark")
|
||||
@Data
|
||||
public class IrisObjectMarker {
|
||||
private final transient AtomicCache<KList<PlatformBlockState>> findData = new AtomicCache<>();
|
||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||
@Required
|
||||
@Desc("Find block types to mark")
|
||||
private KList<IrisBlockData> mark = new KList<>();
|
||||
@MinNumber(1)
|
||||
@MaxNumber(16)
|
||||
@Desc("The maximum amount of markers to place. Use these sparingly!")
|
||||
private int maximumMarkers = 8;
|
||||
@Desc("If true, markers will only be placed if the block matches the mark list perfectly.")
|
||||
private boolean exact = false;
|
||||
@Required
|
||||
@RegistryListResource(SpawnMarker.class)
|
||||
@Desc("The marker to add")
|
||||
private String marker;
|
||||
|
||||
public KList<PlatformBlockState> getMark(IrisData rdata) {
|
||||
return findData.aquire(() ->
|
||||
{
|
||||
KList<PlatformBlockState> b = new KList<>();
|
||||
|
||||
for (IrisBlockData i : mark) {
|
||||
PlatformBlockState bx = i.getBlockData(rdata);
|
||||
|
||||
if (bx != null) {
|
||||
b.add(bx);
|
||||
}
|
||||
}
|
||||
|
||||
return b;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,8 @@ import art.arcane.iris.builtin.blocks.ObjectMarkers;
|
||||
import art.arcane.iris.builtin.blocks.WrittenBlocks;
|
||||
import art.arcane.iris.core.modules.BlockEntities;
|
||||
import art.arcane.iris.core.modules.IrisPlacement;
|
||||
import art.arcane.iris.builtin.spawn.PlacementMarker;
|
||||
import art.arcane.iris.builtin.spawn.SpawnMarker;
|
||||
import art.arcane.iris.engine.object.marker.IrisObjectMarker;
|
||||
import art.arcane.iris.engine.object.prefab.IrisObject;
|
||||
import art.arcane.iris.engine.object.prefab.IrisObjectShaping;
|
||||
import art.arcane.iris.engine.object.prefab.TileData;
|
||||
@@ -39,6 +39,8 @@ import art.arcane.iris.util.common.data.B;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.ModuleInfo;
|
||||
import com.volmit.object.ObjectBlock;
|
||||
import com.volmit.placement.PlacedBlock;
|
||||
@@ -204,27 +206,36 @@ public final class BlocksModule implements IrisModule {
|
||||
PlacementWorld world = new PlacementWorld(context.access(), placement.states());
|
||||
RNG markerRandom = new RNG(context.random().nextLong());
|
||||
int salt = 0;
|
||||
for (IrisObjectMarker markerConfig : config.getMarkers()) {
|
||||
SpawnMarker marker = SpawnResources.marker(placement.object().getLoader(), markerConfig.getMarker());
|
||||
for (PlacementMarker markerConfig : config.getMarkers()) {
|
||||
SpawnMarker marker = SpawnResources.marker(placement.data().getPackResources(), markerConfig.marker());
|
||||
int markerSalt = salt++;
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
KList<BlockPosition> candidates = candidates(written, markerConfig, markerConfig.getMark(placement.data()), placement);
|
||||
int remaining = markerConfig.getMaximumMarkers();
|
||||
KList<BlockPosition> candidates = candidates(written, markerConfig, markTargets(markerConfig, placement), placement);
|
||||
int remaining = markerConfig.maximumMarkers();
|
||||
for (BlockPosition position : candidates.shuffleCopy(markerRandom.nextParallelRNG(markerSalt))) {
|
||||
if (remaining <= 0) {
|
||||
break;
|
||||
}
|
||||
if (!marker.emptyAbove() || hasAirAbove(world, position)) {
|
||||
context.access().marker(ObjectMarkers.of(position, markerConfig.getMarker()));
|
||||
context.access().marker(ObjectMarkers.of(position, markerConfig.marker()));
|
||||
remaining--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static KList<BlockPosition> candidates(WrittenBlocks written, IrisObjectMarker markerConfig,
|
||||
private static KList<PlatformBlockState> markTargets(PlacementMarker markerConfig, IrisPlacement placement) {
|
||||
KList<PlatformBlockState> targets = new KList<>();
|
||||
for (BlockSpec spec : markerConfig.mark()) {
|
||||
BlockState state = placement.data().getPackResources().blocks().resolve(spec);
|
||||
targets.add(placement.states().toPlatform(state));
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
|
||||
private static KList<BlockPosition> candidates(WrittenBlocks written, PlacementMarker markerConfig,
|
||||
KList<PlatformBlockState> targets, IrisPlacement placement) {
|
||||
KList<BlockPosition> candidates = new KList<>();
|
||||
for (PlacedBlock block : written.blocks()) {
|
||||
@@ -236,8 +247,8 @@ public final class BlocksModule implements IrisModule {
|
||||
return candidates;
|
||||
}
|
||||
|
||||
private static boolean marks(IrisObjectMarker markerConfig, PlatformBlockState target, PlatformBlockState state) {
|
||||
return markerConfig.isExact()
|
||||
private static boolean marks(PlacementMarker markerConfig, PlatformBlockState target, PlatformBlockState state) {
|
||||
return markerConfig.exact()
|
||||
? target.matches(state)
|
||||
: IrisObjectShaping.materialKey(target).equals(IrisObjectShaping.materialKey(state));
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ import art.arcane.iris.builtin.prepare.SlopeClip;
|
||||
import art.arcane.iris.builtin.vacuum.VacuumSettings;
|
||||
import art.arcane.iris.builtin.validate.ObjectLimit;
|
||||
import art.arcane.iris.core.modules.ModuleSettings;
|
||||
import art.arcane.iris.engine.object.loot.IrisObjectLoot;
|
||||
import art.arcane.iris.engine.object.loot.IrisObjectVanillaLoot;
|
||||
import art.arcane.iris.engine.object.marker.IrisObjectMarker;
|
||||
import art.arcane.iris.builtin.loot.ObjectLoot;
|
||||
import art.arcane.iris.builtin.loot.ObjectVanillaLoot;
|
||||
import art.arcane.iris.builtin.spawn.PlacementMarker;
|
||||
import art.arcane.iris.engine.object.noise.IrisGeneratorStyle;
|
||||
import art.arcane.iris.engine.object.noise.IrisNoiseGenerator;
|
||||
import art.arcane.iris.engine.object.noise.IrisStyledRange;
|
||||
@@ -117,9 +117,9 @@ public class IrisObjectPlacement {
|
||||
@MinNumber(0)
|
||||
@Desc("When bore is enabled, expand max-y of the cuboid it removes")
|
||||
private int boreExtendMaxY = 0;
|
||||
@ArrayType(min = 1, type = IrisObjectMarker.class)
|
||||
@ArrayType(min = 1, type = PlacementMarker.class)
|
||||
@Desc("Add markers to blocks in this object")
|
||||
private KList<IrisObjectMarker> markers = new KList<>();
|
||||
private KList<PlacementMarker> markers = new KList<>();
|
||||
@MaxNumber(64)
|
||||
@MinNumber(-1)
|
||||
@Desc("When bore is enabled, lower min-y of the cuboid it removes")
|
||||
@@ -167,12 +167,12 @@ public class IrisObjectPlacement {
|
||||
private IrisObjectTranslate translate = new IrisObjectTranslate();
|
||||
@Desc("Scale Objects")
|
||||
private IrisObjectScale scale = new IrisObjectScale();
|
||||
@ArrayType(min = 1, type = IrisObjectLoot.class)
|
||||
@ArrayType(min = 1, type = ObjectLoot.class)
|
||||
@Desc("The loot tables to apply to these objects")
|
||||
private KList<IrisObjectLoot> loot = new KList<>();
|
||||
@ArrayType(min = 1, type = IrisObjectVanillaLoot.class)
|
||||
private KList<ObjectLoot> loot = new KList<>();
|
||||
@ArrayType(min = 1, type = ObjectVanillaLoot.class)
|
||||
@Desc("The vanilla loot tables to apply to these objects")
|
||||
private KList<IrisObjectVanillaLoot> vanillaLoot = new KList<>();
|
||||
private KList<ObjectVanillaLoot> vanillaLoot = new KList<>();
|
||||
@Desc("Whether the given loot tables override any and all other loot tables available in the dimension, region or biome.")
|
||||
private boolean overrideGlobalLoot = false;
|
||||
@Desc("This object / these objects override the following trees when they grow...")
|
||||
|
||||
@@ -22,7 +22,7 @@ import art.arcane.iris.builtin.anchor.PlaceTrait;
|
||||
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
|
||||
import art.arcane.iris.builtin.blocks.ObjectReplace;
|
||||
import art.arcane.iris.builtin.loot.LootTable;
|
||||
import art.arcane.iris.engine.object.loot.IrisObjectLoot;
|
||||
import art.arcane.iris.builtin.loot.ObjectLoot;
|
||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||
import art.arcane.iris.engine.object.structure.jigsaw.IrisJigsawBranchFailurePolicy;
|
||||
import art.arcane.iris.engine.object.structure.jigsaw.IrisJigsawCompatibility;
|
||||
@@ -138,7 +138,7 @@ public class IrisStructure extends IrisRegistrant {
|
||||
}
|
||||
for (String lootTable : loot) {
|
||||
if (lootTable != null && !lootTable.isBlank()) {
|
||||
placement.getLoot().add(new IrisObjectLoot().setName(lootTable).setWeight(1));
|
||||
placement.getLoot().add(new ObjectLoot(lootTable, 1));
|
||||
}
|
||||
}
|
||||
return placement;
|
||||
|
||||
Reference in new issue
Block a user