本文整理汇总了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;
}