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


Java TileEntityChest.getBlockType方法代码示例

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


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

示例1: getChestInventory

import net.minecraft.tileentity.TileEntityChest; //导入方法依赖的package包/类
public static IInventory getChestInventory(TileEntityChest chest) {
    for (EnumFacing face : EnumFacing.Plane.HORIZONTAL) {
        BlockPos offsetPos = chest.getPos().offset(face);
        if (chest.getWorld().getBlockState(offsetPos).getBlock() == chest.getBlockType()) {
            TileEntity te = chest.getWorld().getTileEntity(offsetPos);
            if (te instanceof TileEntityChest) {
                TileEntityChest chest2 = (TileEntityChest) te;
                if (face != EnumFacing.WEST && face != EnumFacing.NORTH) {
                    return new InventoryLargeChest("container.chestDouble", chest, chest2);
                } else {
                    return new InventoryLargeChest("container.chestDouble", chest2, chest);
                }
            }
        }
    }
    return chest;
}
 
开发者ID:MrIbby,项目名称:BaMsGRAVE,代码行数:18,代码来源:BlockHelper.java

示例2: get

import net.minecraft.tileentity.TileEntityChest; //导入方法依赖的package包/类
public static VanillaDoubleChestItemHandler get(TileEntityChest chest)
{
    World world = chest.getWorld();
    BlockPos pos = chest.getPos();
    if (world == null || pos == null || !world.isBlockLoaded(pos))
        return null; // Still loading

    Block blockType = chest.getBlockType();

    EnumFacing[] horizontals = EnumFacing.HORIZONTALS;
    for (int i = horizontals.length - 1; i >= 0; i--)   // Use reverse order so we can return early
    {
        EnumFacing enumfacing = horizontals[i];
        BlockPos blockpos = pos.offset(enumfacing);
        Block block = world.getBlockState(blockpos).getBlock();

        if (block == blockType)
        {
            TileEntity otherTE = world.getTileEntity(blockpos);

            if (otherTE instanceof TileEntityChest)
            {
                TileEntityChest otherChest = (TileEntityChest) otherTE;
                return new VanillaDoubleChestItemHandler(chest, otherChest,
                        enumfacing != net.minecraft.util.EnumFacing.WEST && enumfacing != net.minecraft.util.EnumFacing.NORTH);

            }
        }
    }
    return NO_ADJACENT_CHESTS_INSTANCE; //All alone
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:32,代码来源:VanillaDoubleChestItemHandler.java

示例3: getChest

import net.minecraft.tileentity.TileEntityChest; //导入方法依赖的package包/类
public static IInventory getChest(TileEntityChest chest) {
    for (ForgeDirection fside : chestSides) {
        if (chest.getWorldObj().getBlock(chest.xCoord + fside.offsetX, chest.yCoord + fside.offsetY, chest.zCoord + fside.offsetZ) == chest.getBlockType())
            return new InventoryLargeChest("container.chestDouble",
                    (TileEntityChest) chest.getWorldObj().getTileEntity(chest.xCoord + fside.offsetX, chest.yCoord + fside.offsetY, chest.zCoord + fside.offsetZ), chest);
    }
    return chest;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:9,代码来源:InventoryUtils.java

示例4: getChest

import net.minecraft.tileentity.TileEntityChest; //导入方法依赖的package包/类
public static IInventory getChest(TileEntityChest chest) {
    for (EnumFacing fside : Plane.HORIZONTAL) {
        if (chest.getWorld().getBlockState(chest.getPos().offset(fside)).getBlock() == chest.getBlockType()) {
            return new InventoryLargeChest("container.chestDouble", (TileEntityChest) chest.getWorld().getTileEntity(chest.getPos().offset(fside)), chest);
        }
    }
    return chest;
}
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:9,代码来源:InventoryUtils.java


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