mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Fix dust
This commit is contained in:
parent
831143427d
commit
059ff25d8e
@ -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<BlockPosition> hits) {
|
||||
this.parallax = parallax;
|
||||
public DustRevealer(Engine engine, World world, BlockPosition block, String key, KList<BlockPosition> 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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user