Search in sources :

Example 16 with EntityFallingBlock

use of net.minecraft.entity.item.EntityFallingBlock in project Railcraft by Railcraft.

the class CrushedObsidian method tryToFall.

/**
 * If there is space to fall below will start this block falling
 */
private void tryToFall(World world, BlockPos pos) {
    if (canFallInto(world, pos.down()) && pos.getY() >= 0) {
        byte size = 32;
        if (!BlockSand.fallInstantly && WorldPlugin.isAreaLoaded(world, pos.add(-size, -size, -size), pos.add(size, size, size))) {
            if (!world.isRemote) {
                EntityFallingBlock entity = new EntityFallingBlock(world, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, world.getBlockState(pos));
                world.spawnEntity(entity);
            }
        } else {
            WorldPlugin.setBlockToAir(world, pos);
            BlockPos blockPos;
            for (blockPos = pos.down(); canFallInto(world, blockPos) && blockPos.getY() > 0; blockPos = blockPos.down()) {
            // NOOP
            }
            if (blockPos.getY() > 0)
                WorldPlugin.setBlockState(world, blockPos.up(), BlockGeneric.getBlock().getDefaultState().withProperty(BlockGeneric.getBlock().getVariantEnumProperty(), EnumGeneric.CRUSHED_OBSIDIAN));
        }
    }
}
Also used : EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) BlockPos(net.minecraft.util.math.BlockPos)

Example 17 with EntityFallingBlock

use of net.minecraft.entity.item.EntityFallingBlock in project BloodMagic by WayofTime.

the class MeleeDefaultEarth method onCenteredWorldEffect.

@Override
public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) {
    int radius = this.potencyUpgrades;
    for (int i = -radius; i <= radius; i++) {
        for (int j = -radius; j <= radius; j++) {
            for (int k = -radius; k <= radius; k++) {
                if (!world.isAirBlock(posX + i, posY + j, posZ + k) && world.getTileEntity(posX + i, posY + j, posZ + k) == null) {
                    Block block = world.getBlock(posX + i, posY + j, posZ + k);
                    if (block.getBlockHardness(world, posX + i, posY + j, posZ + k) == -1) {
                        continue;
                    }
                    int meta = world.getBlockMetadata(posX + i, posY + j, posZ + k);
                    EntityFallingBlock entity = new EntityFallingBlock(world, posX + i + 0.5f, posY + j + 0.5f, posZ + k + 0.5f, block, meta);
                    world.spawnEntityInWorld(entity);
                }
            }
        }
    }
}
Also used : EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) Block(net.minecraft.block.Block) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock)

Aggregations

EntityFallingBlock (net.minecraft.entity.item.EntityFallingBlock)17 BlockPos (net.minecraft.util.math.BlockPos)8 Block (net.minecraft.block.Block)4 EntityArmorStand (net.minecraft.entity.item.EntityArmorStand)4 IBlockState (net.minecraft.block.state.IBlockState)3 Entity (net.minecraft.entity.Entity)3 EntityBoat (net.minecraft.entity.item.EntityBoat)3 EntityPig (net.minecraft.entity.passive.EntityPig)3 World (net.minecraft.world.World)3 EntityLivingBase (net.minecraft.entity.EntityLivingBase)2 EntityItem (net.minecraft.entity.item.EntityItem)2 ItemStack (net.minecraft.item.ItemStack)2 TileEntity (org.spongepowered.api.block.tileentity.TileEntity)2 Entity (org.spongepowered.api.entity.Entity)2 IMixinTileEntity (org.spongepowered.common.interfaces.block.tile.IMixinTileEntity)2 IMixinEntity (org.spongepowered.common.interfaces.entity.IMixinEntity)2 EntityMountable (org.valkyrienskies.mod.common.entity.EntityMountable)2 Vector (ValkyrienWarfareBase.API.Vector)1 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)1 EntityMountingWeaponBase (ValkyrienWarfareCombat.Entity.EntityMountingWeaponBase)1