Java 类net.minecraft.entity.item.EntityFallingBlock 实例源码

项目:ExPetrum    文件:GravityHelper.java   
private static void fall(IBlockState fallingBlock, World w, BlockPos pos)
{
    try
    {
        if (newGravFallingBlock == null)
        {
            Class<?> clazz = Class.forName("v0id.exp.entity.EntityGravFallingBlock");
            newGravFallingBlock = clazz.getDeclaredConstructor(World.class, double.class, double.class, double.class, IBlockState.class);
        }

        EntityFallingBlock efb = (EntityFallingBlock) newGravFallingBlock.newInstance(w, (double)pos.getX() + 0.5d, (double)pos.getY(), (double)pos.getZ() + 0.5d, fallingBlock);
        if (!w.isRemote)
        {
            w.setBlockToAir(pos);
            w.spawnEntity(efb);
        }
    }
    catch (Exception ex)
    {
        ExPApi.apiLogger.log(LogLevel.Fatal, "Api could not reflect %s! Is the core mod ExPetrum installed?", ex, "v0id.exp.entity.EntityGravFallingBlock.<init>!");
    }
}
项目:BetterWithAddons    文件:FallingPlatformHandler.java   
private void dropPlatform(World world, BlockPos pos) {
    BlockPos anchorpos = pos.down();
    IBlockState blockstate = world.getBlockState(anchorpos);
    Block block = blockstate.getBlock();

    if (!world.isRemote && block == BWMBlocks.ANCHOR && !isAnchorSupported(world, anchorpos)) {
        EnumFacing facing = blockstate.getValue(DirUtils.FACING);

        HashSet<BlockPos> platformBlocks = new HashSet<>();
        boolean success = findPlatformPart(world,anchorpos,platformBlocks);
        if(success)
            for (BlockPos plat : platformBlocks) {
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double)plat.getX() + 0.5D, (double)plat.getY(), (double)plat.getZ() + 0.5D, world.getBlockState(plat));
                entityfallingblock.setHurtEntities(true);
                world.spawnEntity(entityfallingblock);
            }
    }
}
项目:Factorization    文件:BlowEntities.java   
@Override
public boolean apply(Entity entity) {
    if (entity instanceof EntityItem) {
        return true;
    }
    if (target_speed <= 1) {
        return false;
    }
    if (entity instanceof EntityLiving || entity instanceof IProjectile || entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock) {
        return true;
    }
    if (FzConfig.fanturpeller_works_on_players && entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        found_player = true;
        return !player.capabilities.isCreativeMode && !player.isSneaking();
    }
    return false;
    // Falling sand doesn't work too well with this
    // Minecarts seem to just jump back down (and would be too heavy anyways.)
    // Let's try to keep this method light, hmm?
}
项目:Alagaesias-Ancient-Language    文件:WordAction.java   
@Override
public void onUse(MagicData energy, Map<String, String> modData, List<?> selectors) {
    int fatigue = 0;
    for (Object obj : selectors) {
        if (obj instanceof BlockPosHit && energy.getActualUser() instanceof Entity) {
            fatigue++;
            BlockPosHit pos = (BlockPosHit) obj;
            World world = ((Entity) energy.getActualUser()).worldObj;
            VersionUtils.setAir(world, pos);
            EntityFallingBlock blockEntity = new EntityFallingBlock(world, pos.getIX() + 0.5,
                    pos.getIY() + 0.5, pos.getIZ() + 0.5, world.getBlockState(pos.getBlockPos()));
            world.spawnEntityInWorld(blockEntity);
            blockEntity.setVelocity(0, 100, 0);
            // Causes blocks to fly upwards
        }
        if(obj instanceof Entity) {
            fatigue++;
            ((Entity)obj).addVelocity(0, 100, 0);
        }
    }
    energy.performMagic(fatigue * 0.2f); // 5 fatigue = 100% energy request
}
项目:qcraft-mod    文件:BlockQBlock.java   
@Override
protected void func_149829_a( EntityFallingBlock entityFallingSand ) // onStartFalling
{
    // Setup NBT for block to place
    World world = entityFallingSand.worldObj;
    int x = (int) ( entityFallingSand.posX - 0.5f );
    int y = (int) ( entityFallingSand.posY - 0.5f );
    int z = (int) ( entityFallingSand.posZ - 0.5f );
    TileEntity entity = world.getTileEntity( x, y, z );
    if( entity != null && entity instanceof TileEntityQBlock )
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        entity.writeToNBT( nbttagcompound );
        entityFallingSand.field_145810_d = nbttagcompound; // data
    }

    // Prevent the falling qBlock from dropping items
    entityFallingSand.field_145813_c = false; // dropItems
}
项目:vintagecraft    文件:BlockSandVC.java   
private void tryToFall(World world, BlockPos pos) {
    IBlockState blockstate = world.getBlockState(pos);

    if(!world.isRemote) {

        if (canFallBelow(world, pos.down()) && pos.getY() >= 0) {
            if (!fallInstantly && world.isAreaLoaded(pos.add(-32, -32, -32), pos.add(32, 32, 32))) {
                EntityFallingBlock ent = new EntityFallingBlock(world, (double)(pos.getX() + 0.5F), (double)(pos.getY() + 0.5F), (double)(pos.getZ()+ 0.5F), blockstate);
                world.spawnEntityInWorld(ent);
                world.playSoundAtEntity(ent, Block.soundTypeSand.soundName, 1.0F, 0.8F);

            } else {
                world.setBlockToAir(pos);
                while (canFallBelow(world, pos = pos.down()) && pos.getY() > 0) { }
                if (pos.getY() > 0) {
                    world.destroyBlock(pos, true);
                    world.setBlockState(pos, blockstate, 2);
                }
            }
        }
    }
}
项目:IceAndShadow2    文件:IaSBlockFalling.java   
/**
 * If there is space to fall below will start this block falling
 */
private void tryToFall(World par1World, int par2, int par3, int par4) {
    if (IaSBlockFalling.canFallBelow(par1World, par2, par3 - 1, par4) && par3 >= 0) {
        final byte b0 = 32;

        if (!IaSBlockFalling.fallInstantly
                && par1World.checkChunksExist(par2 - b0, par3 - b0, par4 - b0, par2 + b0, par3 + b0, par4 + b0)) {
            if (!par1World.isRemote) {
                final EntityFallingBlock entityfallingsand = new EntityFallingBlock(par1World, par2 + 0.5F,
                        par3 + 0.5F, par4 + 0.5F, this, par1World.getBlockMetadata(par2, par3, par4));
                onStartFalling(entityfallingsand);
                par1World.spawnEntityInWorld(entityfallingsand);
            }
        } else {
            par1World.setBlockToAir(par2, par3, par4);

            while (IaSBlockFalling.canFallBelow(par1World, par2, par3 - 1, par4) && par3 > 0) {
                --par3;
            }

            if (par3 > 0) {
                par1World.setBlock(par2, par3, par4, this);
            }
        }
    }
}
项目:iChunUtil    文件:WorldPortal.java   
public void handleSpecialEntities(Entity ent)
{
    if(ent instanceof EntityBlock)
    {
        ((EntityBlock)ent).timeExisting = 2;
    }
    else if(ent instanceof EntityFallingBlock)
    {
        ((EntityFallingBlock)ent).fallTime = 2;
    }
    else if(ent instanceof EntityFireball)
    {
        EntityFireball fireball = (EntityFireball)ent;
        float[] appliedAcceleration = getQuaternionFormula().applyPositionalRotation(new float[] { (float)fireball.accelerationX, (float)fireball.accelerationY, (float)fireball.accelerationZ });
        fireball.accelerationX = appliedAcceleration[0];
        fireball.accelerationY = appliedAcceleration[1];
        fireball.accelerationZ = appliedAcceleration[2];
    }
    else if(ent instanceof EntityArrow)
    {
        ((EntityArrow)ent).inGround = false;
    }
}
项目:DecompiledMinecraft    文件:BlockDragonEgg.java   
private void checkFall(World worldIn, BlockPos pos)
{
    if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
    {
        int i = 32;

        if (!BlockFalling.fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
        {
            worldIn.spawnEntityInWorld(new EntityFallingBlock(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), this.getDefaultState()));
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos; BlockFalling.canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos, this.getDefaultState(), 2);
            }
        }
    }
}
项目:DecompiledMinecraft    文件:BlockFalling.java   
private void checkFallable(World worldIn, BlockPos pos)
{
    if (canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
    {
        int i = 32;

        if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
        {
            if (!worldIn.isRemote)
            {
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos));
                this.onStartFalling(entityfallingblock);
                worldIn.spawnEntityInWorld(entityfallingblock);
            }
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos.down(); canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos.up(), this.getDefaultState());
            }
        }
    }
}
项目:DecompiledMinecraft    文件:BlockDragonEgg.java   
private void checkFall(World worldIn, BlockPos pos)
{
    if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
    {
        int i = 32;

        if (!BlockFalling.fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
        {
            worldIn.spawnEntityInWorld(new EntityFallingBlock(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), this.getDefaultState()));
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos; BlockFalling.canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos, this.getDefaultState(), 2);
            }
        }
    }
}
项目:DecompiledMinecraft    文件:BlockFalling.java   
private void checkFallable(World worldIn, BlockPos pos)
{
    if (canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
    {
        int i = 32;

        if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
        {
            if (!worldIn.isRemote)
            {
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos));
                this.onStartFalling(entityfallingblock);
                worldIn.spawnEntityInWorld(entityfallingblock);
            }
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos.down(); canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos.up(), this.getDefaultState());
            }
        }
    }
}
项目:DecompiledMinecraft    文件:RenderFallingBlock.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doe
 */
public void doRender(EntityFallingBlock entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    if (entity.getBlock() != null)
    {
        this.bindTexture(TextureMap.locationBlocksTexture);
        IBlockState iblockstate = entity.getBlock();
        Block block = iblockstate.getBlock();
        BlockPos blockpos = new BlockPos(entity);
        World world = entity.getWorldObj();

        if (iblockstate != world.getBlockState(blockpos) && block.getRenderType() != -1)
        {
            if (block.getRenderType() == 3)
            {
                GlStateManager.pushMatrix();
                GlStateManager.translate((float)x, (float)y, (float)z);
                GlStateManager.disableLighting();
                Tessellator tessellator = Tessellator.getInstance();
                WorldRenderer worldrenderer = tessellator.getWorldRenderer();
                worldrenderer.begin(7, DefaultVertexFormats.BLOCK);
                int i = blockpos.getX();
                int j = blockpos.getY();
                int k = blockpos.getZ();
                worldrenderer.setTranslation((double)((float)(-i) - 0.5F), (double)(-j), (double)((float)(-k) - 0.5F));
                BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
                IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, (BlockPos)null);
                blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, false);
                worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
                tessellator.draw();
                GlStateManager.enableLighting();
                GlStateManager.popMatrix();
                super.doRender(entity, x, y, z, entityYaw, partialTicks);
            }
        }
    }
}
项目:BaseClient    文件:BlockDragonEgg.java   
private void checkFall(World worldIn, BlockPos pos)
{
    if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
    {
        int i = 32;

        if (!BlockFalling.fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
        {
            worldIn.spawnEntityInWorld(new EntityFallingBlock(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), this.getDefaultState()));
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos; BlockFalling.canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos, this.getDefaultState(), 2);
            }
        }
    }
}
项目:BaseClient    文件:BlockFalling.java   
private void checkFallable(World worldIn, BlockPos pos)
{
    if (canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
    {
        int i = 32;

        if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
        {
            if (!worldIn.isRemote)
            {
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos));
                this.onStartFalling(entityfallingblock);
                worldIn.spawnEntityInWorld(entityfallingblock);
            }
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos.down(); canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos.up(), this.getDefaultState());
            }
        }
    }
}
项目:BaseClient    文件:RenderFallingBlock.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doe
 */
public void doRender(EntityFallingBlock entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    if (entity.getBlock() != null)
    {
        this.bindTexture(TextureMap.locationBlocksTexture);
        IBlockState iblockstate = entity.getBlock();
        Block block = iblockstate.getBlock();
        BlockPos blockpos = new BlockPos(entity);
        World world = entity.getWorldObj();

        if (iblockstate != world.getBlockState(blockpos) && block.getRenderType() != -1)
        {
            if (block.getRenderType() == 3)
            {
                GlStateManager.pushMatrix();
                GlStateManager.translate((float)x, (float)y, (float)z);
                GlStateManager.disableLighting();
                Tessellator tessellator = Tessellator.getInstance();
                WorldRenderer worldrenderer = tessellator.getWorldRenderer();
                worldrenderer.begin(7, DefaultVertexFormats.BLOCK);
                int i = blockpos.getX();
                int j = blockpos.getY();
                int k = blockpos.getZ();
                worldrenderer.setTranslation((double)((float)(-i) - 0.5F), (double)(-j), (double)((float)(-k) - 0.5F));
                BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
                IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, (BlockPos)null);
                blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, false);
                worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
                tessellator.draw();
                GlStateManager.enableLighting();
                GlStateManager.popMatrix();
                super.doRender(entity, x, y, z, entityYaw, partialTicks);
            }
        }
    }
}
项目:BaseClient    文件:BlockDragonEgg.java   
private void checkFall(World worldIn, BlockPos pos)
{
    if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
    {
        int i = 32;

        if (!BlockFalling.fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
        {
            worldIn.spawnEntityInWorld(new EntityFallingBlock(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), this.getDefaultState()));
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos; BlockFalling.canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos, this.getDefaultState(), 2);
            }
        }
    }
}
项目:BaseClient    文件:BlockFalling.java   
private void checkFallable(World worldIn, BlockPos pos)
{
    if (canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
    {
        int i = 32;

        if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
        {
            if (!worldIn.isRemote)
            {
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos));
                this.onStartFalling(entityfallingblock);
                worldIn.spawnEntityInWorld(entityfallingblock);
            }
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos.down(); canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos.up(), this.getDefaultState());
            }
        }
    }
}
项目:BaseClient    文件:RenderFallingBlock.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doe
 */
public void doRender(EntityFallingBlock entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    if (entity.getBlock() != null)
    {
        this.bindTexture(TextureMap.locationBlocksTexture);
        IBlockState iblockstate = entity.getBlock();
        Block block = iblockstate.getBlock();
        BlockPos blockpos = new BlockPos(entity);
        World world = entity.getWorldObj();

        if (iblockstate != world.getBlockState(blockpos) && block.getRenderType() != -1)
        {
            if (block.getRenderType() == 3)
            {
                GlStateManager.pushMatrix();
                GlStateManager.translate((float)x, (float)y, (float)z);
                GlStateManager.disableLighting();
                Tessellator tessellator = Tessellator.getInstance();
                WorldRenderer worldrenderer = tessellator.getWorldRenderer();
                worldrenderer.begin(7, DefaultVertexFormats.BLOCK);
                int i = blockpos.getX();
                int j = blockpos.getY();
                int k = blockpos.getZ();
                worldrenderer.setTranslation((double)((float)(-i) - 0.5F), (double)(-j), (double)((float)(-k) - 0.5F));
                BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
                IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, (BlockPos)null);
                blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, false);
                worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
                tessellator.draw();
                GlStateManager.enableLighting();
                GlStateManager.popMatrix();
                super.doRender(entity, x, y, z, entityYaw, partialTicks);
            }
        }
    }
}
项目:uniquecrops    文件:UCEventHandlerServer.java   
@SubscribeEvent
public void onBlockFall(EntityJoinWorldEvent event) {

    if (event.getEntity() != null && event.getEntity() instanceof EntityFallingBlock) {
        EntityPlayer player = event.getEntity().worldObj.getClosestPlayerToEntity(event.getEntity(), range);
        if (player != null && player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() == UCItems.precisionShovel) {
            if (NBTUtils.getInt(player.getHeldItemMainhand(), ItemGeneric.TAG_UPGRADE, -1) == 10)
                event.setCanceled(true);
        }
    }
}
项目:Backmemed    文件:BlockDragonEgg.java   
private void checkFall(World worldIn, BlockPos pos)
{
    if (BlockFalling.canFallThrough(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
    {
        int i = 32;

        if (!BlockFalling.fallInstantly && worldIn.isAreaLoaded(pos.add(-32, -32, -32), pos.add(32, 32, 32)))
        {
            worldIn.spawnEntityInWorld(new EntityFallingBlock(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), this.getDefaultState()));
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos; BlockFalling.canFallThrough(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos, this.getDefaultState(), 2);
            }
        }
    }
}
项目:Backmemed    文件:BlockFalling.java   
private void checkFallable(World worldIn, BlockPos pos)
{
    if (canFallThrough(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
    {
        int i = 32;

        if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-32, -32, -32), pos.add(32, 32, 32)))
        {
            if (!worldIn.isRemote)
            {
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos));
                this.onStartFalling(entityfallingblock);
                worldIn.spawnEntityInWorld(entityfallingblock);
            }
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos.down(); canFallThrough(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos.up(), this.getDefaultState());
            }
        }
    }
}
项目:CustomWorldGen    文件:BlockDragonEgg.java   
private void checkFall(World worldIn, BlockPos pos)
{
    if (worldIn.isAirBlock(pos.down()) && BlockFalling.canFallThrough(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
    {
        int i = 32;

        if (!BlockFalling.fallInstantly && worldIn.isAreaLoaded(pos.add(-32, -32, -32), pos.add(32, 32, 32)))
        {
            worldIn.spawnEntityInWorld(new EntityFallingBlock(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), this.getDefaultState()));
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos; worldIn.isAirBlock(blockpos) && BlockFalling.canFallThrough(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos, this.getDefaultState(), 2);
            }
        }
    }
}
项目:CustomWorldGen    文件:BlockFalling.java   
private void checkFallable(World worldIn, BlockPos pos)
{
    if ((worldIn.isAirBlock(pos.down()) || canFallThrough(worldIn.getBlockState(pos.down()))) && pos.getY() >= 0)
    {
        int i = 32;

        if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-32, -32, -32), pos.add(32, 32, 32)))
        {
            if (!worldIn.isRemote)
            {
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos));
                this.onStartFalling(entityfallingblock);
                worldIn.spawnEntityInWorld(entityfallingblock);
            }
        }
        else
        {
            IBlockState state = worldIn.getBlockState(pos);
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos.down(); (worldIn.isAirBlock(blockpos) || canFallThrough(worldIn.getBlockState(blockpos))) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos.up(), state); //Forge: Fix loss of state information during world gen.
            }
        }
    }
}
项目:BetterWithAddons    文件:BlockChandelier.java   
public void checkAndDrop(World worldIn, BlockPos pos)
{
    if (!worldIn.isRemote && !canBlockStay(worldIn, pos) && worldIn.isAreaLoaded(pos.add(-32, -32, -32), pos.add(32, 32, 32)))
    {
        EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos));
        entityfallingblock.shouldDropItem = true;
        entityfallingblock.setHurtEntities(true);
        worldIn.spawnEntity(entityfallingblock);
    }
}
项目:runesofwizardry-classics    文件:RuneLockedTime.java   
@SubscribeEvent
public void onEntityCreation(EntityJoinWorldEvent event){
    if(Config.lockedTimeFalling && (event.getEntity() instanceof EntityFallingBlock)){
        if(LockedTimeData.get(event.getWorld()).getNumRunes()>0){
            EntityFallingBlock fb = (EntityFallingBlock)event.getEntity();
            IBlockState state = fb.getBlock();
            fb.setDead();
            event.getWorld().setBlockState(fb.getPosition(), state);
            event.setCanceled(true);
        }
    }
}
项目:MidgarCrusade    文件:FieldDestruction_4.java   
public static void playEffect(double x, double y, double z)
{
    System.out.println("Land");
    EntityPlayer sender;
    World world;
    int X;
    int Y;
    int Z;

    sender = player.getPlayer();
    world = sender.worldObj;
    for (int i = 0; i < 8; i++)
    {
        for (int j = 0; j < 8; j++)
        {
            EntityFallingBlock e;
            Block block;

            X = (int) x - 4 + i;
            Z = (int) z - 4 + j;
            Y = getTopBlock(world, X, Z);
            block = world.getBlock(X, Y, Z);
            e = new EntityFallingBlockM(world, X, Y + 5, Z, block);
            world.spawnEntityInWorld(e);
        }
    }
}
项目:MidgarCrusade    文件:Airblast.java   
public static void playEffect(double x, double y, double z)
{
    System.out.println("Land");
    EntityPlayer sender;
    World world;
    int X;
    int Y;
    int Z;

    sender = player.getPlayer();
    world = sender.worldObj;
    for (int i = 0; i < 8; i++)
    {
        for (int j = 0; j < 8; j++)
        {
            EntityFallingBlock e;
            Block block;

            X = (int) x - 4 + i;
            Z = (int) z - 4 + j;
            Y = getTopBlock(world, X, Z);
            block = world.getBlock(X, Y, Z);
            e = new EntityFallingBlockM(world, X, Y + 5, Z, block);
            world.spawnEntityInWorld(e);
        }
    }
}
项目:geomastery    文件:BlockRubble.java   
/** Makes the block fall if needed. */
private void tryFall(World world, BlockPos pos) {

    if (world.isRemote) {

        return;
    }

    if (canFallThrough(world, pos.down())) {

        if (!BlockFalling.fallInstantly && world
                .isAreaLoaded(pos.add(-32,-32,-32), pos.add(32,32,32))) {

                EntityFallingBlock fall = new EntityFallingBlock(world,
                        pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D,
                        world.getBlockState(pos));
                world.spawnEntity(fall);

        } else {

            IBlockState current = world.getBlockState(pos);
            world.setBlockToAir(pos);
            BlockPos check;

            for (check = pos.down(); canFallThrough(world, check) &&
                    check.getY() > 0; check = check.down()) {
                ;
            }

            if (check.getY() > 0) {

                world.setBlockState(check.up(), current);
            }
        }
    }
}
项目:Thermos    文件:ActivationRange.java   
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
项目:TechStack-s-HeavyMachineryMod    文件:BlockMachineModFalling.java   
private void fall(World world, int x, int y, int z) {
    if (canFallMore(world, x, y, z) && y >= 0) {
        byte b0 = 32;

        BlockPos pos = new BlockPos(x, y, z);
        if (!fallInstantly && world.isAreaLoaded(pos.add(-b0, -b0, -b0), pos.add(b0, b0, b0))) {
            if (!world.isRemote) {

                // LogHelper.info("X:" + this.motionX + " Y:" + this.motionY
                // + " Z:"+ this.motionZ);
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), world.getBlockState(pos));
                // TS removed
                // this.func_149829_a(entityfallingblock);

                entityfallingblock.motionX += this.motionX;
                entityfallingblock.motionY += this.motionY;
                entityfallingblock.motionZ += this.motionZ;

                // world.setBlockToAir(x, y, z);

                world.spawnEntity(entityfallingblock);
            }
        } else {

            BlockPos bp = new BlockPos(x, y, z);
            IBlockState tmpBS = world.getBlockState(bp);
            world.setBlockToAir(bp);

            while (canFallMore(world, x, y - 1, z) && y > 0) {
                --y;
            }

            if (y > 0) {
                bp = new BlockPos(x, y, z);

                world.setBlockState(bp, tmpBS);
            }
        }
    }
}
项目:FFoKC    文件:ActivationRange.java   
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity.getClass().equals(EntityPlayer.class) && !(entity.getClass().equals(FakePlayer.class))) // Cauldron
            || entity.getClass().equals(EntityThrowable.class)
            || entity.getClass().equals(EntityDragon.class)
            || entity.getClass().equals(EntityDragonPart.class)
            || entity.getClass().equals(EntityWither.class)
            || entity.getClass().equals(EntityFireball.class)
            || entity.getClass().equals(EntityWeatherEffect.class)
            || entity.getClass().equals(EntityTNTPrimed.class)
            || entity.getClass().equals(EntityFallingBlock.class)
            || entity.getClass().equals(EntityEnderCrystal.class)
            || entity.getClass().equals(EntityFireworkRocket.class)
            || entity.getClass().equals(EntityVillager.class)
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
项目:Wars-Mod    文件:ItemAdminWandWater.java   
@Override
   public ActionResult<ItemStack> onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) {
    if (!world.isRemote) {
        Vec3d look = entityplayer.getLookVec();
        EntityFallingBlock fallingBlock = new EntityFallingBlock(world, 1, 1, 1, Blocks.WATER.getDefaultState());
        fallingBlock.setPosition(entityplayer.posX + look.xCoord * 0, entityplayer.posY + look.yCoord * 0, entityplayer.posZ + look.zCoord * 0);
        fallingBlock.lastTickPosX = look.xCoord * 0.1;
        fallingBlock.lastTickPosY = look.yCoord * 0.1;
        fallingBlock.lastTickPosZ = look.zCoord * 0.1;
        fallingBlock.fallTime = 1;
        world.spawnEntityInWorld(fallingBlock);
    }
    return new ActionResult(EnumActionResult.PASS, itemstack);
}
项目:Wars-Mod    文件:ItemAdminWandWeb.java   
@Override
   public ActionResult<ItemStack> onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) {
    if (!world.isRemote) {
        Vec3d look = entityplayer.getLookVec();
        EntityFallingBlock fallingBlock = new EntityFallingBlock(world, 1, 1, 1, Blocks.WEB.getDefaultState());
        fallingBlock.setPosition(entityplayer.posX + look.xCoord * 0, entityplayer.posY + look.yCoord * 0, entityplayer.posZ + look.zCoord * 0);
        fallingBlock.lastTickPosX = look.xCoord * 0.1;
        fallingBlock.lastTickPosY = look.yCoord * 0.1;
        fallingBlock.lastTickPosZ = look.zCoord * 0.1;
        fallingBlock.fallTime = 1;
        world.spawnEntityInWorld(fallingBlock);
    }
    return new ActionResult(EnumActionResult.PASS, itemstack);
}
项目:Wars-Mod    文件:ItemAdminWandLava.java   
@Override
   public ActionResult<ItemStack> onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) {
    if (!world.isRemote) {
        Vec3d look = entityplayer.getLookVec();
        EntityFallingBlock fallingBlock = new EntityFallingBlock(world, 1, 1, 1, Blocks.LAVA.getDefaultState());
        fallingBlock.setPosition(entityplayer.posX + look.xCoord * 0, entityplayer.posY + look.yCoord * 0, entityplayer.posZ + look.zCoord * 0);
        fallingBlock.lastTickPosX = look.xCoord * 0.1;
        fallingBlock.lastTickPosY = look.yCoord * 0.1;
        fallingBlock.lastTickPosZ = look.zCoord * 0.1;
        fallingBlock.fallTime = 1;
        world.spawnEntityInWorld(fallingBlock);
    }
    return new ActionResult(EnumActionResult.PASS, itemstack);
}
项目:Wars-Mod    文件:ItemAdminWandStone.java   
@Override
   public ActionResult<ItemStack> onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) {
    if (!world.isRemote) {
        Vec3d look = entityplayer.getLookVec();
        EntityFallingBlock fallingBlock = new EntityFallingBlock(world, 1, 1, 1, Blocks.STONE.getDefaultState());
        fallingBlock.setPosition(entityplayer.posX + look.xCoord * 0, entityplayer.posY + look.yCoord * 0, entityplayer.posZ + look.zCoord * 0);
        fallingBlock.lastTickPosX = look.xCoord * 0.1;
        fallingBlock.lastTickPosY = look.yCoord * 0.1;
        fallingBlock.lastTickPosZ = look.zCoord * 0.1;
        fallingBlock.fallTime = 1;
        world.spawnEntityInWorld(fallingBlock);
    }
    return new ActionResult(EnumActionResult.PASS, itemstack);
}
项目:amunra    文件:BlockFallingMeta.java   
private void doTheFalling(World world, int x, int y, int z)
{
    if (canContinueFalling(world, x, y - 1, z) && y >= 0)
    {
        byte b0 = 32;
        // It might be a good idea to check for the value of the official falling block...
        if (!BlockFalling.fallInstantly && world.checkChunksExist(x - b0, y - b0, z - b0, x + b0, y + b0, z + b0))
        {
            if (!world.isRemote)
            {
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, x + 0.5F, y + 0.5F, z + 0.5F, this, world.getBlockMetadata(x, y, z));
                this.onEntityCreated(entityfallingblock);
                world.spawnEntityInWorld(entityfallingblock);
            }
        }
        else
        {
            world.setBlockToAir(x, y, z);

            while (canContinueFalling(world, x, y - 1, z) && y > 0)
            {
                --y;
            }

            if (y > 0)
            {
                world.setBlock(x, y, z, this);
            }
        }
    }
}
项目:Minestrappolation-4    文件:BlockWitherAsh.java   
private void checkFallable(World worldIn, BlockPos pos)
{
    if (canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
    {
        byte b0 = 32;

        if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-b0, -b0, -b0), pos.add(b0, b0, b0)))
        {
            if (!worldIn.isRemote)
            {
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double) pos.getX() + 0.5D,
                                                                               (double) pos.getY(),
                                                                               (double) pos.getZ() + 0.5D,
                                                                               worldIn.getBlockState(pos));
                this.onStartFalling(entityfallingblock);
                worldIn.spawnEntityInWorld(entityfallingblock);
            }
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos1;

            for (blockpos1 = pos.down();
                 canFallInto(worldIn, blockpos1) && blockpos1.getY() > 0; blockpos1 = blockpos1.down())
            {
            }

            if (blockpos1.getY() > 0)
            {
                worldIn.setBlockState(blockpos1.up(), this.getDefaultState());
            }
        }
    }
}
项目:Hemomancy    文件:IcicleDropProjectileEffect.java   
private boolean createIceAtPoint(Entity projectile, EntityPlayer shooter, BlockPos pos, float potency)
{       
    World world = projectile.worldObj;

    if (world.isRemote)
    {
        return false;
    }

    int height = 7;
    float radius = 2.5f;

    int offset = 7;

    BlockPos translatedPos = pos.add(0, height + offset, 0);

    List<BlockPos> spikePosList = Utils.getPillarBlocksForPoint(translatedPos, EnumFacing.DOWN, height, radius, 0.3f, 0.5f);

    boolean success = false;

    for(BlockPos newPos : spikePosList)
    {
        if(world.isAirBlock(newPos))
        {
            world.setBlockState(newPos, Blocks.ice.getDefaultState());
            EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double)newPos.getX() + 0.5D, (double)newPos.getY() + 0.05, (double)newPos.getZ() + 0.5D, world.getBlockState(newPos));
            world.spawnEntityInWorld(entityfallingblock);
            success = true;
        }
    }       

    return success;
}
项目:Resilience-Client-Source    文件:BlockDragonEgg.java   
private void func_150018_e(World p_150018_1_, int p_150018_2_, int p_150018_3_, int p_150018_4_)
{
    if (BlockFalling.func_149831_e(p_150018_1_, p_150018_2_, p_150018_3_ - 1, p_150018_4_) && p_150018_3_ >= 0)
    {
        byte var5 = 32;

        if (!BlockFalling.field_149832_M && p_150018_1_.checkChunksExist(p_150018_2_ - var5, p_150018_3_ - var5, p_150018_4_ - var5, p_150018_2_ + var5, p_150018_3_ + var5, p_150018_4_ + var5))
        {
            EntityFallingBlock var6 = new EntityFallingBlock(p_150018_1_, (double)((float)p_150018_2_ + 0.5F), (double)((float)p_150018_3_ + 0.5F), (double)((float)p_150018_4_ + 0.5F), this);
            p_150018_1_.spawnEntityInWorld(var6);
        }
        else
        {
            p_150018_1_.setBlockToAir(p_150018_2_, p_150018_3_, p_150018_4_);

            while (BlockFalling.func_149831_e(p_150018_1_, p_150018_2_, p_150018_3_ - 1, p_150018_4_) && p_150018_3_ > 0)
            {
                --p_150018_3_;
            }

            if (p_150018_3_ > 0)
            {
                p_150018_1_.setBlock(p_150018_2_, p_150018_3_, p_150018_4_, this, 0, 2);
            }
        }
    }
}