diff --git a/src/main/java/com/volmit/iris/core/edit/DustRevealer.java b/src/main/java/com/volmit/iris/core/edit/DustRevealer.java index 1f7fda4e6..58c226c6d 100644 --- a/src/main/java/com/volmit/iris/core/edit/DustRevealer.java +++ b/src/main/java/com/volmit/iris/core/edit/DustRevealer.java @@ -21,7 +21,9 @@ package com.volmit.iris.core.edit; import com.volmit.iris.Iris; import com.volmit.iris.core.tools.IrisToolbelt; import com.volmit.iris.engine.framework.Engine; -import com.volmit.iris.engine.parallax.ParallaxAccess; +import com.volmit.iris.engine.framework.PlacedObject; +import com.volmit.iris.engine.mantle.EngineMantle; +import com.volmit.iris.engine.object.objects.IrisObjectPlacement; import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.math.BlockPosition; import com.volmit.iris.util.math.RNG; @@ -34,7 +36,7 @@ import org.bukkit.block.Block; @SuppressWarnings("ALL") @Data public class DustRevealer { - private final ParallaxAccess parallax; + private final Engine engine; private final World world; private final BlockPosition block; private final String key; @@ -45,20 +47,19 @@ public class DustRevealer { Engine access = IrisToolbelt.access(world).getEngine(); if (access != null) { - ParallaxAccess a = access.getParallaxAccess(); + String a = access.getObjectPlacementKey(block.getX(), block.getY(), block.getZ()); - if (a.getObject(block.getX(), block.getY(), block.getZ()) != null) { - sender.sendMessage("Found object " + a.getObject(block.getX(), block.getY(), block.getZ())); - Iris.info(sender.getName() + " found object " + a.getObject(block.getX(), block.getY(), block.getZ())); + if (a != null) { + sender.sendMessage("Found object " + a); J.a(() -> { - new DustRevealer(a, world, new BlockPosition(block.getX(), block.getY(), block.getZ()), a.getObject(block.getX(), block.getY(), block.getZ()), new KList<>()); + new DustRevealer(access, world, new BlockPosition(block.getX(), block.getY(), block.getZ()), a, new KList<>()); }); } } } - public DustRevealer(ParallaxAccess parallax, World world, BlockPosition block, String key, KList hits) { - this.parallax = parallax; + public DustRevealer(Engine engine, World world, BlockPosition block, String key, KList hits) { + this.engine = engine; this.world = world; this.block = block; this.key = key; @@ -103,9 +104,9 @@ public class DustRevealer { } private boolean is(BlockPosition a) { - if (isValidTry(a) && parallax.getObject(a.getX(), a.getY(), a.getZ()) != null && parallax.getObject(a.getX(), a.getY(), a.getZ()).equals(key)) { + if (isValidTry(a) && engine.getObjectPlacementKey(a.getX(), a.getY(), a.getZ()) != null && engine.getObjectPlacementKey(a.getX(), a.getY(), a.getZ()).equals(key)) { hits.add(a); - new DustRevealer(parallax, world, a, key, hits); + new DustRevealer(engine, world, a, key, hits); return true; } diff --git a/src/main/java/com/volmit/iris/engine/framework/Engine.java b/src/main/java/com/volmit/iris/engine/framework/Engine.java index d4521f51a..78aa8134e 100644 --- a/src/main/java/com/volmit/iris/engine/framework/Engine.java +++ b/src/main/java/com/volmit/iris/engine/framework/Engine.java @@ -633,6 +633,18 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat return getSurfaceBiome(x, z); } + default String getObjectPlacementKey(int x, int y, int z) + { + PlacedObject o = getObjectPlacement(x,y,z); + + if(o != null && o.getObject() != null) + { + return o.getObject().getLoadKey() + "@" + o.getId(); + } + + return null; + } + default PlacedObject getObjectPlacement(int x, int y, int z) { String objectAt = getMantle().getMantle().get(x,y,z, String.class);