mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 16:36:00 +00:00
add fallback loot mode
This commit is contained in:
parent
fb59c7370d
commit
cb6e4570f4
@ -468,7 +468,10 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void injectTables(KList<IrisLootTable> list, IrisLootReference r) {
|
default void injectTables(KList<IrisLootTable> list, IrisLootReference r, boolean fallback) {
|
||||||
|
if (r.getMode().equals(IrisLootMode.FALLBACK) && !fallback)
|
||||||
|
return;
|
||||||
|
|
||||||
if (r.getMode().equals(IrisLootMode.CLEAR) || r.getMode().equals(IrisLootMode.REPLACE)) {
|
if (r.getMode().equals(IrisLootMode.CLEAR) || r.getMode().equals(IrisLootMode.REPLACE)) {
|
||||||
list.clear();
|
list.clear();
|
||||||
}
|
}
|
||||||
@ -503,10 +506,11 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
IrisBiome biomeUnder = ry < he ? getComplex().getCaveBiomeStream().get(rx, rz) : biomeSurface;
|
IrisBiome biomeUnder = ry < he ? getComplex().getCaveBiomeStream().get(rx, rz) : biomeSurface;
|
||||||
|
|
||||||
double multiplier = 1D * getDimension().getLoot().getMultiplier() * region.getLoot().getMultiplier() * biomeSurface.getLoot().getMultiplier() * biomeUnder.getLoot().getMultiplier();
|
double multiplier = 1D * getDimension().getLoot().getMultiplier() * region.getLoot().getMultiplier() * biomeSurface.getLoot().getMultiplier() * biomeUnder.getLoot().getMultiplier();
|
||||||
injectTables(tables, getDimension().getLoot());
|
boolean fallback = tables.isEmpty();
|
||||||
injectTables(tables, region.getLoot());
|
injectTables(tables, getDimension().getLoot(), fallback);
|
||||||
injectTables(tables, biomeSurface.getLoot());
|
injectTables(tables, region.getLoot(), fallback);
|
||||||
injectTables(tables, biomeUnder.getLoot());
|
injectTables(tables, biomeSurface.getLoot(), fallback);
|
||||||
|
injectTables(tables, biomeUnder.getLoot(), fallback);
|
||||||
|
|
||||||
if (tables.isNotEmpty()) {
|
if (tables.isNotEmpty()) {
|
||||||
int target = (int) Math.round(tables.size() * multiplier);
|
int target = (int) Math.round(tables.size() * multiplier);
|
||||||
|
@ -30,7 +30,7 @@ import org.bukkit.inventory.Inventory;
|
|||||||
public interface LootProvider {
|
public interface LootProvider {
|
||||||
void scramble(Inventory inventory, RNG rng);
|
void scramble(Inventory inventory, RNG rng);
|
||||||
|
|
||||||
void injectTables(KList<IrisLootTable> list, IrisLootReference r);
|
void injectTables(KList<IrisLootTable> list, IrisLootReference r, boolean fallback);
|
||||||
|
|
||||||
KList<IrisLootTable> getLootTables(RNG rng, Block b);
|
KList<IrisLootTable> getLootTables(RNG rng, Block b);
|
||||||
|
|
||||||
|
@ -27,5 +27,7 @@ public enum IrisLootMode {
|
|||||||
@Desc("Clear all loot tables then add this table")
|
@Desc("Clear all loot tables then add this table")
|
||||||
CLEAR,
|
CLEAR,
|
||||||
@Desc("Replace all loot tables with this table (same as clear)")
|
@Desc("Replace all loot tables with this table (same as clear)")
|
||||||
REPLACE
|
REPLACE,
|
||||||
|
@Desc("Only use when there was no loot table defined by an object")
|
||||||
|
FALLBACK
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user