Fixed Dust of Revealing Pt.1

This commit is contained in:
Vatuu 2022-05-16 17:33:15 +02:00
parent 44c707e059
commit ccc2ed0806
No known key found for this signature in database
GPG Key ID: C6F07B79B2ED9150
7 changed files with 26 additions and 8 deletions

View File

@ -99,7 +99,6 @@ public class DustRevealer {
if(access != null) {
String a = access.getObjectPlacementKey(block.getX(), block.getY(), block.getZ());
if(a != null) {
world.playSound(block.getLocation(), Sound.ITEM_LODESTONE_COMPASS_LOCK, 1f, 0.1f);

View File

@ -408,7 +408,6 @@ public class WandSVC implements IrisService {
e.setCancelled(true);
e.getPlayer().playSound(Objects.requireNonNull(e.getClickedBlock()).getLocation(), Sound.ENTITY_ENDER_EYE_DEATH, 2f, 1.97f);
DustRevealer.spawn(e.getClickedBlock(), new VolmitSender(e.getPlayer(), Iris.instance.getTag()));
}
}
} catch(Throwable xx) {

View File

@ -116,8 +116,24 @@ public class IrisToolbelt {
public static PlatformChunkGenerator access(World world) {
if(isIrisWorld(world)) {
return ((PlatformChunkGenerator) world.getGenerator());
}
} /*else {
Iris.warn("""
"---------- No World? ---------------
""");
}*/
return null;
}

View File

@ -60,7 +60,7 @@ public class IrisEngineMantle implements EngineMantle {
public IrisEngineMantle(Engine engine) {
this.engine = engine;
this.mantle = new Mantle(new File(engine.getWorld().worldFolder(), "mantle"), engine.getTarget().getHeight());
this.mantle = new Mantle(new File(engine.getWorld().worldFolder(), "mantle"), engine.getTarget().getHeight(), engine.getTarget().getMinY());
radius = radCache.aquire(this::computeParallaxSize);
components = new KList<>();
registerComponent(new MantleCarvingComponent(this));

View File

@ -748,7 +748,6 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
default PlacedObject getObjectPlacement(int x, int y, int z) {
String objectAt = getMantle().getMantle().get(x, y, z, String.class);
if(objectAt == null || objectAt.isEmpty()) {
return null;
}

View File

@ -42,6 +42,8 @@ public class EngineTarget {
return world.maxHeight() - world.minHeight();
}
public int getMinY() { return world.minHeight(); }
public void close() {
}

View File

@ -58,6 +58,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class Mantle {
private final File dataFolder;
private final int worldHeight;
private final int minY;
private final Map<Long, Long> lastUse;
@Getter
private final Map<Long, TectonicPlate> loadedRegions;
@ -76,11 +77,12 @@ public class Mantle {
* the world's height (in blocks)
*/
@BlockCoordinates
public Mantle(File dataFolder, int worldHeight) {
public Mantle(File dataFolder, int worldHeight, int minY) {
this.hyperLock = new HyperLock();
this.closed = new AtomicBoolean(false);
this.dataFolder = dataFolder;
this.worldHeight = worldHeight;
this.minY = minY;
this.io = new AtomicBoolean(false);
dataFolder.mkdirs();
unload = new KSet<>();
@ -330,7 +332,7 @@ public class Mantle {
}
/**
* Gets the data tat the current block position This method will attempt to find a
* Gets the data at the current block position This method will attempt to find a
* Tectonic Plate either by loading it or creating a new one. This method uses
* the hyper lock packaged with each Mantle. The hyperlock allows locking of multiple
* threads at a single region while still allowing other threads to continue
@ -352,6 +354,7 @@ public class Mantle {
@SuppressWarnings("unchecked")
@BlockCoordinates
public <T> T get(int x, int y, int z, Class<T> t) {
y -= minY;
if(closed.get()) {
throw new RuntimeException("The Mantle is closed");
}