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


Java EntityFallingBlock類代碼示例

本文整理匯總了Java中net.minecraft.entity.item.EntityFallingBlock的典型用法代碼示例。如果您正苦於以下問題:Java EntityFallingBlock類的具體用法?Java EntityFallingBlock怎麽用?Java EntityFallingBlock使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: fall

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
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>!");
	}
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:23,代碼來源:GravityHelper.java

示例2: dropPlatform

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
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);
            }
    }
}
 
開發者ID:DaedalusGame,項目名稱:BetterWithAddons,代碼行數:19,代碼來源:FallingPlatformHandler.java

示例3: apply

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
@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?
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:22,代碼來源:BlowEntities.java

示例4: onUse

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
@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
}
 
開發者ID:firegodjr,項目名稱:Alagaesias-Ancient-Language,代碼行數:23,代碼來源:WordAction.java

示例5: func_149829_a

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
@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
}
 
開發者ID:TeacherGaming,項目名稱:qcraft-mod,代碼行數:20,代碼來源:BlockQBlock.java

示例6: tryToFall

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
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);
				}
			}
		}
	}
}
 
開發者ID:tyronx,項目名稱:vintagecraft,代碼行數:23,代碼來源:BlockSandVC.java

示例7: tryToFall

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
/**
 * 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);
			}
		}
	}
}
 
開發者ID:TheDaemoness,項目名稱:IceAndShadow2,代碼行數:29,代碼來源:IaSBlockFalling.java

示例8: handleSpecialEntities

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
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;
    }
}
 
開發者ID:iChun,項目名稱:iChunUtil,代碼行數:24,代碼來源:WorldPortal.java

示例9: checkFall

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
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);
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:28,代碼來源:BlockDragonEgg.java

示例10: checkFallable

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
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());
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:33,代碼來源:BlockFalling.java

示例11: doRender

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
/**
 * 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);
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:43,代碼來源:RenderFallingBlock.java

示例12: onBlockFall

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
@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);
		}
	}
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:12,代碼來源:UCEventHandlerServer.java

示例13: checkFall

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
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);
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:28,代碼來源:BlockDragonEgg.java

示例14: checkFallable

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
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());
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:33,代碼來源:BlockFalling.java

示例15: checkFall

import net.minecraft.entity.item.EntityFallingBlock; //導入依賴的package包/類
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);
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:28,代碼來源:BlockDragonEgg.java


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