本文整理汇总了Java中net.minecraft.tileentity.TileEntityLockableLoot类的典型用法代码示例。如果您正苦于以下问题:Java TileEntityLockableLoot类的具体用法?Java TileEntityLockableLoot怎么用?Java TileEntityLockableLoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TileEntityLockableLoot类属于net.minecraft.tileentity包,在下文中一共展示了TileEntityLockableLoot类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: forceLootGeneration
import net.minecraft.tileentity.TileEntityLockableLoot; //导入依赖的package包/类
/**
* Force loot generation, as this is required on the client side to peek inside inventories.
* The client is not able to generate the loot.
* @param te
*/
private void forceLootGeneration(TileEntity te){
if(te instanceof TileEntityLockableLoot){
TileEntityLockableLoot teLoot = (TileEntityLockableLoot)te;
teLoot.fillWithLoot(null);
}
}
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:12,代码来源:PacketDescriptionPacketRequest.java
示例2: DrawPrimitive
import net.minecraft.tileentity.TileEntityLockableLoot; //导入依赖的package包/类
protected void DrawPrimitive( DrawContainer c, World w ) throws Exception
{
// First, draw the container block:
String cType = c.getType().value();
BlockType bType = BlockType.fromValue(cType); // Safe - ContainerType is a subset of BlockType
XMLBlockState blockType = new XMLBlockState(bType, c.getColour(), c.getFace(), c.getVariant());
if (!blockType.isValid())
throw new Exception("Unrecogised item type: " + c.getType().value());
BlockPos pos = new BlockPos( c.getX(), c.getY(), c.getZ() );
setBlockState(w, pos, blockType );
// Now fill the container:
TileEntity tileentity = w.getTileEntity(pos);
if (tileentity instanceof TileEntityLockableLoot)
{
// First clear out any leftovers:
((TileEntityLockableLoot)tileentity).clear();
int index = 0;
for (ContainedObjectType cot : c.getObject())
{
DrawItem di = new DrawItem();
di.setColour(cot.getColour());
di.setType(cot.getType());
di.setVariant(cot.getVariant());
ItemStack stack = MinecraftTypeHelper.getItemStackFromDrawItem(di);
stack.setCount(cot.getQuantity());
((TileEntityLockableLoot)tileentity).setInventorySlotContents(index, stack);
index++;
}
}
}
开发者ID:Microsoft,项目名称:malmo,代码行数:31,代码来源:BlockDrawingHelper.java
示例3: generateTower
import net.minecraft.tileentity.TileEntityLockableLoot; //导入依赖的package包/类
public void generateTower(WorldServer world, BlockPos pos, Random rand) {
MinecraftServer server = world.getMinecraftServer();
Template template = world.getStructureTemplateManager().getTemplate(server, TOWER_STRUCTURE);
PlacementSettings settings = new PlacementSettings();
settings.setRotation(Rotation.values()[rand.nextInt(Rotation.values().length)]);
BlockPos size = template.getSize();
int airBlocks = 0;
for(int x = 0; x < size.getX(); x++) {
for (int z = 0; z < size.getZ(); z++) {
if (world.isAirBlock(pos.add(template.transformedBlockPos(settings, new BlockPos(x, 0, z))))) {
airBlocks++;
if (airBlocks > 0.33 * (size.getX() * size.getZ())) {
return;
}
}
}
}
for (int x = 0; x < size.getX(); x++) {
for (int z = 0; z < size.getZ(); z++) {
if (x == 0 || x == size.getX() - 1 || z == 0 || z == size.getZ() - 1) {
for (int y = 0; y < size.getY(); y++) {
BlockPos checkPos = pos.add(template.transformedBlockPos(settings, new BlockPos(x, y, z)));
IBlockState checkState = world.getBlockState(checkPos);
if (!checkState.getBlock().isAir(checkState, world, checkPos)) {
if (!(y <= 3 && (checkState.getBlock() == Blocks.NETHERRACK || checkState.getBlock() == Blocks.QUARTZ_ORE || checkState.getBlock() == Blocks.MAGMA))) {
return;
}
}
}
}
}
}
template.addBlocksToWorld(world, pos, settings);
Map<BlockPos, String> dataBlocks = template.getDataBlocks(pos, settings);
for (Entry<BlockPos, String> entry : dataBlocks.entrySet()) {
String[] tokens = entry.getValue().split(" ");
if (tokens.length == 0)
return;
BlockPos dataPos = entry.getKey();
EntityPigMage pigMage;
switch (tokens[0]) {
case "pigman_mage":
pigMage = new EntityPigMage(world);
pigMage.setPosition(dataPos.getX() + 0.5, dataPos.getY(), dataPos.getZ() + 0.5);
pigMage.onInitialSpawn(world.getDifficultyForLocation(dataPos), null);
world.spawnEntity(pigMage);
break;
case "fortress_chest":
IBlockState chestState = Blocks.CHEST.getDefaultState().withRotation(settings.getRotation());
chestState = chestState.withMirror(Mirror.FRONT_BACK);
world.setBlockState(dataPos, chestState);
TileEntity tile = world.getTileEntity(dataPos);
if (tile != null && tile instanceof TileEntityLockableLoot)
((TileEntityLockableLoot) tile).setLootTable(NETHER_BRIDGE_LOOT_TABLE, rand.nextLong());
break;
}
}
}
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:65,代码来源:PigmanMageTowerGenerator.java
示例4: swapSlots
import net.minecraft.tileentity.TileEntityLockableLoot; //导入依赖的package包/类
static ItemStack[] swapSlots(EntityPlayerMP player, String lhsInv, int lhs, String rhsInv, int rhs, BlockPos containerPos)
{
IInventory container = null;
String containerName = "";
if (containerPos != null)
{
TileEntity te = player.world.getTileEntity(containerPos);
if (te != null && te instanceof TileEntityLockableLoot)
{
containerName = ObservationFromFullInventoryImplementation.getInventoryName((IInventory)te);
container = (IInventory)te;
}
else if (te != null && te instanceof TileEntityEnderChest)
{
containerName = ObservationFromFullInventoryImplementation.getInventoryName(player.getInventoryEnderChest());
container = player.getInventoryEnderChest();
}
}
IInventory lhsInventory = lhsInv.equals("inventory") ? player.inventory : (lhsInv.equals(containerName) ? container : null);
IInventory rhsInventory = rhsInv.equals("inventory") ? player.inventory : (rhsInv.equals(containerName) ? container : null);
if (lhsInventory == null || rhsInventory == null)
return null; // Source or dest container not available.
if (rhs < 0 || lhs < 0)
return null; // Out of bounds.
if (lhs >= lhsInventory.getSizeInventory() || rhs >= rhsInventory.getSizeInventory())
return null; // Out of bounds.
ItemStack srcStack = lhsInventory.getStackInSlot(lhs);
ItemStack dstStack = rhsInventory.getStackInSlot(rhs);
lhsInventory.setInventorySlotContents(lhs, dstStack);
rhsInventory.setInventorySlotContents(rhs, srcStack);
if (lhsInventory != rhsInventory)
{
// Items have moved between our inventory and the foreign inventory - may need to trigger
// rewards for collecting / discarding.
ItemStack[] returnStacks = new ItemStack[2];
ItemStack stackBeingLost = (lhsInventory == player.inventory) ? srcStack : dstStack;
ItemStack stackBeingGained = (lhsInventory == player.inventory) ? dstStack : srcStack;
if (stackBeingGained != null)
returnStacks[0] = stackBeingGained.copy();
if (stackBeingLost != null)
returnStacks[1] = stackBeingLost.copy();
return returnStacks;
}
return null;
}
开发者ID:Microsoft,项目名称:malmo,代码行数:48,代码来源:InventoryCommandsImplementation.java
注:本文中的net.minecraft.tileentity.TileEntityLockableLoot类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论