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


Java InventoryLargeChest类代码示例

本文整理汇总了Java中net.minecraft.inventory.InventoryLargeChest的典型用法代码示例。如果您正苦于以下问题:Java InventoryLargeChest类的具体用法?Java InventoryLargeChest怎么用?Java InventoryLargeChest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getInventory

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
public static IInventory getInventory(final TileEntity tile) {
    if (tile instanceof IInventory) {
        if (tile instanceof TileEntityChest) {
            final int x = tile.xCoord;
            final int y = tile.yCoord;
            final int z = tile.zCoord;
            final Block blockID = tile.getWorldObj().getBlock(x, y, z);
            if (!tile.getWorldObj().isAirBlock(x, y, z) && blockID instanceof BlockChest) {
                if (tile.getWorldObj().getBlock(x - 1, y, z) == blockID) {
                    return (IInventory)new InventoryLargeChest("container.chestDouble", (IInventory)tile.getWorldObj().getTileEntity(x - 1, y, z), (IInventory)tile);
                }
                if (tile.getWorldObj().getBlock(x + 1, y, z) == blockID) {
                    return (IInventory)new InventoryLargeChest("container.chestDouble", (IInventory)tile, (IInventory)tile.getWorldObj().getTileEntity(x + 1, y, z));
                }
                if (tile.getWorldObj().getBlock(x, y, z - 1) == blockID) {
                    return (IInventory)new InventoryLargeChest("container.chestDouble", (IInventory)tile.getWorldObj().getTileEntity(x, y, z - 1), (IInventory)tile);
                }
                if (tile.getWorldObj().getBlock(x, y, z + 1) == blockID) {
                    return (IInventory)new InventoryLargeChest("container.chestDouble", (IInventory)tile, (IInventory)tile.getWorldObj().getTileEntity(x, y, z + 1));
                }
            }
        }
        return (IInventory)tile;
    }
    return null;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:27,代码来源:TNHelper.java

示例2: getInventory

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
public static IInventory getInventory(IInventory inv) {
	if (inv instanceof TileEntityChest) {
		TileEntityChest chest = (TileEntityChest) inv;
		TileEntityChest neighbour = null;
		if (chest.adjacentChestXNeg != null) {
			neighbour = chest.adjacentChestXNeg;
		} else if (chest.adjacentChestXPos != null) {
			neighbour = chest.adjacentChestXPos;
		} else if (chest.adjacentChestZNeg != null) {
			neighbour = chest.adjacentChestZNeg;
		} else if (chest.adjacentChestZPos != null) {
			neighbour = chest.adjacentChestZPos;
		}
		if (neighbour != null) {
			return new InventoryLargeChest("", (ILockableContainer)inv, (ILockableContainer)neighbour);
		}
		return inv;
	}
	return inv;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:21,代码来源:ItemUtil.java

示例3: getInventory

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
public static IInventory getInventory(IInventory inv) {
  if (inv instanceof TileEntityChest) {
    TileEntityChest chest = (TileEntityChest) inv;
    TileEntityChest neighbour = null;
    boolean reverse = false;
    if (chest.adjacentChestXNeg != null) {
      neighbour = chest.adjacentChestXNeg;
      reverse = true;
    } else if (chest.adjacentChestXPos != null) {
      neighbour = chest.adjacentChestXPos;
    } else if (chest.adjacentChestZNeg != null) {
      neighbour = chest.adjacentChestZNeg;
      reverse = true;
    } else if (chest.adjacentChestZPos != null) {
      neighbour = chest.adjacentChestZPos;
    }
    if (neighbour != null) {
      if (reverse) {
        return new InventoryLargeChest("", neighbour, inv);
      } else {
        return new InventoryLargeChest("", inv, neighbour);
      }
    }
  }
  return inv;
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:27,代码来源:ItemUtil.java

示例4: execute

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
@Override
public String execute(CommandSender sender, String[] params)throws CommandException {
	EntityPlayerMP player = getSenderAsEntity(sender.getMinecraftISender(), EntityPlayerMP.class);
	BlockPos coord1 = new BlockPos(player.getPosition().getX() + 1, player.getPosition().getY(), player.getPosition().getZ());
	BlockPos coord2 = new BlockPos(player.getPosition().getX() + 1, player.getPosition().getY(), player.getPosition().getZ() + 1);
	
	WorldUtils.setBlock(player.world, coord1, Blocks.CHEST);
	WorldUtils.setBlock(player.world, coord2, Blocks.CHEST);
	
	InventoryLargeChest chestInv = new InventoryLargeChest("Large chest", (TileEntityChest) player.world.getTileEntity(coord1), (TileEntityChest) player.world.getTileEntity(coord2));
	
       int count = 0;
       for (int i = 0; i < player.inventory.getSizeInventory() && count < chestInv.getSizeInventory(); i++) {
       	chestInv.setInventorySlotContents(count++, player.inventory.getStackInSlot(i));
       	player.inventory.setInventorySlotContents(i, ItemStack.EMPTY);
       }
       
       sender.sendLangfileMessage("command.dropstore.stored");
       return null;
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:21,代码来源:CommandDropstore.java

示例5: getChestInventory

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的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

示例6: getChest

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
public static IInventory getChest(IInventory inventory) {
	if (!(inventory instanceof TileEntityChest)) {
		return inventory;
	}

	TileEntityChest chest = (TileEntityChest) inventory;

	BlockPosition[] adjacent = new BlockPosition[] { new BlockPosition(chest.xCoord + 1, chest.yCoord, chest.zCoord), new BlockPosition(chest.xCoord - 1, chest.yCoord, chest.zCoord), new BlockPosition(chest.xCoord, chest.yCoord, chest.zCoord + 1), new BlockPosition(chest.xCoord, chest.yCoord, chest.zCoord - 1) };

	for (BlockPosition pos : adjacent) {
		TileEntity otherChest = chest.getWorldObj().getTileEntity(pos.x, pos.y, pos.z);
		if (otherChest instanceof TileEntityChest) {
			return new InventoryLargeChest("", chest, (TileEntityChest) otherChest);
		}
	}

	return inventory;
}
 
开发者ID:covers1624,项目名称:LegacyFarms,代码行数:19,代码来源:BlockUtils.java

示例7: getChest

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
public static IInventory getChest(IInventory inventory) {
	if (!(inventory instanceof TileEntityChest))
		return inventory;

	TileEntityChest chest = (TileEntityChest) inventory;

	Vect[] adjacent = new Vect[] { new Vect(chest.xCoord + 1, chest.yCoord, chest.zCoord), new Vect(chest.xCoord - 1, chest.yCoord, chest.zCoord),
			new Vect(chest.xCoord, chest.yCoord, chest.zCoord + 1), new Vect(chest.xCoord, chest.yCoord, chest.zCoord - 1) };

	for (Vect pos : adjacent) {
		TileEntity otherchest = chest.worldObj.getBlockTileEntity(pos.x, pos.y, pos.z);
		if (otherchest instanceof TileEntityChest)
			return new InventoryLargeChest("", chest, (TileEntityChest) otherchest);
	}

	return inventory;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:18,代码来源:Utils.java

示例8: getChest

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的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

示例9: getChest

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的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

示例10: checkChestInv

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
public static IInventory checkChestInv(IInventory inv)
{
	if(inv instanceof TileEntityChest)
	{
		TileEntityChest main = (TileEntityChest)inv;
		TileEntityChest adj = null;

		if(main.adjacentChestXNeg != null)
		{
			adj = main.adjacentChestXNeg;
		}
		else if(main.adjacentChestXPos != null)
		{
			adj = main.adjacentChestXPos;
		}
		else if(main.adjacentChestZNeg != null)
		{
			adj = main.adjacentChestZNeg;
		}
		else if(main.adjacentChestZPos != null)
		{
			adj = main.adjacentChestZPos;
		}

		if(adj != null)
		{
			return new InventoryLargeChest("", main, adj);
		}
	}

	return inv;
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:33,代码来源:InventoryUtils.java

示例11: getInventory

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
/**
 * Ensures that the given inventory is the full inventory, i.e. takes double
 * chests into account.
 *
 * @param inv
 * @return Modified inventory if double chest, unmodified otherwise.
 */
public static IInventory getInventory(IInventory inv) {
        if (inv instanceof TileEntityChest) {
                TileEntityChest chest = (TileEntityChest) inv;

                TileEntityChest adjacent = null;

                if (chest.adjacentChestXNeg != null) {
                        adjacent = chest.adjacentChestXNeg;
                }

                if (chest.adjacentChestXPos != null) {
                        adjacent = chest.adjacentChestXPos;
                }

                if (chest.adjacentChestZNeg != null) {
                        adjacent = chest.adjacentChestZNeg;
                }

                if (chest.adjacentChestZPos != null) {
                        adjacent = chest.adjacentChestZPos;
                }

                if (adjacent != null) {
                        return new InventoryLargeChest("", inv, adjacent);
                }
                return inv;
        }
        return inv;
}
 
开发者ID:tm1990,项目名称:MiscUtils,代码行数:37,代码来源:InventoryUtils.java

示例12: getInventory

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
/**
 * Ensures that the given inventory is the full inventory, i.e. takes double
 * chests into account.<br>
 * <i>METHOD COPIED FROM BUILDCRAFT</i>
 *
 * @param inv
 * @return Modified inventory if double chest, unmodified otherwise.
 */
public static IInventory getInventory(IInventory inv) {
	if (inv instanceof TileEntityChest) {
		TileEntityChest chest = (TileEntityChest) inv;

		TileEntityChest adjacent = null;

		if (chest.adjacentChestXNeg != null) {
			adjacent = chest.adjacentChestXNeg;
		}

		if (chest.adjacentChestXPos != null) {
			adjacent = chest.adjacentChestXPos;
		}

		if (chest.adjacentChestZNeg != null) {
			adjacent = chest.adjacentChestZNeg;
		}

		if (chest.adjacentChestZPos != null) {
			adjacent = chest.adjacentChestZPos;
		}

		if (adjacent != null)
			return new InventoryLargeChest("", inv, adjacent);
		return inv;
	}
	return inv;
}
 
开发者ID:NPException,项目名称:Dimensional-Pockets,代码行数:37,代码来源:Utils.java

示例13: getInventory

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
/**
 * Ensures that the given inventory is the full inventory, i.e. takes double
 * chests into account.
 *
 * @param inv
 * @return Modified inventory if double chest, unmodified otherwise.
 */
public static IInventory getInventory(IInventory inv) {
    if (inv instanceof TileEntityChest) {
        TileEntityChest chest = (TileEntityChest) inv;

        TileEntityChest adjacent = null;

        if (chest.adjacentChestXNeg != null) {
            adjacent = chest.adjacentChestXNeg;
        }

        if (chest.adjacentChestXPos != null) {
            adjacent = chest.adjacentChestXPos;
        }

        if (chest.adjacentChestZNeg != null) {
            adjacent = chest.adjacentChestZNeg;
        }

        if (chest.adjacentChestZPos != null) {
            adjacent = chest.adjacentChestZPos;
        }

        if (adjacent != null) {
            return new InventoryLargeChest("", inv, adjacent);
        }
        return inv;
    }
    return inv;
}
 
开发者ID:Dennisbonke,项目名称:DBLibOld,代码行数:37,代码来源:InventoryUtils.java

示例14: checkChestInv

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
public static IInventory checkChestInv(IInventory inv)
{
    if (inv instanceof TileEntityChest)
    {
        TileEntityChest main = (TileEntityChest) inv;
        TileEntityChest adj = null;

        if (main.adjacentChestXNeg != null)
        {
            adj = main.adjacentChestXNeg;
        }
        else if (main.adjacentChestXPos != null)
        {
            adj = main.adjacentChestXPos;
        }
        else if (main.adjacentChestZNeg != null)
        {
            adj = main.adjacentChestZNeg;
        }
        else if (main.adjacentChestZPos != null)
        {
            adj = main.adjacentChestZPos;
        }

        if (adj != null)
        {
            return new InventoryLargeChest("", main, adj);
        }
    }

    return inv;
}
 
开发者ID:Dennisbonke,项目名称:DBLibOld,代码行数:33,代码来源:InventoryUtility.java

示例15: update

import net.minecraft.inventory.InventoryLargeChest; //导入依赖的package包/类
/**
 * Like the old updateEntity(), except more generic.
 */
@Override
public void update() {
	int i = this.pos.getX();
	int j = this.pos.getY();
	int k = this.pos.getZ();
	++this.ticksSinceSync;

	if (!this.world.isRemote && this.numPlayersUsing != 0 && (this.ticksSinceSync + i + j + k) % 200 == 0) {
		this.numPlayersUsing = 0;
		// float f = 5.0F;

		for (EntityPlayer entityplayer : this.world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(i - 5.0F, j - 5.0F, k - 5.0F, i + 1 + 5.0F, j + 1 + 5.0F, k + 1 + 5.0F))) {
			if (entityplayer.openContainer instanceof ContainerChest) {
				IInventory iinventory = ((ContainerChest) entityplayer.openContainer).getLowerChestInventory();

				if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).isPartOfLargeChest(this)) {
					++this.numPlayersUsing;
				}
			}
		}
	}

	this.prevLidAngle = this.lidAngle;
	// float f1 = 0.1F;

	if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) {
		double d1 = i + 0.5D;
		double d2 = k + 0.5D;

		if (this.adjacentChestZPos != null) {
			d2 += 0.5D;
		}

		if (this.adjacentChestXPos != null) {
			d1 += 0.5D;
		}

		this.world.playSound((EntityPlayer) null, d1, j + 0.5D, d2, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F);
	}

	if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) {
		float f2 = this.lidAngle;

		if (this.numPlayersUsing > 0) {
			this.lidAngle += 0.1F;
		} else {
			this.lidAngle -= 0.1F;
		}

		if (this.lidAngle > 1.0F) {
			this.lidAngle = 1.0F;
		}

		// float f3 = 0.5F;

		if (this.lidAngle < 0.5F && f2 >= 0.5F && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) {
			double d3 = i + 0.5D;
			double d0 = k + 0.5D;

			if (this.adjacentChestZPos != null) {
				d0 += 0.5D;
			}

			if (this.adjacentChestXPos != null) {
				d3 += 0.5D;
			}

			this.world.playSound((EntityPlayer) null, d3, j + 0.5D, d0, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F);
		}

		if (this.lidAngle < 0.0F) {
			this.lidAngle = 0.0F;
		}
	}
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:79,代码来源:TileEntityLimitableChest.java


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