This commit is contained in:
Julian Krings
2024-10-04 15:03:09 +02:00
parent a61787ecfe
commit 457b691add
5 changed files with 13 additions and 5 deletions
@@ -306,7 +306,7 @@ public class CommandStudio implements DecreeExecutor {
Inventory inv = Bukkit.createInventory(null, 27 * 2); Inventory inv = Bukkit.createInventory(null, 27 * 2);
try { try {
engine().addItems(true, inv, RNG.r, tables, InventorySlotType.STORAGE, player().getLocation().getBlockX(), player().getLocation().getBlockY(), player().getLocation().getBlockZ(), 1); engine().addItems(true, inv, RNG.r, tables, InventorySlotType.STORAGE, player().getWorld(), player().getLocation().getBlockX(), player().getLocation().getBlockY(), player().getLocation().getBlockZ(), 1);
} catch (Throwable e) { } catch (Throwable e) {
Iris.reportError(e); Iris.reportError(e);
sender().sendMessage(C.RED + "Cannot add items to virtual inventory because of: " + e.getMessage()); sender().sendMessage(C.RED + "Cannot add items to virtual inventory because of: " + e.getMessage());
@@ -329,7 +329,7 @@ public class CommandStudio implements DecreeExecutor {
inv.clear(); inv.clear();
} }
engine().addItems(true, inv, new RNG(RNG.r.imax()), tables, InventorySlotType.STORAGE, player().getLocation().getBlockX(), player().getLocation().getBlockY(), player().getLocation().getBlockZ(), 1); engine().addItems(true, inv, new RNG(RNG.r.imax()), tables, InventorySlotType.STORAGE, player().getWorld(), player().getLocation().getBlockX(), player().getLocation().getBlockY(), player().getLocation().getBlockZ(), 1);
}, 0, fast ? 5 : 35)); }, 0, fast ? 5 : 35));
sender().sendMessage(C.GREEN + "Opening inventory now!"); sender().sendMessage(C.GREEN + "Opening inventory now!");
@@ -19,6 +19,7 @@
package com.volmit.iris.core.nms.v1X; package com.volmit.iris.core.nms.v1X;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.nms.IMemoryWorld;
import com.volmit.iris.core.nms.INMSBinding; import com.volmit.iris.core.nms.INMSBinding;
import com.volmit.iris.core.nms.container.BiomeColor; import com.volmit.iris.core.nms.container.BiomeColor;
import com.volmit.iris.core.nms.container.BlockPos; import com.volmit.iris.core.nms.container.BlockPos;
@@ -42,6 +43,7 @@ import org.bukkit.inventory.ItemStack;
import java.awt.*; import java.awt.*;
import java.awt.Color; import java.awt.Color;
import java.io.IOException;
public class NMSBinding1X implements INMSBinding { public class NMSBinding1X implements INMSBinding {
private static final boolean supportsCustomHeight = testCustomHeight(); private static final boolean supportsCustomHeight = testCustomHeight();
@@ -120,6 +122,11 @@ public class NMSBinding1X implements INMSBinding {
return new KList<>(list); return new KList<>(list);
} }
@Override
public IMemoryWorld createMemoryWorld(NamespacedKey levelType, WorldCreator creator) throws IOException {
throw new IOException("Unsupported version!");
}
@Override @Override
public CompoundTag serializeEntity(Entity location) { public CompoundTag serializeEntity(Entity location) {
return null; return null;
@@ -386,7 +386,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
if (tables.isEmpty()) if (tables.isEmpty())
return; return;
InventoryHolder m = (InventoryHolder) block.getState(); InventoryHolder m = (InventoryHolder) block.getState();
addItems(false, m.getInventory(), rx, tables, slot, x, y, z, 15); addItems(false, m.getInventory(), rx, tables, slot, c.getWorld(), x, y, z, 15);
} catch (Throwable e) { } catch (Throwable e) {
Iris.reportError(e); Iris.reportError(e);
@@ -23,6 +23,7 @@ import com.volmit.iris.engine.object.IrisLootReference;
import com.volmit.iris.engine.object.IrisLootTable; import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.math.RNG; import com.volmit.iris.util.math.RNG;
import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
@@ -33,5 +34,5 @@ public interface LootProvider {
KList<IrisLootTable> getLootTables(RNG rng, Block b); KList<IrisLootTable> getLootTables(RNG rng, Block b);
void addItems(boolean debug, Inventory inv, RNG rng, KList<IrisLootTable> tables, InventorySlotType slot, int x, int y, int z, int mgf); void addItems(boolean debug, Inventory inv, RNG rng, KList<IrisLootTable> tables, InventorySlotType slot, World world, int x, int y, int z, int mgf);
} }
@@ -77,7 +77,7 @@ public class WorldObjectPlacer implements IObjectPlacer {
if (tables.isEmpty()) if (tables.isEmpty())
return; return;
InventoryHolder m = (InventoryHolder) block.getState(); InventoryHolder m = (InventoryHolder) block.getState();
engine.addItems(false, m.getInventory(), rx, tables, slot, x, y, z, 15); engine.addItems(false, m.getInventory(), rx, tables, slot, world, x, y, z, 15);
} catch (Throwable e) { } catch (Throwable e) {
Iris.reportError(e); Iris.reportError(e);
} }