9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-29 20:19:06 +00:00

Fixed Loot tables acting like a cucumber in the sun

- Fixed loot chests containing the exact same loot
- Fixed chests having nothing if a roll fails
- Fixed rolls always being done in the same order
- Added method to BlockPosition to get a unique long from 3 integers (x, y z)
This commit is contained in:
StrangeOne101
2021-07-05 04:24:13 +12:00
parent 3aa085f17e
commit 5103d91db0
6 changed files with 52 additions and 30 deletions

View File

@@ -1,5 +1,6 @@
package com.volmit.iris.scaffold.engine;
import com.volmit.iris.Iris;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.manager.gui.Renderer;
import com.volmit.iris.object.*;
@@ -210,7 +211,7 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
if(B.isStorage(data))
{
RNG rx = rf.nextParallelRNG(x).nextParallelRNG(z).nextParallelRNG(y);
RNG rx = rf.nextParallelRNG(BlockPosition.toLong(x, y, z));
InventorySlotType slot = null;
if(B.isStorageChest(data))
@@ -220,7 +221,7 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
if(slot != null)
{
KList<IrisLootTable> tables = getLootTables(rx.nextParallelRNG(4568111), block);
KList<IrisLootTable> tables = getLootTables(rx, block);
InventorySlotType slott = slot;
try
@@ -350,7 +351,7 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
for(IrisLootTable i : tables)
{
b++;
items.addAll(i.getLoot(debug, items.isEmpty(), rng.nextParallelRNG(345911), slot, x, y, z, b + b, mgf + b));
items.addAll(i.getLoot(debug, items.isEmpty(), rng, slot, x, y, z, b + b, mgf + b));
}
for(ItemStack i : items)

View File

@@ -9,6 +9,7 @@ import com.volmit.iris.scaffold.IrisWorlds;
import com.volmit.iris.scaffold.engine.Engine;
import com.volmit.iris.scaffold.engine.IrisAccess;
import com.volmit.iris.util.AxisAlignedBB;
import com.volmit.iris.util.BlockPosition;
import com.volmit.iris.util.IObjectPlacer;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.RNG;
@@ -148,6 +149,7 @@ public class PlannedPiece {
getPiece().getPlacementOptions().getRotation().setEnabled(false);
int finalMinY = minY;
RNG rng = getStructure().getRng().nextParallelRNG(37555);
getObject().place(position.getX()+getObject().getCenter().getBlockX(), position.getY()+getObject().getCenter().getBlockY(), position.getZ()+getObject().getCenter().getBlockZ(), new IObjectPlacer() {
@Override
public int getHighest(int x, int z) {
@@ -174,7 +176,8 @@ public class PlannedPiece {
IrisLootTable table = getPiece().getPlacementOptions().getTable(block.getBlockData(), getData());
if (table == null) return;
Engine engine = a.getCompound().getEngineForHeight(y);
engine.addItems(false, ((InventoryHolder) block.getState()).getInventory(), getStructure().getRng(),
engine.addItems(false, ((InventoryHolder) block.getState()).getInventory(),
rng.nextParallelRNG(BlockPosition.toLong(x, y, z)),
new KList<>(table), InventorySlotType.STORAGE, x, y, z, 15);
}
}
@@ -215,6 +218,6 @@ public class PlannedPiece {
tile.toBukkitTry(state);
state.update();
}
}, piece.getPlacementOptions(), getStructure().getRng(), getData());
}, piece.getPlacementOptions(), rng, getData());
}
}