當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityCreeper.onStruckByLightning方法代碼示例

本文整理匯總了Java中net.minecraft.entity.monster.EntityCreeper.onStruckByLightning方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityCreeper.onStruckByLightning方法的具體用法?Java EntityCreeper.onStruckByLightning怎麽用?Java EntityCreeper.onStruckByLightning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.monster.EntityCreeper的用法示例。


在下文中一共展示了EntityCreeper.onStruckByLightning方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onEntityIntersected

import net.minecraft.entity.monster.EntityCreeper; //導入方法依賴的package包/類
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
	if(BlockUtils.getBlockPropertyAsBoolean(world, pos, OPEN))
		return;

	if(entity instanceof EntityItem)
		return;
	else if(entity instanceof EntityPlayer)
	{
		EntityPlayer player = (EntityPlayer)entity;

		if(((TileEntityOwnable)world.getTileEntity(pos)).getOwner().isOwner(player))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ(), true);

		creeper.onStruckByLightning(lightning);
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F);
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:26,代碼來源:BlockReinforcedFenceGate.java

示例2: onEntityIntersected

import net.minecraft.entity.monster.EntityCreeper; //導入方法依賴的package包/類
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity)
{
	//so dropped items don't get destroyed
	if(entity instanceof EntityItem)
		return;
	//owner check
	else if(entity instanceof EntityPlayer)
	{
		if(((TileEntityOwnable) world.getTileEntity(pos)).getOwner().isOwner((EntityPlayer)entity))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ(), true);

		creeper.onStruckByLightning(lightning);
		creeper.extinguish();
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F); //3 hearts per attack
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:25,代碼來源:BlockIronFence.java

示例3: onEntityIntersected

import net.minecraft.entity.monster.EntityCreeper; //導入方法依賴的package包/類
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
	if(BlockUtils.getBlockPropertyAsBoolean(world, pos, OPEN))
		return;

	if(entity instanceof EntityItem)
		return;
	else if(entity instanceof EntityPlayer)
	{
		EntityPlayer player = (EntityPlayer)entity;

		if(((TileEntityOwnable)world.getTileEntity(pos)).getOwner().isOwner(player))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ());

		creeper.onStruckByLightning(lightning);
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F);
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:26,代碼來源:BlockReinforcedFenceGate.java

示例4: onEntityIntersected

import net.minecraft.entity.monster.EntityCreeper; //導入方法依賴的package包/類
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity)
{
	//so dropped items don't get destroyed
	if(entity instanceof EntityItem)
		return;
	//owner check
	else if(entity instanceof EntityPlayer)
	{
		if(((IOwnable) world.getTileEntity(pos)).getOwner().isOwner((EntityPlayer)entity))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ());

		creeper.onStruckByLightning(lightning);
		creeper.extinguish();
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F); //3 hearts per attack
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:25,代碼來源:BlockIronFence.java

示例5: onEntityIntersected

import net.minecraft.entity.monster.EntityCreeper; //導入方法依賴的package包/類
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity)
{
	//so dropped items don't get destroyed
	if(entity instanceof EntityItem)
		return;
	//owner check
	else if(entity instanceof EntityPlayer)
	{
		if(((TileEntityOwnable) world.getTileEntity(pos)).getOwner().isOwner((EntityPlayer)entity))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ());

		creeper.onStruckByLightning(lightning);
		creeper.extinguish();
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F); //3 hearts per attack
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:25,代碼來源:BlockIronFence.java

示例6: onEntityCollidedWithBlock

import net.minecraft.entity.monster.EntityCreeper; //導入方法依賴的package包/類
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
	//so dropped items don't get destroyed
	if(entity instanceof EntityItem)
		return;
	//owner check
	else if(entity instanceof EntityPlayer)
	{
		if(((TileEntityOwnable) world.getTileEntity(x, y, z)).getOwner().isOwner((EntityPlayer)entity))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, x, y, z);

		creeper.onStruckByLightning(lightning);
		creeper.extinguish();
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F); //3 hearts per attack
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:25,代碼來源:BlockIronFence.java

示例7: handleSpawnEvent

import net.minecraft.entity.monster.EntityCreeper; //導入方法依賴的package包/類
@Override
public void handleSpawnEvent(int numInstances, EntityLiving entity) {
    if (entity instanceof EntityCreeper) {
        EntityCreeper creeper = (EntityCreeper) entity;
        //this avoids our creepers being on fire when they spawn
        creeper.setFire(0);
        creeper.onStruckByLightning(null);
        entity.setHealth(entity.getMaxHealth());
    }
}
 
開發者ID:talandar,項目名稱:ProgressiveDifficulty,代碼行數:11,代碼來源:CreeperChargeModifier.java

示例8: onEntityCollidedWithBlock

import net.minecraft.entity.monster.EntityCreeper; //導入方法依賴的package包/類
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
	if(world.getBlockMetadata(x, y, z) > 3)
		return;

	//so dropped items don't get destroyed
	if(entity instanceof EntityItem)
		return;
	//owner check
	else if(entity instanceof EntityPlayer)
	{
		if(((TileEntityOwnable) world.getTileEntity(x, y, z)).getOwner().isOwner((EntityPlayer)entity))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, x, y, z);

		creeper.onStruckByLightning(lightning);
		creeper.extinguish();
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F); //3 hearts per attack
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:28,代碼來源:BlockReinforcedFenceGate.java

示例9: onEntityCollidedWithBlock

import net.minecraft.entity.monster.EntityCreeper; //導入方法依賴的package包/類
@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));
	}
}
 
開發者ID:MikeLydeamore,項目名稱:ExNihiloAdscensio,代碼行數:72,代碼來源:BlockFluidWitchwater.java


注:本文中的net.minecraft.entity.monster.EntityCreeper.onStruckByLightning方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。