net.minecraft.entity.monster.EntityGhast Java Examples

The following examples show how to use net.minecraft.entity.monster.EntityGhast. 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: TrackingRange.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets the range an entity should be 'tracked' by players and visible in
 * the client.
 *
 * @param entity
 * @param defaultRange Default range defined by Mojang
 * @return
 */
public static int getEntityTrackingRange(Entity entity, int defaultRange) {
    SpigotWorldConfig config = entity.world.spigotConfig;
    if (entity instanceof EntityPlayer) {
        return config.playerTrackingRange;
    } else if (entity.activationType == 1) {
        return config.monsterTrackingRange;
    } else if (entity instanceof EntityGhast) {
        if (config.monsterTrackingRange > config.monsterActivationRange) {
            return config.monsterTrackingRange;
        } else {
            return config.monsterActivationRange;
        }
    } else if (entity.activationType == 2) {
        return config.animalTrackingRange;
    } else if (entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb) {
        return config.miscTrackingRange;
    } else {
        return config.otherTrackingRange;
    }
}
 
Example #2
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 #3
Source File: HackableHandler.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
public static void addDefaultEntries(){
    PneumaticRegistry.getInstance().addHackable(Blocks.tnt, HackableTNT.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.mob_spawner, HackableMobSpawner.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.lever, HackableLever.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.stone_button, HackableButton.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.wooden_button, HackableButton.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.wooden_door, HackableDoor.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.tripwire_hook, HackableTripwire.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.dispenser, HackableDispenser.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.dropper, HackableDispenser.class);
    PneumaticRegistry.getInstance().addHackable(Blockss.securityStation, HackableSecurityStation.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.monster_egg, HackableTripwire.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.noteblock, HackableNoteblock.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.jukebox, HackableJukebox.class);

    PneumaticRegistry.getInstance().addHackable(EntityCreeper.class, HackableCreeper.class);
    PneumaticRegistry.getInstance().addHackable(EntityTameable.class, HackableTameable.class);
    PneumaticRegistry.getInstance().addHackable(EntityCow.class, HackableCow.class);
    PneumaticRegistry.getInstance().addHackable(EntityCaveSpider.class, HackableCaveSpider.class);
    PneumaticRegistry.getInstance().addHackable(EntityBlaze.class, HackableBlaze.class);
    PneumaticRegistry.getInstance().addHackable(EntityGhast.class, HackableGhast.class);
    PneumaticRegistry.getInstance().addHackable(EntityWitch.class, HackableWitch.class);
    PneumaticRegistry.getInstance().addHackable(EntityLiving.class, HackableLivingDisarm.class);
    PneumaticRegistry.getInstance().addHackable(EntityEnderman.class, HackableEnderman.class);
    PneumaticRegistry.getInstance().addHackable(EntityBat.class, HackableBat.class);
}
 
Example #4
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 #5
Source File: TrackingRange.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the range an entity should be 'tracked' by players and visible in
 * the client.
 *
 * @param entity
 * @param defaultRange Default range defined by Mojang
 * @return
 */
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
    SpigotWorldConfig config = entity.worldObj.getSpigotConfig(); // Cauldron
    int range = defaultRange;
    if ( entity instanceof EntityPlayerMP )
    {
        range = config.playerTrackingRange;
    } else if ( entity.defaultActivationState || entity instanceof EntityGhast )
    {
        range = defaultRange;
    } else if ( entity.activationType == 1 )
    {
        range = config.monsterTrackingRange;
    } else if ( entity.activationType == 2 )
    {
        range = config.animalTrackingRange;
    } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb )
    {
        range = config.miscTrackingRange;
    }
    // Cauldron start - allow for 0 to disable tracking ranges
    if (range == 0)
    {
        return defaultRange;
    }
    // Cauldron end

    return Math.min( config.maxTrackingRange, range );
}
 
Example #6
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;
}
 
Example #7
Source File: CraftGhast.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftGhast(CraftServer server, EntityGhast entity) {
    super(server, entity);
}
 
Example #8
Source File: CraftGhast.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityGhast getHandle() {
    return (EntityGhast) entity;
}
 
Example #9
Source File: BlockFluidWitchwater.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
	
	if (world.isRemote)
		return;
	
	if (entity.isDead)
		return;
	
	if (entity instanceof EntitySkeleton) {
		
		EntitySkeleton skeleton = (EntitySkeleton) entity;
		if (skeleton.getSkeletonType() == SkeletonType.NORMAL) {
			skeleton.setSkeletonType(SkeletonType.WITHER);
			skeleton.setHealth(skeleton.getMaxHealth());
			
			return;
		}
	}
	
	if (entity instanceof EntityCreeper) {
		EntityCreeper creeper = (EntityCreeper) entity;
		if (!creeper.getPowered()) {
			creeper.onStruckByLightning(null);
			creeper.setHealth(creeper.getMaxHealth());
			
			return;
		}
	}
	
	if (entity instanceof EntitySpider && !(entity instanceof EntityCaveSpider)) {
		EntitySpider spider = (EntitySpider) entity;
		spider.setDead();
		
		EntityCaveSpider caveSpider = new EntityCaveSpider(world);
		caveSpider.setLocationAndAngles(spider.posX, spider.posY, spider.posZ, spider.rotationYaw, spider.rotationPitch);
		caveSpider.renderYawOffset = spider.renderYawOffset;
		caveSpider.setHealth(caveSpider.getMaxHealth());
		
		world.spawnEntity(caveSpider);
		
		return;
	}
	
	if (entity instanceof EntitySquid) {
		EntitySquid squid = (EntitySquid) entity;
		squid.setDead();
		
		EntityGhast ghast = new EntityGhast(world);
		ghast.setLocationAndAngles(squid.posX, squid.posY, squid.posZ, squid.rotationYaw, squid.rotationPitch);
		ghast.renderYawOffset = squid.renderYawOffset;
		ghast.setHealth(ghast.getMaxHealth());
		
		world.spawnEntity(ghast);
		
		return;
	}
	
	if (entity instanceof EntityAnimal) {
		((EntityAnimal) entity).onStruckByLightning(null);
		return;
	}
	
	if (entity instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer) entity;
		player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 210, 0));
		player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 210, 2));
		player.addPotionEffect(new PotionEffect(MobEffects.WITHER, 210, 0));
		player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 210, 0));
	}
}
 
Example #10
Source File: CraftGhast.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public CraftGhast(CraftServer server, net.minecraft.entity.monster.EntityGhast entity) {
    super(server, entity);
}
 
Example #11
Source File: CraftGhast.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityGhast getHandle() {
    return (EntityGhast) entity;
}
 
Example #12
Source File: HackableGhast.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean afterHackTick(Entity entity){
    ((EntityGhast)entity).attackCounter = 0;
    return true;
}