use of mcjty.rftoolsdim.dimensions.description.MobDescriptor in project RFToolsDimensions by McJty.
the class MobConfiguration method init.
public static void init(Configuration cfg) {
int chance = cfg.get(CATEGORY_MOBS, "default.chance", 6).getInt();
int mingroup = cfg.get(CATEGORY_MOBS, "default.mingroup", 1).getInt();
int maxgroup = cfg.get(CATEGORY_MOBS, "default.maxgroup", 3).getInt();
int maxentity = cfg.get(CATEGORY_MOBS, "default.maxentity", 10).getInt();
defaultDescriptor = new MobDescriptor(null, chance, mingroup, maxgroup, maxentity);
initMobItem(cfg, "Zombie", 100, 8, 8, 60);
initMobItem(cfg, "Skeleton", 100, 8, 8, 60);
initMobItem(cfg, "Enderman", 20, 2, 4, 20);
initMobItem(cfg, "Blaze", 20, 2, 4, 20);
initMobItem(cfg, "Creeper", 100, 8, 8, 60);
initMobItem(cfg, "CaveSpider", 100, 8, 8, 60);
initMobItem(cfg, "Ghast", 20, 2, 4, 20);
initMobItem(cfg, "VillagerGolem", 20, 1, 2, 6);
initMobItem(cfg, "LavaSlime", 50, 2, 4, 30);
initMobItem(cfg, "PigZombie", 20, 2, 4, 10);
initMobItem(cfg, "Slime", 50, 2, 4, 30);
initMobItem(cfg, "SnowMan", 50, 2, 4, 30);
initMobItem(cfg, "Spider", 100, 8, 8, 60);
initMobItem(cfg, "Witch", 10, 1, 1, 20);
initMobItem(cfg, "Bat", 10, 8, 8, 20);
initMobItem(cfg, "Endermite", 6, 2, 4, 10);
initMobItem(cfg, "Silverfish", 6, 2, 4, 10);
initMobItem(cfg, "Rabbit", 10, 3, 4, 20);
initMobItem(cfg, "Chicken", 10, 3, 4, 40);
initMobItem(cfg, "Cow", 10, 3, 4, 40);
initMobItem(cfg, "EntityHorse", 10, 3, 4, 40);
initMobItem(cfg, "MushroomCow", 10, 3, 4, 40);
initMobItem(cfg, "Ozelot", 5, 2, 3, 20);
initMobItem(cfg, "Pig", 10, 3, 4, 40);
initMobItem(cfg, "Sheep", 10, 3, 4, 40);
initMobItem(cfg, "Squid", 10, 3, 4, 40);
initMobItem(cfg, "Wolf", 10, 3, 4, 20);
initMobItem(cfg, "Villager", 10, 3, 4, 20);
initMobItem(cfg, "WitherBoss", 5, 1, 2, 5);
initMobItem(cfg, "Guardian", 8, 1, 3, 7);
initMobItem(cfg, "EnderDragon", 4, 1, 2, 4);
}
use of mcjty.rftoolsdim.dimensions.description.MobDescriptor in project RFToolsDimensions by McJty.
the class DimletObjectMapping method getMob.
public static MobDescriptor getMob(DimletKey dimlet) {
String id = dimlet.getId();
if (DimletType.DIMLET_MOB.equals(dimlet.getType()) && !DimletObjectMapping.DEFAULT_ID.equals(id)) {
MobDescriptor descriptor = MobConfiguration.mobClasses.get(id);
if (descriptor != null) {
return descriptor;
}
Class<? extends EntityLiving> entityClass = MobConfiguration.getEntityClass(EntityTools.fixEntityId(id));
if (entityClass == null) {
Logging.logError("Cannot find mob with id '" + id + "'!");
return null;
}
Logging.warn(null, "No mob descriptor found for '" + id + "'; creating a default one");
return new MobDescriptor(entityClass, MobConfiguration.chance, MobConfiguration.mingroup, MobConfiguration.maxgroup, MobConfiguration.maxentity);
}
return null;
}
use of mcjty.rftoolsdim.dimensions.description.MobDescriptor in project RFToolsDimensions by McJty.
the class MobDimletType method constructDimension.
@Override
public void constructDimension(List<Pair<DimletKey, List<DimletKey>>> dimlets, Random random, DimensionInformation dimensionInformation) {
List<MobDescriptor> extraMobs = dimensionInformation.getExtraMobs();
dimlets = DimensionInformation.extractType(DimletType.DIMLET_MOB, dimlets);
if (dimlets.isEmpty()) {
while (random.nextFloat() < WorldgenConfiguration.randomExtraMobsChance) {
DimletKey key = DimletRandomizer.getRandomMob(random);
if (key != null) {
dimensionInformation.updateCostFactor(key);
MobDescriptor mob = DimletObjectMapping.getMob(key);
if (mob != null) {
extraMobs.add(mob);
}
}
}
} else {
for (Pair<DimletKey, List<DimletKey>> dimletWithModifiers : dimlets) {
MobDescriptor descriptor = DimletObjectMapping.getMob(dimletWithModifiers.getLeft());
if (descriptor != null) {
extraMobs.add(descriptor);
}
}
}
}
use of mcjty.rftoolsdim.dimensions.description.MobDescriptor in project RFToolsDimensions by McJty.
the class GenericChunkGenerator method getPossibleCreatures.
@Override
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
List<Biome.SpawnListEntry> creatures = getDefaultCreatures(creatureType, pos);
if (dimensionInformation.getExtraMobs().isEmpty() || worldObj == null) {
// null pointer protection here
return creatures;
}
Class<?> creatureTypeClass;
switch(creatureType) {
case AMBIENT:
creatureTypeClass = IAnimals.class;
break;
case MONSTER:
creatureTypeClass = IMob.class;
break;
default:
return creatures;
}
creatures = new ArrayList<>(creatures);
for (MobDescriptor mob : dimensionInformation.getExtraMobs()) {
Class<? extends EntityLiving> entityClass = mob.entityClass;
if (creatureTypeClass.isAssignableFrom(entityClass) && worldObj.countEntities(entityClass) < mob.getMaxLoaded()) {
creatures.add(mob);
}
}
return creatures;
}
use of mcjty.rftoolsdim.dimensions.description.MobDescriptor in project RFToolsDimensions by McJty.
the class MobConfiguration method initMobItem.
// Accepts an old-style (1.10) entity ID or a new-style string representation of a resourcelocation
private static void initMobItem(Configuration cfg, String name, int chance, int mingroup, int maxgroup, int maxentity) {
String id = EntityTools.fixEntityId(name);
Class<? extends EntityLiving> entityClass = getEntityClass(id);
if (entityClass == null) {
Logging.logError("Cannot find mob with id '" + id + "'!");
return;
}
if (cfg != null) {
chance = cfg.get(CATEGORY_MOBS, id + ".chance", chance).getInt();
mingroup = cfg.get(CATEGORY_MOBS, id + ".mingroup", mingroup).getInt();
maxgroup = cfg.get(CATEGORY_MOBS, id + ".maxgroup", maxgroup).getInt();
maxentity = cfg.get(CATEGORY_MOBS, id + ".maxentity", maxentity).getInt();
}
mobClasses.put(id, new MobDescriptor(entityClass, chance, mingroup, maxgroup, maxentity));
}
Aggregations