mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-19 23:31:27 +00:00
SYNc
This commit is contained in:
@@ -31,15 +31,6 @@ public class EngineMobHandlerSVC extends IrisEngineService implements IrisMobDat
|
|||||||
private HashMap<Types, Integer> bukkitLimits;
|
private HashMap<Types, Integer> bukkitLimits;
|
||||||
private Function<EntityType, Types> entityType;
|
private Function<EntityType, Types> entityType;
|
||||||
private ConcurrentLinkedQueue<IrisMobPiece> pieces;
|
private ConcurrentLinkedQueue<IrisMobPiece> pieces;
|
||||||
public enum Types {
|
|
||||||
monsters,
|
|
||||||
animals,
|
|
||||||
water_animals,
|
|
||||||
water_ambient,
|
|
||||||
water_underground_creature,
|
|
||||||
axolotls,
|
|
||||||
ambient
|
|
||||||
}
|
|
||||||
|
|
||||||
public EngineMobHandlerSVC(Engine engine) {
|
public EngineMobHandlerSVC(Engine engine) {
|
||||||
super(engine);
|
super(engine);
|
||||||
@@ -53,7 +44,7 @@ public class EngineMobHandlerSVC extends IrisEngineService implements IrisMobDat
|
|||||||
this.entityType = (entityType) -> Types.valueOf(INMS.get().getMobCategory(entityType));
|
this.entityType = (entityType) -> Types.valueOf(INMS.get().getMobCategory(entityType));
|
||||||
this.bukkitLimits = getBukkitLimits();
|
this.bukkitLimits = getBukkitLimits();
|
||||||
|
|
||||||
//new Ticker();
|
new Ticker();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -152,6 +143,11 @@ public class EngineMobHandlerSVC extends IrisEngineService implements IrisMobDat
|
|||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<Types, Integer> bukkitLimits() {
|
||||||
|
return bukkitLimits;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getEnergy() {
|
public double getEnergy() {
|
||||||
fixEnergy();
|
fixEnergy();
|
||||||
|
|||||||
@@ -5,14 +5,29 @@ import com.volmit.iris.engine.framework.Engine;
|
|||||||
import com.volmit.iris.engine.service.EngineMobHandlerSVC;
|
import com.volmit.iris.engine.service.EngineMobHandlerSVC;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public interface IrisMobDataHandler {
|
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();
|
Engine getEngine();
|
||||||
|
|
||||||
|
HashMap<Types, Integer> bukkitLimits();
|
||||||
|
|
||||||
double getEnergy();
|
double getEnergy();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
package com.volmit.iris.util.mobs;
|
package com.volmit.iris.util.mobs;
|
||||||
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
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.engine.service.EngineMobHandlerSVC;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
import jakarta.activation.DataHandler;
|
import jakarta.activation.DataHandler;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -49,4 +54,40 @@ public class IrisMobPiece {
|
|||||||
public void close() {
|
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));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user