mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-17 22:32:04 +00:00
Light level for spawns closes #558
This commit is contained in:
@@ -44,4 +44,8 @@ public class IrisRange {
|
|||||||
|
|
||||||
return rng.d(min, max);
|
return rng.d(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean contains(int v) {
|
||||||
|
return v >= min && v <= max;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,8 +105,24 @@ public class IrisEntitySpawn implements IRare {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (l != null) {
|
if (l != null) {
|
||||||
if (spawn100(gen, l) != null)
|
if(referenceSpawner.getAllowedLightLevels().getMin() > 0 || referenceSpawner.getAllowedLightLevels().getMax() < 15)
|
||||||
s++;
|
{
|
||||||
|
if(referenceSpawner.getAllowedLightLevels().contains(l.getBlock().getLightLevel()))
|
||||||
|
{
|
||||||
|
if (spawn100(gen, l) != null)
|
||||||
|
{
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (spawn100(gen, l) != null)
|
||||||
|
{
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package com.volmit.iris.engine.object.spawners;
|
|||||||
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.engine.object.annotations.ArrayType;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.basic.IrisRange;
|
||||||
import com.volmit.iris.engine.object.basic.IrisRate;
|
import com.volmit.iris.engine.object.basic.IrisRate;
|
||||||
import com.volmit.iris.engine.object.basic.IrisTimeBlock;
|
import com.volmit.iris.engine.object.basic.IrisTimeBlock;
|
||||||
import com.volmit.iris.engine.object.basic.IrisWeather;
|
import com.volmit.iris.engine.object.basic.IrisWeather;
|
||||||
@@ -32,6 +33,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@@ -67,6 +69,9 @@ public class IrisSpawner extends IrisRegistrant {
|
|||||||
@Desc("The maximum rate this spawner can fire on a specific chunk")
|
@Desc("The maximum rate this spawner can fire on a specific chunk")
|
||||||
private IrisRate maximumRatePerChunk = new IrisRate();
|
private IrisRate maximumRatePerChunk = new IrisRate();
|
||||||
|
|
||||||
|
@Desc("The light levels this spawn is allowed to run in (0-15 inclusive)")
|
||||||
|
private IrisRange allowedLightLevels = new IrisRange(0, 15);
|
||||||
|
|
||||||
@Desc("Where should these spawns be placed")
|
@Desc("Where should these spawns be placed")
|
||||||
private IrisSpawnGroup group = IrisSpawnGroup.NORMAL;
|
private IrisSpawnGroup group = IrisSpawnGroup.NORMAL;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user