當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。