本文整理汇总了Java中net.minecraft.server.IInventory.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java IInventory.getSize方法的具体用法?Java IInventory.getSize怎么用?Java IInventory.getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.server.IInventory
的用法示例。
在下文中一共展示了IInventory.getSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupChest
import net.minecraft.server.IInventory; //导入方法依赖的package包/类
private void setupChest(IInventory top, IInventory bottom) {
int rows = top.getSize() / 9;
int row;
int col;
// This code copied from ContainerChest
int i = (rows - 4) * 18;
for (row = 0; row < rows; ++row) {
for (col = 0; col < 9; ++col) {
this.a(new Slot(top, col + row * 9, 8 + col * 18, 18 + row * 18));
}
}
for (row = 0; row < 3; ++row) {
for (col = 0; col < 9; ++col) {
this.a(new Slot(bottom, col + row * 9 + 9, 8 + col * 18, 103 + row * 18 + i));
}
}
for (col = 0; col < 9; ++col) {
this.a(new Slot(bottom, col, 8 + col * 18, 161 + i));
}
// End copy from ContainerChest
}
示例2: setupHopper
import net.minecraft.server.IInventory; //导入方法依赖的package包/类
private void setupHopper(IInventory top, IInventory bottom) {
// This code copied from ContainerHopper
byte b0 = 51;
int i;
for (i = 0; i < top.getSize(); ++i) {
this.a(new Slot(top, i, 44 + i * 18, 20));
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.a(new Slot(bottom, j + i * 9 + 9, 8 + j * 18, i * 18 + b0));
}
}
for (i = 0; i < 9; ++i) {
this.a(new Slot(bottom, i, 8 + i * 18, 58 + b0));
}
// End copy from ContainerHopper
}