mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 16:25:36 +00:00
PlacementLoot takes the placement's lists, so its picks can be tested
This commit is contained in:
1 parent
df88a4a050
commit
697d21f8a4
2 files changed
+8
-7
No files matched your search
@@ -55,7 +55,7 @@ public final class LootGiving implements Loot {
|
||||
IrisObjectPlacement placement = site.container() == null ? null : placementAt(engine, x, relativeY, z);
|
||||
if (placement != null) {
|
||||
objectLootDefined = objectLootDefined || placement.getLoot().isNotEmpty() || placement.getVanillaLoot().isNotEmpty();
|
||||
Source picked = placementLoot(world, engine).pick(placement, platformState(site), rng, x, worldY, z);
|
||||
Source picked = placementLoot(world, engine).pick(placement.getVanillaLoot(), placement.getLoot(), platformState(site), rng, x, worldY, z);
|
||||
if (picked != null) {
|
||||
sources.add(picked);
|
||||
if (placement.isOverrideGlobalLoot()) {
|
||||
|
||||
@@ -21,7 +21,6 @@ package art.arcane.iris.engine.loot;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.engine.framework.LootResolver;
|
||||
import art.arcane.iris.engine.object.loot.IObjectLoot;
|
||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
@@ -61,13 +60,15 @@ final class PlacementLoot {
|
||||
}
|
||||
|
||||
/**
|
||||
* The table the placement gives {@code container}, a storage chest, at the spot {@code x}, {@code worldY},
|
||||
* {@code z}; null when it gives it none.
|
||||
* The table a placement, whose platform tables are {@code platformLoot} and whose pack tables are {@code packLoot},
|
||||
* gives {@code container}, a storage chest, at the spot {@code x}, {@code worldY}, {@code z}; null when it gives
|
||||
* it none.
|
||||
*/
|
||||
Loot.Source pick(IrisObjectPlacement placement, PlatformBlockState container, RNG rng, int x, int worldY, int z) {
|
||||
Loot.Source pick(List<? extends IObjectLoot> platformLoot, List<? extends IObjectLoot> packLoot, PlatformBlockState container,
|
||||
RNG rng, int x, int worldY, int z) {
|
||||
Candidates candidates = new Candidates(container);
|
||||
add(candidates, placement.getVanillaLoot(), name -> platformSource(name, x, worldY, z));
|
||||
add(candidates, placement.getLoot(), this::packSource);
|
||||
add(candidates, platformLoot, name -> platformSource(name, x, worldY, z));
|
||||
add(candidates, packLoot, this::packSource);
|
||||
List<Candidate> pool = candidates.pool();
|
||||
Candidate picked = LootResolver.pickWeighted(pool, Candidate::weight, rng);
|
||||
return picked == null ? null : picked.source();
|
||||
|
||||
Reference in new issue
Block a user