net.minecraft.entity.monster.EntitySlime Java Examples

The following examples show how to use net.minecraft.entity.monster.EntitySlime. 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: BlockSlimePlant.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void executeFullGrownEffect(World world, int x, int y, int z, Random rand){
    if(world.getBlockMetadata(x, y, z) == 14) {
        int nearbyEntityCount = world.getEntitiesWithinAABB(EntitySlime.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(SPAWN_RANGE * 2, 4.0D, SPAWN_RANGE * 2)).size();
        if(nearbyEntityCount < MAX_NEARBY_ENTITIES) {
            EntitySlime SS = new EntitySlime(world);
            double randXmotion = rand.nextDouble() - 0.5D;
            double randYmotion = 1D;// rand.nextDouble();
            double randZmotion = rand.nextDouble() - 0.5D;
            SS.setLocationAndAngles(x + 0.5D, y + 0.5D, z + 0.5D, rand.nextFloat() * 360.0F, 0.0F);
            SS.motionX = randXmotion;
            SS.motionY = randYmotion;
            SS.motionZ = randZmotion;
            world.spawnEntityInWorld(SS);
            SS.spawnExplosionParticle();
            SS.playSound("mob.newsound.chickenplop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            world.setBlockMetadataWithNotify(x, y, z, 13 - SS.getSlimeSize(), 3);
        }
    } else {
        world.setBlockMetadataWithNotify(x, y, z, 14, 2);
        world.scheduleBlockUpdate(x, y, z, this, 60);
    }
}
 
Example #2
Source File: EntityTrackHandler.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void addInfo(Entity entity, List<String> curInfo){
    switch(((EntitySlime)entity).getSlimeSize()){
        case 1:
            curInfo.add("Size: Tiny");
            return;
        case 2:
            curInfo.add("Size: Small");
            return;
        case 4:
            curInfo.add("Size: Big");
            return;
        default:
            curInfo.add("Size: " + ((EntitySlime)entity).getSlimeSize());
            return;
    }
}
 
Example #3
Source File: MoCTools.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * spawns tiny slimes
 */
public static void spawnSlimes(World worldObj, Entity entity)
{
    if (MoCreatures.isServer())
    {
        //changed so it only spawns 0 - 1 slime, as it now spaws also big slimes
        int var2 = 1 + worldObj.rand.nextInt(1);

        for (int i = 0; i < var2; ++i)
        {
            float var4 = ((float) (i % 2) - 0.5F) * (float) 1 / 4.0F;
            float var5 = ((float) (i / 2) - 0.5F) * (float) 1 / 4.0F;
            EntitySlime var6 = new EntitySlime(worldObj);
            //var6.setSlimeSize(1);  TODO FIX
            var6.setLocationAndAngles(entity.posX + (double) var4, entity.posY + 0.5D, entity.posZ + (double) var5, worldObj.rand.nextFloat() * 360.0F, 0.0F);
            worldObj.spawnEntityInWorld(var6);
        }
    }
}
 
Example #4
Source File: MoCreatures.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
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 #5
Source File: BiomeGenDeepSwamp.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
public BiomeGenDeepSwamp(int biomeId, boolean register) {
	super(new BiomeProperties("DeepSwamp").setBaseHeight(-0.1f).setHeightVariation(0.2f).setRainfall(0.9f).setTemperature(0.9f).setWaterColor(14745518));

       this.setRegistryName(new ResourceLocation("advancedrocketry:DeepSwamp"));
	
	this.decorator.treesPerChunk = 10;
       this.decorator.flowersPerChunk = 1;
       this.decorator.deadBushPerChunk = 1;
       this.decorator.mushroomsPerChunk = 8;
       this.decorator.reedsPerChunk = 10;
       this.decorator.clayPerChunk = 1;
       this.decorator.waterlilyPerChunk = 4;
       this.decorator.sandPatchesPerChunk = 0;
       this.decorator.grassPerChunk = 5;
       this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySlime.class, 1, 1, 1));
       this.flowers.clear();
       this.addFlower(Blocks.RED_FLOWER.getDefaultState(), 10);
	swampTree = new WorldGenSwampTree(2);
}
 
Example #6
Source File: ActivationRange.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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 #7
Source File: AuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {
    EntitySlime slime = new EntitySlime(world);
    NBTTagCompound data = new NBTTagCompound();
    slime.writeEntityToNBT(data);
    data.setInteger("Size", 0);
    slime.readEntityFromNBT(data);
    boolean canSpawn = setAndCheckPosition(slime, selectedBlock, world, true) && world.difficultySetting != EnumDifficulty.PEACEFUL;
    if(canSpawn) {
        ChunkCoordinates pos = new ChunkCoordinates((int) slime.posX, (int) slime.posY, (int) slime.posZ);
        pos = iterateDown(pos, world);
        slime.setPosition(pos.posX + 0.5, pos.posY, pos.posZ + 0.5);
        world.spawnEntityInWorld(slime);
    }
}
 
Example #8
Source File: EntityJoinWorld.java    From minecraft-roguelike with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void OnEntityJoinWorld(EntityJoinWorldEvent event) {
	
	World world = event.getWorld();
	if(world.isRemote) return;
	
	Entity entity = event.getEntity();
	
	// slimes do not extend EntityMob for some reason
	if(!(entity instanceof EntityMob || entity instanceof EntitySlime)){
		return;
	}
	
	EntityLiving mob = (EntityLiving) entity;
	
	Collection<?> effects = mob.getActivePotionEffects();
	for(Object buff : effects){
		if(Potion.getIdFromPotion(((PotionEffect) buff).getPotion()) == 4){
			int level = ((PotionEffect) buff).getAmplifier();
			
			IEntity metaEntity = new MetaEntity((Entity)mob);
			MonsterProfile.equip(world, world.rand, level, metaEntity);
			if(entity.isDead) event.setCanceled(true);
			return;
		}
	}
}
 
Example #9
Source File: EventHandlerPneumaticCraft.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onEntityDeath(LivingDeathEvent event){
    if(!event.entity.worldObj.isRemote) {
        if(Config.enableSlimeSeedDrop && event.entity instanceof EntitySlime && Math.random() < 0.1D) {
            ItemPlasticPlants.markInactive(event.entity.entityDropItem(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.SLIME_PLANT_DAMAGE), 0));
        } else if(Config.enableCreeperSeedDrop && event.entity instanceof EntityCreeper && Math.random() < 0.05D) {
            if(Config.enableCreeperDropExplosion) event.entity.worldObj.createExplosion(event.entity, event.entity.posX, event.entity.posY + event.entityLiving.height / 2D, event.entity.posZ, 0.5F, event.entity.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"));
            int dropAmount = (int)(Math.random() * 3D) + 1;
            for(int i = 0; i < dropAmount; i++)
                ItemPlasticPlants.markInactive(event.entity.entityDropItem(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.CREEPER_PLANT_DAMAGE), 0));
        } else if(Config.enableSquidSeedDrop && event.entity instanceof EntitySquid && Math.random() < 0.05D) {
            ItemPlasticPlants.markInactive(event.entity.entityDropItem(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.SQUID_PLANT_DAMAGE), 0));
        }
    }
}
 
Example #10
Source File: CivilizationHandlers.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
private boolean isHostileMob(EntityLivingBase victim) {
	return victim instanceof EntityMob ||
			victim instanceof EntitySlime ||
			victim instanceof EntityMagmaCube ||
			victim instanceof EntityGhast ||
			victim instanceof EntityShulker;
}
 
Example #11
Source File: BiomeLushSwamp.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
public BiomeLushSwamp() {
	super(properties);
	decorator.treesPerChunk = 2;
	decorator.flowersPerChunk = 5;
	decorator.deadBushPerChunk = 1;
	decorator.mushroomsPerChunk = 4;
	decorator.reedsPerChunk = 10;
	decorator.clayPerChunk = 1;
	decorator.waterlilyPerChunk = 4;
	decorator.sandPatchesPerChunk = 0;
	decorator.grassPerChunk = 10;

	spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySlime.class, 1, 1, 1));
}
 
Example #12
Source File: ActivationRange.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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) {
    // 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.WATER_CREATURE, false) || entity.isCreatureType(EnumCreatureType.AMBIENT, false)) {
        return 2; // Animal
        // Cauldron end
    } else {
        return 3; // Misc
    }
}
 
Example #13
Source File: BiomeLushSwamp.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BiomeLushSwamp() {
	super(properties);
	decorator.treesPerChunk = 2;
	decorator.flowersPerChunk = 5;
	decorator.deadBushPerChunk = 1;
	decorator.mushroomsPerChunk = 4;
	decorator.reedsPerChunk = 10;
	decorator.clayPerChunk = 1;
	decorator.waterlilyPerChunk = 4;
	decorator.sandPatchesPerChunk = 0;
	decorator.grassPerChunk = 10;

	spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySlime.class, 1, 1, 1));
}
 
Example #14
Source File: PlayerListener.java    From SkyblockAddons with MIT License 4 votes vote down vote up
/**
     * The main timer for the magma boss checker.
     */
    @SubscribeEvent()
    public void onClientTickMagma(TickEvent.ClientTickEvent e) {
        if (e.phase == TickEvent.Phase.START) {
            Minecraft mc = Minecraft.getMinecraft();
            if (main.getConfigValues().isEnabled(Feature.MAGMA_WARNING) && main.getUtils().isOnSkyblock()) {
                if (mc != null && mc.theWorld != null) {
                    if (magmaTick % 5 == 0) {
                        boolean foundBoss = false;
                        long currentTime = System.currentTimeMillis();
                        for (Entity entity : mc.theWorld.loadedEntityList) { // Loop through all the entities.
                            if (entity instanceof EntityMagmaCube) {
                                EntitySlime magma = (EntitySlime) entity;
                                if (magma.getSlimeSize() > 10) { // Find a big magma boss
                                    foundBoss = true;
                                    if ((lastBoss == -1 || System.currentTimeMillis() - lastBoss > 1800000)) {
                                        lastBoss = System.currentTimeMillis();
                                        main.getRenderListener().setTitleFeature(Feature.MAGMA_WARNING); // Enable warning and disable again in four seconds.
                                        magmaTick = 16; // so the sound plays instantly
                                        main.getScheduler().schedule(Scheduler.CommandType.RESET_TITLE_FEATURE, main.getConfigValues().getWarningSeconds());
//                                logServer(mc);
                                    }
                                    magmaAccuracy = EnumUtils.MagmaTimerAccuracy.SPAWNED;
                                    if (currentTime - lastBossSpawnPost > 300000) {
                                        lastBossSpawnPost = currentTime;
                                        main.getUtils().sendInventiveTalentPingRequest(EnumUtils.MagmaEvent.BOSS_SPAWN);
                                    }
                                }
                            }
                        }
                        if (!foundBoss && main.getRenderListener().getTitleFeature() == Feature.MAGMA_WARNING) {
                            main.getRenderListener().setTitleFeature(null);
                        }
                        if (!foundBoss && magmaAccuracy == EnumUtils.MagmaTimerAccuracy.SPAWNED) {
                            magmaAccuracy = EnumUtils.MagmaTimerAccuracy.ABOUT;
                            magmaTime = 7200;
                            if (currentTime - lastBossDeathPost > 300000) {
                                lastBossDeathPost = currentTime;
                                main.getUtils().sendInventiveTalentPingRequest(EnumUtils.MagmaEvent.BOSS_DEATH);
                            }
                        }
                    }
                    if (main.getRenderListener().getTitleFeature() == Feature.MAGMA_WARNING && magmaTick % 4 == 0) { // Play sound every 4 ticks or 1/5 second.
                        main.getUtils().playLoudSound("random.orb", 0.5);
                    }
                }
            }
            magmaTick++;
            if (magmaTick > 20) {
                if ((magmaAccuracy == EnumUtils.MagmaTimerAccuracy.EXACTLY || magmaAccuracy == EnumUtils.MagmaTimerAccuracy.ABOUT)
                        && magmaTime == 0) {
                    magmaAccuracy = EnumUtils.MagmaTimerAccuracy.SPAWNED_PREDICTION;
                    main.getScheduler().schedule(Scheduler.CommandType.RESET_MAGMA_PREDICTION, 20);
                }
                magmaTime--;
                magmaTick = 1;
            }
        }
    }
 
Example #15
Source File: EntityDireSlime.java    From EnderZoo with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
@Override
protected EntitySlime createInstance() {
  return new EntityDireSlime(this.world);
}
 
Example #16
Source File: EntityTrackHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isApplicable(Entity entity){
    return entity instanceof EntitySlime;
}
 
Example #17
Source File: CraftSlime.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntitySlime getHandle() {
    return (EntitySlime) entity;
}
 
Example #18
Source File: CraftSlime.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftSlime(CraftServer server, EntitySlime entity) {
    super(server, entity);
}
 
Example #19
Source File: EntityUtils.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isMob(final Entity entity) {
    return entity instanceof EntityMob || entity instanceof EntityVillager || entity instanceof EntitySlime ||
            entity instanceof EntityGhast || entity instanceof EntityDragon;
}