当前位置: 首页>>代码示例>>Java>>正文


Java Block.hasTileEntity方法代码示例

本文整理汇总了Java中net.minecraft.block.Block.hasTileEntity方法的典型用法代码示例。如果您正苦于以下问题:Java Block.hasTileEntity方法的具体用法?Java Block.hasTileEntity怎么用?Java Block.hasTileEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.Block的用法示例。


在下文中一共展示了Block.hasTileEntity方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFluidHandler

import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
 * Helper method to get an IFluidHandler for at a block position.
 *
 * Returns null if there is no valid fluid handler.
 */
@Nullable
public static IFluidHandler getFluidHandler(World world, BlockPos blockPos, @Nullable EnumFacing side)
{
    IBlockState state = world.getBlockState(blockPos);
    Block block = state.getBlock();

    if (block.hasTileEntity(state))
    {
        TileEntity tileEntity = world.getTileEntity(blockPos);
        if (tileEntity != null && tileEntity.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side))
        {
            return tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
        }
    }
    else if (block instanceof IFluidBlock)
    {
        return new FluidBlockWrapper((IFluidBlock) block, world, blockPos);
    }
    else if (block instanceof BlockLiquid)
    {
        return new BlockLiquidWrapper((BlockLiquid) block, world, blockPos);
    }

    return null;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:31,代码来源:FluidUtil.java

示例2: isDrawBlockOutline

import net.minecraft.block.Block; //导入方法依赖的package包/类
private boolean isDrawBlockOutline()
{
    if (!this.drawBlockOutline)
    {
        return false;
    }
    else
    {
        Entity entity = this.mc.getRenderViewEntity();
        boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI;

        if (flag && !((EntityPlayer)entity).capabilities.allowEdit)
        {
            ItemStack itemstack = ((EntityPlayer)entity).getCurrentEquippedItem();

            if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
            {
                BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
                Block block = this.mc.theWorld.getBlockState(blockpos).getBlock();

                if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR)
                {
                    flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory;
                }
                else
                {
                    flag = itemstack != null && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block));
                }
            }
        }

        return flag;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:35,代码来源:EntityRenderer.java

示例3: isDrawBlockOutline

import net.minecraft.block.Block; //导入方法依赖的package包/类
private boolean isDrawBlockOutline() {
	if (!this.drawBlockOutline) {
		return false;
	} else {
		Entity entity = this.mc.getRenderViewEntity();
		boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI;

		if (flag && !((EntityPlayer) entity).capabilities.allowEdit) {
			ItemStack itemstack = ((EntityPlayer) entity).getCurrentEquippedItem();

			if (this.mc.objectMouseOver != null
					&& this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
				BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
				Block block = this.mc.theWorld.getBlockState(blockpos).getBlock();

				if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) {
					boolean flag1;

					if (Reflector.ForgeBlock_hasTileEntity.exists()) {
						IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos);
						flag1 = Reflector.callBoolean(block, Reflector.ForgeBlock_hasTileEntity,
								new Object[] { iblockstate });
					} else {
						flag1 = block.hasTileEntity();
					}

					flag = flag1 && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory;
				} else {
					flag = itemstack != null && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block));
				}
			}
		}

		return flag;
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:37,代码来源:EntityRenderer.java

示例4: createNewTileEntity

import net.minecraft.block.Block; //导入方法依赖的package包/类
@Nullable
private TileEntity createNewTileEntity(BlockPos pos)
{
    IBlockState iblockstate = this.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, iblockstate.getBlock().getMetaFromState(iblockstate));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:Chunk.java

示例5: createNewTileEntity

import net.minecraft.block.Block; //导入方法依赖的package包/类
@Nullable
private TileEntity createNewTileEntity(BlockPos pos)
{
    IBlockState iblockstate = this.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return !block.hasTileEntity(iblockstate) ? null : block.createTileEntity(this.worldObj, iblockstate);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:Chunk.java

示例6: isDrawBlockOutline

import net.minecraft.block.Block; //导入方法依赖的package包/类
private boolean isDrawBlockOutline()
{
    if (!this.drawBlockOutline)
    {
        return false;
    }
    else
    {
        Entity entity = this.mc.getRenderViewEntity();
        boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI;

        if (flag && !((EntityPlayer)entity).capabilities.allowEdit)
        {
            ItemStack itemstack = ((EntityPlayer)entity).getHeldItemMainhand();

            if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
            {
                BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
                Block block = this.mc.theWorld.getBlockState(blockpos).getBlock();

                if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
                {
                    flag = block.hasTileEntity(this.mc.theWorld.getBlockState(blockpos)) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory;
                }
                else
                {
                    flag = itemstack != null && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block));
                }
            }
        }

        return flag;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:35,代码来源:EntityRenderer.java

示例7: createNewTileEntity

import net.minecraft.block.Block; //导入方法依赖的package包/类
private TileEntity createNewTileEntity(BlockPos pos)
{
    Block block = this.getBlock(pos);
    return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:6,代码来源:Chunk.java

示例8: blockHasTileEntity

import net.minecraft.block.Block; //导入方法依赖的package包/类
public static boolean blockHasTileEntity(IBlockState p_blockHasTileEntity_0_)
{
    Block block = p_blockHasTileEntity_0_.getBlock();
    return !Reflector.ForgeBlock_hasTileEntity.exists() ? block.hasTileEntity() : Reflector.callBoolean(block, Reflector.ForgeBlock_hasTileEntity, new Object[] {p_blockHasTileEntity_0_});
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:6,代码来源:ReflectorForge.java


注:本文中的net.minecraft.block.Block.hasTileEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。