本文整理汇总了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);
}
示例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
}
示例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);
}
示例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
}
示例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
}
示例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
}
示例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());
}
}
示例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
}
示例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));
}
}