mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Clean
This commit is contained in:
parent
30559841d5
commit
dcd3495564
@ -39,11 +39,9 @@ import com.volmit.iris.util.collection.KSet;
|
|||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
import com.volmit.iris.util.mantle.MantleFlag;
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
import com.volmit.iris.util.math.BlockPosition;
|
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.MatterMarker;
|
import com.volmit.iris.util.matter.MatterMarker;
|
||||||
import com.volmit.iris.util.matter.slices.MarkerMatter;
|
|
||||||
import com.volmit.iris.util.plugin.Chunks;
|
import com.volmit.iris.util.plugin.Chunks;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
@ -60,8 +58,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.Future;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@ -276,6 +272,15 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
.collect(Collectors.toList()))
|
.collect(Collectors.toList()))
|
||||||
.popRandom(RNG.r);
|
.popRandom(RNG.r);
|
||||||
|
|
||||||
|
getSpawnersFromMarkers(c).forEach((block, spawners) -> {
|
||||||
|
if (spawners.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IrisSpawner s = new KList<>(spawners).getRandom();
|
||||||
|
spawn(block, s, false);
|
||||||
|
});
|
||||||
|
|
||||||
if (v != null && v.getReferenceSpawner() != null) {
|
if (v != null && v.getReferenceSpawner() != null) {
|
||||||
int maxEntCount = v.getReferenceSpawner().getMaxEntitiesPerChunk();
|
int maxEntCount = v.getReferenceSpawner().getMaxEntitiesPerChunk();
|
||||||
|
|
||||||
@ -432,8 +437,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
() -> {
|
() -> {
|
||||||
J.a(() -> spawnIn(e, true), RNG.r.i(5, 200));
|
J.a(() -> spawnIn(e, true), RNG.r.i(5, 200));
|
||||||
getSpawnersFromMarkers(e).forEach((block, spawners) -> {
|
getSpawnersFromMarkers(e).forEach((block, spawners) -> {
|
||||||
if(spawners.isEmpty())
|
if (spawners.isEmpty()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,9 +453,12 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void spawn(IrisPosition block, IrisSpawner spawner, boolean initial) {
|
private void spawn(IrisPosition block, IrisSpawner spawner, boolean initial) {
|
||||||
|
if (spawner == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
KList<IrisEntitySpawn> s = initial ? spawner.getInitialSpawns() : spawner.getSpawns();
|
KList<IrisEntitySpawn> s = initial ? spawner.getInitialSpawns() : spawner.getSpawns();
|
||||||
if(s.isEmpty())
|
if (s.isEmpty()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,19 +474,16 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
charge = M.ms() + 3000;
|
charge = M.ms() + 3000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<IrisPosition, KSet<IrisSpawner>> getSpawnersFromMarkers(Chunk c)
|
public Map<IrisPosition, KSet<IrisSpawner>> getSpawnersFromMarkers(Chunk c) {
|
||||||
{
|
|
||||||
Map<IrisPosition, KSet<IrisSpawner>> p = new KMap<>();
|
Map<IrisPosition, KSet<IrisSpawner>> p = new KMap<>();
|
||||||
|
|
||||||
getMantle().iterateChunk(c.getX(), c.getZ(), MatterMarker.class, (x, y, z, t) -> {
|
getMantle().iterateChunk(c.getX(), c.getZ(), MatterMarker.class, (x, y, z, t) -> {
|
||||||
IrisMarker mark = getData().getMarkerLoader().load(t.getTag());
|
IrisMarker mark = getData().getMarkerLoader().load(t.getTag());
|
||||||
IrisPosition pos = new IrisPosition((c.getX() << 4) + x, y, (c.getZ() << 4) + z);
|
IrisPosition pos = new IrisPosition((c.getX() << 4) + x, y, (c.getZ() << 4) + z);
|
||||||
for(String i : mark.getSpawners())
|
for (String i : mark.getSpawners()) {
|
||||||
{
|
|
||||||
IrisSpawner m = getData().getSpawnerLoader().load(i);
|
IrisSpawner m = getData().getSpawnerLoader().load(i);
|
||||||
|
|
||||||
if(m != null)
|
if (m != null) {
|
||||||
{
|
|
||||||
p.computeIfAbsent(pos, (k) -> new KSet<>()).add(m);
|
p.computeIfAbsent(pos, (k) -> new KSet<>()).add(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -495,12 +499,10 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
J.a(() -> {
|
J.a(() -> {
|
||||||
MatterMarker marker = getMantle().get(e.getBlock().getX(), e.getBlock().getY(), e.getBlock().getZ(), MatterMarker.class);
|
MatterMarker marker = getMantle().get(e.getBlock().getX(), e.getBlock().getY(), e.getBlock().getZ(), MatterMarker.class);
|
||||||
|
|
||||||
if(marker != null)
|
if (marker != null) {
|
||||||
{
|
|
||||||
IrisMarker mark = getData().getMarkerLoader().load(marker.getTag());
|
IrisMarker mark = getData().getMarkerLoader().load(marker.getTag());
|
||||||
|
|
||||||
if(mark == null || mark.isRemoveOnChange())
|
if (mark == null || mark.isRemoveOnChange()) {
|
||||||
{
|
|
||||||
getMantle().remove(e.getBlock().getX(), e.getBlock().getY(), e.getBlock().getZ(), MatterMarker.class);
|
getMantle().remove(e.getBlock().getX(), e.getBlock().getY(), e.getBlock().getZ(), MatterMarker.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
|
|
||||||
public interface IRare {
|
public interface IRare {
|
||||||
static int get(Object v) {
|
static int get(Object v) {
|
||||||
return v instanceof IRare ? Math.max(1, ((IRare) v).getRarity()) : 1;
|
return v instanceof IRare ? Math.max(1, ((IRare) v).getRarity()) : 1;
|
||||||
|
@ -27,7 +27,6 @@ import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
|||||||
import com.volmit.iris.engine.object.annotations.Required;
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.math.BlockPosition;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.slices.MarkerMatter;
|
import com.volmit.iris.util.matter.slices.MarkerMatter;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -105,8 +104,7 @@ public class IrisEntitySpawn implements IRare {
|
|||||||
int spawns = minSpawns == maxSpawns ? minSpawns : rng.i(Math.min(minSpawns, maxSpawns), Math.max(minSpawns, maxSpawns));
|
int spawns = minSpawns == maxSpawns ? minSpawns : rng.i(Math.min(minSpawns, maxSpawns), Math.max(minSpawns, maxSpawns));
|
||||||
int s = 0;
|
int s = 0;
|
||||||
|
|
||||||
if(!gen.getWorld().tryGetRealWorld())
|
if (!gen.getWorld().tryGetRealWorld()) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,10 +21,7 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.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.annotations.MaxNumber;
|
|
||||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
|
||||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
import com.volmit.iris.engine.object.annotations.Required;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user