Marker exhaustion & auto-removal in invalid positions

This commit is contained in:
cyberpwn
2021-09-13 16:46:04 -04:00
parent 0b1d59e398
commit d0175f9c39
5 changed files with 48 additions and 5 deletions

View File

@@ -47,6 +47,9 @@ public class IrisMarker extends IrisRegistrant {
@Desc("Remove this marker when the block it's assigned to is changed.")
private boolean removeOnChange = true;
@Desc("If true, markers will only be placed here if there is 2 air blocks above it.")
private boolean emptyAbove = true;
@Desc("If this marker is used, what is the chance it removes itself. For example 25% (0.25) would mean that on average 4 uses will remove a specific marker. Set this below 0 (-1) to never exhaust & set this to 1 or higher to always exhaust on first use.")
private double exhaustionChance = 0.33;

View File

@@ -663,6 +663,13 @@ public class IrisObject extends IrisRegistrant {
markers = new KMap<>();
for(IrisObjectMarker j : config.getMarkers())
{
IrisMarker marker = getLoader().getMarkerLoader().load(j.getMarker());
if(marker == null)
{
continue;
}
int max = j.getMaximumMarkers();
for(BlockVector i : getBlocks().k().shuffle())
@@ -684,7 +691,7 @@ public class IrisObject extends IrisRegistrant {
boolean a = !blocks.containsKey(new BlockVector(i.clone().add(new BlockVector(0, 1, 0))));
boolean fff = !blocks.containsKey(new BlockVector(i.clone().add(new BlockVector(0, 2, 0))));
if((j.isEmptyAbove() && a && fff) || !j.isEmptyAbove())
if((marker.isEmptyAbove() && a && fff) || !marker.isEmptyAbove())
{
markers.put(i, j.getMarker());
max--;

View File

@@ -51,9 +51,6 @@ public class IrisObjectMarker {
@Desc("The maximum amount of markers to place. Use these sparingly!")
private int maximumMarkers = 8;
@Desc("If true, markers will only be placed here if there is 2 air blocks above it.")
private boolean emptyAbove = true;
@Desc("If true, markers will only be placed if the block matches the mark list perfectly.")
private boolean exact = false;