net.minecraft.entity.EnumCreatureType Java Examples
The following examples show how to use
net.minecraft.entity.EnumCreatureType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MoCreatures.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
public static void ClearVanillaSpawnLists() { for (int i = 0; i < BiomeGenBase.biomeList.length; i++) { if (BiomeGenBase.biomeList[i] != null) { EntityRegistry.removeSpawn(EntityCow.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityPig.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntitySheep.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityChicken.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityWolf.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntitySquid.class, EnumCreatureType.waterCreature, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityOcelot.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityBat.class, EnumCreatureType.ambient, BiomeGenBase.biomeList[i]); } } }
Example #2
Source File: CustomSpawner.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
public int countSpawnedEntities(World world, EnumCreatureType enumcreaturetype) { int i = getEnumIndex(enumcreaturetype); int finalcount = 0; { boolean flag = false; for (Iterator iterator = entityClasses[i].iterator(); iterator.hasNext();) { try { if (iterator != null) { Class class1 = (Class) iterator.next(); if (class1 != null) { finalcount += world.countEntities(class1); } } } catch (Exception e) { } } } return finalcount; }
Example #3
Source File: CyberwareContent.java From Cyberware with MIT License | 6 votes |
public static void postInit() { if (!CyberwareConfig.NO_ZOMBIES) { List<Biome> biomes = new ArrayList<Biome>(); for (ResourceLocation key : Biome.REGISTRY.getKeys()) { Biome biome = Biome.REGISTRY.getObject(key); for (SpawnListEntry entry : biome.getSpawnableList(EnumCreatureType.MONSTER)) { if (entry.entityClass == EntityZombie.class) { biomes.add(biome); } } } EntityRegistry.addSpawn(EntityCyberZombie.class, CyberwareConfig.ZOMBIE_WEIGHT, CyberwareConfig.ZOMBIE_MIN_PACK, CyberwareConfig.ZOMBIE_MAX_PACK, EnumCreatureType.MONSTER, biomes.toArray(new Biome[0])); } }
Example #4
Source File: ActivationRange.java From Thermos with GNU General Public License v3.0 | 6 votes |
/** * Initializes an entities type on construction to specify what group this * entity is in for activation ranges. * * @param entity * @return group id */ public static byte initializeEntityActivationType(Entity entity) { Chunk chunk = null; // Cauldron start - account for entities that dont extend EntityMob, EntityAmbientCreature, EntityCreature if ( entity instanceof EntityMob || entity instanceof EntitySlime || entity.isCreatureType(EnumCreatureType.monster, false)) // Cauldron - account for entities that dont extend EntityMob { return 1; // Monster } else if ( entity instanceof EntityCreature || entity instanceof EntityAmbientCreature || entity.isCreatureType(EnumCreatureType.creature, false) || entity.isCreatureType(EnumCreatureType.waterCreature, false) || entity.isCreatureType(EnumCreatureType.ambient, false)) { return 2; // Animal // Cauldron end } else { return 3; // Misc } }
Example #5
Source File: TransIconHerobrineButWithBetterPantsSubMod.java From CommunityMod with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void registerEntities(IForgeRegistry<EntityEntry> reg) { reg.register(EntityEntryBuilder.create() .entity(TransIconHerobrineButWithBetterPantsEntity.class) .factory(TransIconHerobrineButWithBetterPantsEntity::new) .name(CommunityGlobals.MOD_ID + ".trans_icon_herobrine_but_with_better_pants") .id(new ResourceLocation(CommunityGlobals.MOD_ID, "trans_icon_herobrine_but_with_better_pants"), CommunityGlobals.entity_id++) .tracker(128, 3, true) .spawn(EnumCreatureType.CREATURE, 3, 0, 1, Biome.REGISTRY) .egg(0xAA7D66, 0x32394D) .build() ); reg.register(EntityEntryBuilder.create() .entity(NotchButWithWorsererPantsEntity.class) .factory(NotchButWithWorsererPantsEntity::new) .name(CommunityGlobals.MOD_ID + ".notch_but_with_worserer_pants") .id(new ResourceLocation(CommunityGlobals.MOD_ID, "notch_but_with_worserer_pants"), CommunityGlobals.entity_id++) .tracker(80, 3, true) .spawn(EnumCreatureType.CREATURE, 3, 2, 3, Biome.REGISTRY) .egg(0xAAAAAA, 0xAAAAAA) .build() ); }
Example #6
Source File: MoCreatures.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
public static void ClearVanillaMobSpawns() { for (int i = 0; i < BiomeGenBase.biomeList.length; i++) { if (BiomeGenBase.biomeList[i] != null) { EntityRegistry.removeSpawn(EntityCreeper.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntitySkeleton.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityZombie.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntitySpider.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityEnderman.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityCaveSpider.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntitySlime.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityGhast.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityPigZombie.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityMagmaCube.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); EntityRegistry.removeSpawn(EntityOcelot.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]); } } }
Example #7
Source File: CustomSpawner.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
private static boolean canCreatureTypeSpawnAtLocation(EnumCreatureType enumcreaturetype, World world, int i, int j, int k) { if (enumcreaturetype.getCreatureMaterial() == Material.water) { return world.getBlockMaterial(i, j, k).isLiquid() && !world.isBlockNormalCube(i, j + 1, k); } else { return world.isBlockNormalCube(i, j - 1, k) && !world.isBlockNormalCube(i, j, k) && !world.getBlockMaterial(i, j, k).isLiquid() && !world.isBlockNormalCube(i, j + 1, k); } }
Example #8
Source File: FriendlyMob.java From ForgeHax with MIT License | 5 votes |
@Override public boolean isMobType(Entity entity) { return entity.isCreatureType(EnumCreatureType.CREATURE, false) || entity.isCreatureType(EnumCreatureType.AMBIENT, false) || entity.isCreatureType(EnumCreatureType.WATER_CREATURE, false) || entity instanceof EntityVillager || entity instanceof EntityGolem; }
Example #9
Source File: FindEntityCommand.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Override public void exec(String input) { if (!this.clamp(input, 2, 2)) { this.printUsage(); return; } final Minecraft mc = Minecraft.getMinecraft(); final BlockPos pos = mc.player.getPosition(); final Chunk chunk = mc.world.getChunk(pos); final Biome biome = chunk.getBiome(pos, mc.world.getBiomeProvider()); System.out.println(biome.getSpawnableList(EnumCreatureType.CREATURE)); }
Example #10
Source File: CustomSpawner.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
/** * Gets a random custom mob for spawning based on XYZ coordinates */ public SpawnListEntry getRandomCustomMob(World worldObj, EnumCreatureType enumCreatureType, int pX, int pY, int pZ) { List list = getPossibleCustomCreatures(worldObj, enumCreatureType, pX, pY, pZ); if (list == null || list.isEmpty()) { //System.out.println("list = NULL!! for type " + enumCreatureType.name()); return null; } else { return (SpawnListEntry) WeightedRandom.getRandomItem(worldObj.rand, list); } }
Example #11
Source File: Penguins.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void registerEntities(IForgeRegistry<EntityEntry> reg) { List<Biome> penguinBiomes = new LinkedList<Biome>(); for (Entry<ResourceLocation, Biome> e : ForgeRegistries.BIOMES.getEntries()) if (e.getValue().getTempCategory() == TempCategory.COLD) penguinBiomes.add(e.getValue()); reg.register(EntityEntryBuilder.create().entity(EntityPenguin.class).egg(0x000000, 0xFFFFFF) .tracker(32, 4, true).name("community_mod.penguin") .spawn(EnumCreatureType.CREATURE, 7, 7, 9, penguinBiomes) .id(new ResourceLocation("community_mod", "penguin"), CommunityGlobals.entity_id++).build()); }
Example #12
Source File: SubmodExplodingChickens.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void registerEntities(IForgeRegistry<EntityEntry> reg) { reg.register(EntityEntryBuilder.create() .name(CommunityGlobals.MOD_ID + "." + "exploding_chicken") .entity(EntityExplodingChicken.class) .id(new ResourceLocation(CommunityGlobals.MOD_ID, "exploding_chicken"), CommunityGlobals.entity_id++) .tracker(80, 3, true) .spawn(EnumCreatureType.CREATURE, 3, 1, 4, most_biomes) .egg(16711680, 10592673) .build()); }
Example #13
Source File: DabSquirrels.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void registerEntities(IForgeRegistry<EntityEntry> reg) { Set<Biome> biomeset = BiomeDictionary.getBiomes(BiomeDictionary.Type.FOREST); Biome[] biomes = biomeset.toArray(new Biome[0]); reg.register(EntityEntryBuilder.create() .entity(EntityDabSquirrel.class).egg(0x89806f, 0xb2a489) .name(CommunityGlobals.MOD_ID + ".dabsquirrel") .id(new ResourceLocation(CommunityGlobals.MOD_ID, "dabsquirrel"), CommunityGlobals.entity_id++) .tracker(128, 1, true) .spawn(EnumCreatureType.CREATURE, 12, 1, 3, biomes) .build()); }
Example #14
Source File: TofuEntityRegister.java From TofuCraftReload with MIT License | 5 votes |
public static void entitySpawn() { List<BiomeManager.BiomeEntry> biomeEntries = new ArrayList<BiomeManager.BiomeEntry>(); biomeEntries.addAll(BiomeManager.getBiomes(BiomeManager.BiomeType.COOL)); biomeEntries.addAll(BiomeManager.getBiomes(BiomeManager.BiomeType.DESERT)); biomeEntries.addAll(BiomeManager.getBiomes(BiomeManager.BiomeType.ICY)); biomeEntries.addAll(BiomeManager.getBiomes(BiomeManager.BiomeType.WARM)); List<Biome> biomes = new ArrayList<Biome>(); for (BiomeManager.BiomeEntry b : biomeEntries) { biomes.add(b.biome); } biomes.addAll(BiomeManager.oceanBiomes); EntityRegistry.addSpawn(EntityTofuSlime.class, 105, 2, 3, EnumCreatureType.MONSTER, biomes.toArray(new Biome[biomes.size()])); }
Example #15
Source File: SubmodGnomes.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void registerEntities(IForgeRegistry<EntityEntry> reg) { reg.register(EntityEntryBuilder.create() .name(CommunityGlobals.MOD_ID + "." + "wood_gnome") .entity(EntityGnomeWood.class) .id(new ResourceLocation(CommunityGlobals.MOD_ID, "wood_gnome"), CommunityGlobals.entity_id++) .tracker(80, 3, false) .spawn(EnumCreatureType.CREATURE, 10, 1, 4, BiomeDictionary.getBiomes(BiomeDictionary.Type.FOREST)) .egg(0xd3753f, 0x774725) .build()); }
Example #16
Source File: CustomSpawner.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
private int getMax(EnumCreatureType enumcreaturetype) { if (enumcreaturetype == EnumCreatureType.monster) { return getMaxMobs(); } if (enumcreaturetype == EnumCreatureType.creature) { return getMaxAnimals(); } if (enumcreaturetype == EnumCreatureType.waterCreature) { return getMaxAquatic(); } if (enumcreaturetype == EnumCreatureType.ambient) { return getMaxAmbient(); } return 30; }
Example #17
Source File: CustomSpawner.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
private List[] getCustomSpawnableList(EnumCreatureType enumcreaturetype) { if (enumcreaturetype == EnumCreatureType.monster) { return customMobSpawnList; } if (enumcreaturetype == EnumCreatureType.creature) { return customCreatureSpawnList; } if (enumcreaturetype == EnumCreatureType.waterCreature) { return customAquaticSpawnList; } if (enumcreaturetype == EnumCreatureType.ambient) { return customAmbientSpawnList; } return null; }
Example #18
Source File: EntityUtils.java From ForgeHax with MIT License | 5 votes |
/** * If the mob is friendly (not aggressive) */ public static boolean isFriendlyMob(Entity entity) { return (entity.isCreatureType(EnumCreatureType.CREATURE, false) && !EntityUtils.isNeutralMob(entity)) || (entity.isCreatureType(EnumCreatureType.AMBIENT, false) && !isBatsDisabled) || entity instanceof EntityVillager || entity instanceof EntityIronGolem || (isNeutralMob(entity) && !EntityUtils.isMobAggressive(entity)); }
Example #19
Source File: ChunkGeneratorTorikki.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Nonnull @Override public List<Biome.SpawnListEntry> getPossibleCreatures(@Nonnull EnumCreatureType creatureType, @Nonnull BlockPos pos) { ArrayList<Biome.SpawnListEntry> list = new ArrayList<>(); list.add(new Biome.SpawnListEntry(EntityFairy.class, 1, 1, 3)); return list; }
Example #20
Source File: CustomSpawner.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
private int getEnumIndex(EnumCreatureType enumcreaturetype) { if (enumcreaturetype == EnumCreatureType.monster) { return 0; } if (enumcreaturetype == EnumCreatureType.creature) { return 1; } if (enumcreaturetype == EnumCreatureType.waterCreature) { return 3; } if (enumcreaturetype == EnumCreatureType.ambient) { return 2; } return 0; }
Example #21
Source File: GriefPreventionPlugin.java From GriefPrevention with MIT License | 5 votes |
public static boolean isEntityProtected(Entity entity) { // ignore monsters if (SpongeImplHooks.isCreatureOfType((net.minecraft.entity.Entity) entity, EnumCreatureType.MONSTER)) { return false; } return true; }
Example #22
Source File: CustomSpawner.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
public void RemoveCustomSpawn(Class class1, EnumCreatureType enumcreaturetype, BiomeGenBase abiomegenbase[]) { if (class1 == null) { throw new IllegalArgumentException("entityClass cannot be null"); } if (enumcreaturetype == null) { throw new IllegalArgumentException("spawnList cannot be null"); } if (abiomegenbase == null) { abiomegenbase = new BiomeGenBase[biomeList.size()]; abiomegenbase = biomeList.toArray(abiomegenbase); } for (BiomeGenBase element : abiomegenbase) { List[] fulllist = getCustomSpawnableList(enumcreaturetype); if (fulllist != null) { int x = biomeList.indexOf(element.biomeName); for (Iterator iterator = fulllist[x].iterator(); iterator.hasNext();) { if (iterator != null) { SpawnListEntry spawnlistentry = (SpawnListEntry) iterator.next(); if (spawnlistentry.entityClass == class1) { iterator.remove(); } } } } } }
Example #23
Source File: ActivationRange.java From Thermos with GNU General Public License v3.0 | 5 votes |
/** * These entities are excluded from Activation range checks. * * @param entity * @param world * @return boolean If it should always tick. */ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) { // Cauldron start - another fix for Proxy Worlds if (config == null && DimensionManager.getWorld(0) != null) { config = DimensionManager.getWorld(0).spigotConfig; } else { return true; } // Cauldron end if ( ( entity.activationType == 3 && config.miscActivationRange == 0 ) || ( entity.activationType == 2 && config.animalActivationRange == 0 ) || ( entity.activationType == 1 && config.monsterActivationRange == 0 ) || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron || entity instanceof EntityThrowable || entity instanceof EntityDragon || entity instanceof EntityDragonPart || entity instanceof EntityWither || entity instanceof EntityFireball || entity instanceof EntityWeatherEffect || entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks || entity instanceof EntityEnderCrystal || entity instanceof EntityFireworkRocket || entity instanceof EntityVillager // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false) && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false) && !entity.isCreatureType(EnumCreatureType.waterCreature, false))) { return true; } return false; }
Example #24
Source File: EventHandlerEntity.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public void on(LivingSpawnEvent.CheckSpawn event) { if(event.entityLiving.isCreatureType(EnumCreatureType.monster, false)) { double rangeSq = AuraEffects.LUX.getRange() * AuraEffects.LUX.getRange(); Vector3 entityPos = MiscUtils.getPositionVector(event.entity); for(ChunkCoordinates luxPylons : registeredLuxPylons) { Vector3 pylon = Vector3.fromCC(luxPylons); if(entityPos.distanceSquared(pylon) <= rangeSq) { event.setResult(Event.Result.DENY); return; } } } }
Example #25
Source File: ChunkProviderCavePlanet.java From AdvancedRocketry with MIT License | 5 votes |
/** * Returns a list of creatures of the specified type that can spawn at the given location. */ @Override public List<SpawnListEntry> getPossibleCreatures( EnumCreatureType creatureType, BlockPos pos) { Biome biome = this.world.getBiome(pos); return biome.getSpawnableList(creatureType); }
Example #26
Source File: ChunkProviderPlanet.java From AdvancedRocketry with MIT License | 5 votes |
/** * Returns a list of creatures of the specified type that can spawn at the given location. */ @Override public List<SpawnListEntry> getPossibleCreatures( EnumCreatureType creatureType, BlockPos pos) { Biome biome = this.worldObj.getBiome(pos); return biome.getSpawnableList(creatureType); }
Example #27
Source File: MoCEntityData.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
public MoCEntityData(Class<? extends EntityLiving> entityClass, EnumCreatureType type, short freq, short min, short max) { this.clazz = entityClass; this.typeOfCreature = type; this.frequency = freq; this.minGroup = min; this.maxGroup = max; }
Example #28
Source File: EntityHelper.java From Moo-Fluids with GNU General Public License v3.0 | 5 votes |
public static void addSpawnFromType(final Class<? extends EntityLiving> entityClass, final int weightedProb, final int min, final int max, final EnumCreatureType typeOfCreature, final BiomeDictionary.Type... biomeTypes) { final ArrayList<Biome> biomes = new ArrayList<Biome>(); for (final BiomeDictionary.Type biomeType : biomeTypes) { biomes.addAll(BiomeDictionary.getBiomes(biomeType)); } EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature, biomes.toArray(new Biome[biomes.size()])); }
Example #29
Source File: EntityHelper.java From Moo-Fluids with GNU General Public License v3.0 | 5 votes |
public static void addSpawnAllBiomes(final Class<? extends EntityLiving> entityClass, final int weightedProb, final int min, final int max, final EnumCreatureType typeOfCreature) { IForgeRegistry<Biome> biomeReg = GameRegistry.findRegistry(Biome.class); Biome[] biomes = biomeReg.getValues().toArray(new Biome[biomeReg.getValues().size()]); EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature, biomes); }
Example #30
Source File: EntityFallenMount.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
@Override public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) { if(type == EnumCreatureType.MONSTER) { return true; } return false; }