use of net.minecraft.entity.effect.EntityLightningBolt in project SecurityCraft by Geforce132.
the class BlockReinforcedFenceGate method onEntityIntersected.
@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);
}
use of net.minecraft.entity.effect.EntityLightningBolt in project SecurityCraft by Geforce132.
the class TileEntityProtecto method attackEntity.
@Override
public boolean attackEntity(Entity entity) {
if (entity instanceof EntityLivingBase) {
if ((entity instanceof EntityPlayer && (getOwner().isOwner((EntityPlayer) entity) || (hasModule(EnumCustomModules.WHITELIST) && ModuleUtils.getPlayersFromModule(worldObj, pos, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) entity).getName().toLowerCase())))) || entity instanceof EntityPigZombie || (entity instanceof EntityCreeper && ((EntityCreeper) entity).getPowered())) {
return false;
}
EntityLightningBolt lightning = new EntityLightningBolt(worldObj, entity.posX, entity.posY, entity.posZ, true);
worldObj.addWeatherEffect(lightning);
BlockUtils.setBlockProperty(worldObj, pos, BlockProtecto.ACTIVATED, false);
return true;
}
return false;
}
use of net.minecraft.entity.effect.EntityLightningBolt in project Realistic-Terrain-Generation by Team-RTG.
the class NecronomiconCreationRitual method completeRitualServer.
@Override
protected void completeRitualServer(World world, BlockPos pos, EntityPlayer player) {
world.addWeatherEffect(new EntityLightningBolt(world, pos.getX(), pos.getY() + 1, pos.getZ(), false));
TileEntity altar = world.getTileEntity(pos);
NBTTagCompound compound = new NBTTagCompound();
NBTTagCompound newItem = new NBTTagCompound();
altar.writeToNBT(compound);
NBTTagCompound nbtItem = compound.getCompoundTag("Item");
if (ItemStack.loadItemStackFromNBT(nbtItem) == null || !ItemStack.loadItemStackFromNBT(nbtItem).isItemEqual(item)) {
item.writeToNBT(newItem);
compound.setTag("Item", newItem);
}
altar.readFromNBT(compound);
}
Aggregations