mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 11:04:25 +00:00
Npc API:
-Added natural spawn controller support
This commit is contained in:
1 parent
700fff3faf
commit
7d0b124422
6 files changed
+161
-6
No files matched your search
@@ -30,6 +30,7 @@ import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.*;
|
||||
@@ -94,10 +95,24 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
return ServerCloneController.Instance;
|
||||
}
|
||||
|
||||
public INaturalSpawnsHandler getNaturalSpawns() { return SpawnController.instance; }
|
||||
|
||||
public ITransportHandler getLocations() {
|
||||
return TransportController.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAllBiomeNames() {
|
||||
List<String> biomes = new ArrayList<String>();
|
||||
for (BiomeGenBase base : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (base != null && base.biomeName != null) {
|
||||
biomes.add(base.biomeName);
|
||||
}
|
||||
}
|
||||
|
||||
return biomes.toArray(new String[]{});
|
||||
}
|
||||
|
||||
public IEntity getIEntity(Entity entity) {
|
||||
if(entity == null)
|
||||
return null;
|
||||
|
||||
@@ -55,8 +55,12 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
public abstract ICloneHandler getClones();
|
||||
|
||||
public abstract INaturalSpawnsHandler getNaturalSpawns();
|
||||
|
||||
public abstract ITransportHandler getLocations();
|
||||
|
||||
public abstract String[] getAllBiomeNames();
|
||||
|
||||
public abstract ICustomNpc createNPC(World var1);
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package noppes.npcs.scripted.interfaces.handler;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.handler.data.INaturalSpawn;
|
||||
|
||||
public interface INaturalSpawnsHandler {
|
||||
|
||||
void saveAllData();
|
||||
|
||||
INaturalSpawn[] getSpawns();
|
||||
|
||||
INaturalSpawn[] getSpawns(String biome);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package noppes.npcs.scripted.interfaces.handler.data;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.IWorld;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntity;
|
||||
|
||||
public interface INaturalSpawn {
|
||||
|
||||
void setName(String name);
|
||||
|
||||
String getName();
|
||||
|
||||
void setEntity(IEntity entity);
|
||||
|
||||
IEntity getEntity(IWorld world);
|
||||
|
||||
void setWeight(int weight);
|
||||
|
||||
int getWeight();
|
||||
|
||||
void spawnsInLiquid(boolean spawns);
|
||||
|
||||
boolean spawnsInLiquid();
|
||||
|
||||
String[] getBiomes();
|
||||
|
||||
void setBiomes(String[] biomes);
|
||||
}
|
||||
Reference in new issue
Block a user