本文整理匯總了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;
}
示例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
}
示例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;
}
示例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;
}