9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2026-01-06 15:51:30 +00:00
This commit is contained in:
RePixelatedMC
2024-08-22 17:16:46 +02:00
parent 3dfdb9654a
commit 773be08b24
3 changed files with 63 additions and 11 deletions

View File

@@ -31,15 +31,6 @@ public class EngineMobHandlerSVC extends IrisEngineService implements IrisMobDat
private HashMap<Types, Integer> bukkitLimits;
private Function<EntityType, Types> entityType;
private ConcurrentLinkedQueue<IrisMobPiece> pieces;
public enum Types {
monsters,
animals,
water_animals,
water_ambient,
water_underground_creature,
axolotls,
ambient
}
public EngineMobHandlerSVC(Engine engine) {
super(engine);
@@ -53,7 +44,7 @@ public class EngineMobHandlerSVC extends IrisEngineService implements IrisMobDat
this.entityType = (entityType) -> Types.valueOf(INMS.get().getMobCategory(entityType));
this.bukkitLimits = getBukkitLimits();
//new Ticker();
new Ticker();
}
@Override
@@ -152,6 +143,11 @@ public class EngineMobHandlerSVC extends IrisEngineService implements IrisMobDat
return engine;
}
@Override
public HashMap<Types, Integer> bukkitLimits() {
return bukkitLimits;
}
@Override
public double getEnergy() {
fixEnergy();

View File

@@ -5,14 +5,29 @@ import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.service.EngineMobHandlerSVC;
import org.bukkit.entity.EntityType;
import java.util.HashMap;
import java.util.function.Function;
public interface IrisMobDataHandler {
Function<EntityType, EngineMobHandlerSVC.Types> getMobType();
HashMap<Types, Integer> bukkitLimits = null;
enum Types {
monsters,
animals,
water_animals,
water_ambient,
water_underground_creature,
axolotls,
ambient
}
Function<EntityType, Types> getMobType();
Engine getEngine();
HashMap<Types, Integer> bukkitLimits();
double getEnergy();

View File

@@ -1,8 +1,13 @@
package com.volmit.iris.util.mobs;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisEngineChunkData;
import com.volmit.iris.engine.object.IrisEngineSpawnerCooldown;
import com.volmit.iris.engine.object.IrisEntitySpawn;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.service.EngineMobHandlerSVC;
import com.volmit.iris.util.math.M;
import com.volmit.iris.util.math.RNG;
import jakarta.activation.DataHandler;
import lombok.Getter;
import org.bukkit.entity.Player;
@@ -49,4 +54,40 @@ public class IrisMobPiece {
public void close() {
}
// private void spawn(IrisPosition c, IrisEntitySpawn i) {
// boolean allow = true;
//
// if (!i.getReferenceSpawner().getMaximumRatePerChunk().isInfinite()) {
// allow = false;
// IrisEngineChunkData cd = dataHandler.getEngine().getEngineData().getChunk(c.getX() >> 4, c.getZ() >> 4);
// IrisEngineSpawnerCooldown sc = null;
// for (IrisEngineSpawnerCooldown j : cd.getCooldowns()) {
// if (j.getSpawner().equals(i.getReferenceSpawner().getLoadKey())) {
// sc = j;
// break;
// }
// }
//
// if (sc == null) {
// sc = new IrisEngineSpawnerCooldown();
// sc.setSpawner(i.getReferenceSpawner().getLoadKey());
// cd.getCooldowns().add(sc);
// }
//
// if (sc.canSpawn(i.getReferenceSpawner().getMaximumRatePerChunk())) {
// sc.spawn(dataHandler.getEngine());
// allow = true;
// }
// }
//
// if (allow) {
// int s = i.spawn(dataHandler.getEngine(), c, RNG.r);
// actuallySpawned += s;
// if (s > 0) {
// getCooldown(i.getReferenceSpawner()).spawn(dataHandler.getEngine());
// energy -= s * ((i.getEnergyMultiplier() * i.getReferenceSpawner().getEnergyMultiplier() * 1));
// }
// }
// }
}