本文整理汇总了Java中net.minecraft.item.ItemDoor.placeDoorBlock方法的典型用法代码示例。如果您正苦于以下问题:Java ItemDoor.placeDoorBlock方法的具体用法?Java ItemDoor.placeDoorBlock怎么用?Java ItemDoor.placeDoorBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.ItemDoor
的用法示例。
在下文中一共展示了ItemDoor.placeDoorBlock方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemUse
import net.minecraft.item.ItemDoor; //导入方法依赖的package包/类
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (side != 1)
return false;
else {
y++;
if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack)) {
if (!field_150939_a.canPlaceBlockAt(world, x, y, z))
return false;
else {
ItemDoor.placeDoorBlock(world, x, y, z, MathHelper.floor_double((player.rotationYaw + 180.0F) * 4.0F / 360.0F - 0.5D) & 3, field_150939_a);
stack.stackSize--;
return true;
}
} else
return false;
}
}
示例2: placeBlock
import net.minecraft.item.ItemDoor; //导入方法依赖的package包/类
public static void placeBlock(World world, int x, int y, int z, Entry block, int meta) {
// doors
if (block.metatype == MetaType.DOOR) {
ItemDoor.placeDoorBlock(world, x, y, z, meta, block.getBlock());
return;
}
// beds
else if (block.metatype == MetaType.BED) {
byte ox = 0;
byte oz = 0;
if (meta == 0) { oz = 1; }
if (meta == 1) { ox = -1; }
if (meta == 2) { oz = -1; }
if (meta == 3) { ox = 1; }
world.setBlock(x, y, z, block.getBlock(), meta, 2);
world.setBlock(x+ox, y, z+oz, block.getBlock(), meta+8, 2);
return;
}
// default
world.setBlock(x, y, z, block.getBlock(), meta, 2);
}
示例3: onItemUse
import net.minecraft.item.ItemDoor; //导入方法依赖的package包/类
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int meta, float f1, float f2, float f3) {
if (meta != 1) {
return false;
}
else {
++y;
Block block = InitBlocks.reinforced_door;
if (player.canPlayerEdit(x, y, z, meta, itemStack) && player.canPlayerEdit(x, y + 1, z, meta, itemStack)) {
if (!block.canPlaceBlockAt(world, x, y, z)) {
return false;
}
else {
int i1 = MathHelper.floor_double((double) ((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
ItemDoor.placeDoorBlock(world, x, y, z, i1, block);
--itemStack.stackSize;
return true;
}
} else {
return false;
}
}
}
示例4: placeDoorAtCurrentPosition
import net.minecraft.item.ItemDoor; //导入方法依赖的package包/类
protected void placeDoorAtCurrentPosition(World p_74881_1_, StructureBoundingBox p_74881_2_, Random p_74881_3_, int p_74881_4_, int p_74881_5_, int p_74881_6_, int p_74881_7_)
{
int i1 = this.getXWithOffset(p_74881_4_, p_74881_6_);
int j1 = this.getYWithOffset(p_74881_5_);
int k1 = this.getZWithOffset(p_74881_4_, p_74881_6_);
if (p_74881_2_.isVecInside(i1, j1, k1))
{
ItemDoor.placeDoorBlock(p_74881_1_, i1, j1, k1, p_74881_7_, Blocks.wooden_door);
}
}
示例5: placeDoorAtCurrentPosition
import net.minecraft.item.ItemDoor; //导入方法依赖的package包/类
protected void placeDoorAtCurrentPosition(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7)
{
int i1 = this.getXWithOffset(par4, par6);
int j1 = this.getYWithOffset(par5);
int k1 = this.getZWithOffset(par4, par6);
if (par2StructureBoundingBox.isVecInside(i1, j1, k1))
{
ItemDoor.placeDoorBlock(par1World, i1, j1, k1, par7, Block.doorWood);
}
}
示例6: onItemUse
import net.minecraft.item.ItemDoor; //导入方法依赖的package包/类
public boolean onItemUse(ItemStack stack, EntityPlayer player,
World world, int x, int y, int z, int dir,
float par8, float par9, float par10)
{
if (world.isRemote)
{
return true;
}
else
{
Block block = world.getBlock(x, y, z);
x += Facing.offsetsXForSide[dir];
y += Facing.offsetsYForSide[dir];
z += Facing.offsetsZForSide[dir];
double var12 = 0.0D;
if (dir == 1 && block.getRenderType() == 11)
{
var12 = 0.5D;
}
if (spawnCreature(world, stack.getCurrentDurability(), (double)x + 0.5D, (double)y + var12, (double)z + 0.5D) && !player.capabilities.isCreativeMode)
{
--stack.stackSize;
}
sphere(world, x, y - 1, z, 7, reinforced_steel);
sphere(world, x, y, z, 6, flesh);
for(int width = -1; width <= 7; width++)
{
for(int length = 0; length <= 6; length++)
{
world.setBlock(x + width - 2, y + 5, z + length - 2, bone); //
}
}
for(int w = 1; w <= 21; w++)
{
if(world.getBlock(x + 1, y - w + 7, z - 5 - w) == air) {
world.setBlock(x + 1, y - w + 7, z - 5 - w,
stone_brick_stairs, 2, 2);
}
}
world.setBlock(x + 1, y + 5, z - 6, stonebrick);
ItemDoor.placeDoorBlock(world, x + 1, y + 6, z - 5,
1, iron_door);
world.setBlock(x + 1, y + 6, z - 6, air); //
world.setBlock(x + 1, y + 7, z - 6, air); //
world.setBlock(x + 2, y + 6, z - 6, air); //
world.setBlock(x + 2, y + 7, z - 6, air); //
world.setBlock(x, y + 6, z - 6, air); //
world.setBlock(x, y + 7, z - 6, air); //
world.setBlock(x + 1, y + 6, z - 4, air); //
world.setBlock(x + 1, y + 7, z - 4, air); //
world.setBlock(x, y + 7, z - 6, key_slot_2, 0, 2);
world.setBlock(x + 2, y + 7, z - 4, key_slot_2, 0, 2);
world.setBlock(x + 2, y + 7, z - 5, reinforced_steel); //
world.setBlock(x + 2, y + 6, z - 5, reinforced_steel); //
world.setBlock(x, y + 7, z - 5, reinforced_steel); //
world.setBlock(x, y + 6, z - 5, reinforced_steel); //
world.setBlock(x + 5, y + 6, z, desk_wood); //
world.setBlock(x + 5, y + 6, z + 1, desk_wood); //
world.setBlock(x + 5, y + 6, z + 2, desk_wood); //
world.setBlock(x + 5, y + 7, z + 2, redstone_torch); //
world.setBlock(x + 5, y + 7, z, flower_pot_block);
//world.setBlock(x + 4, y + 6, z + 1, mod_SCP.woodenChair.blockID); //
world.setBlock(x + 2, y + 6, z + 5, chest); //
world.setBlock(x + 1, y + 6, z + 5, chest); //
world.setBlock(x, y + 6, z + 5, ender_chest, 2, 2);
//player.addChatMessage("SCP-002 Spawned." + " | [Type: " +
// "\u00a7eEuclid\u00a7f]");
return true;
}
}
示例7: spawnChestRoom
import net.minecraft.item.ItemDoor; //导入方法依赖的package包/类
private void spawnChestRoom(World world, Random random, int xOffset, int yOffset, int zOffset, int size, Block brick, int entranceSide, boolean hasChest){
int roomSize = size + 2;
int middleOffset = (roomSize - 1) / 2;
int chestSpot = 0;
// Spawn room
for(int y = 0; y < size; y++){
for(int x = 0; x < roomSize; x++){
for(int z = 0; z < roomSize; z++){
world.setBlockToAir(x + xOffset, y + yOffset, z + zOffset);
if(x == 0 || x == roomSize - 1 || z == 0 || z == roomSize - 1 || y == 0 || y == size - 1){
world.setBlock(x + xOffset, y + yOffset, z + zOffset, brick);
}
}
}
}
// Spawn door
ItemDoor door = (ItemDoor) Item.getItemFromBlock(Block.getBlockFromName("wooden_door"));
if(entranceSide == 0){
for(int y = 1; y < 3; y++){
world.setBlockToAir(xOffset + middleOffset, yOffset + y, zOffset);
}
door.placeDoorBlock(world, xOffset + middleOffset, yOffset + 1, zOffset, entranceSide, Block.getBlockFromName("wooden_door"));
}
else if(entranceSide == 1){
for(int y = 1; y < 3; y++){
world.setBlockToAir(xOffset + (roomSize - 1), yOffset + y, zOffset + middleOffset);
}
door.placeDoorBlock(world, xOffset + (roomSize - 1), yOffset + 1, zOffset + middleOffset, entranceSide, Block.getBlockFromName("wooden_door"));
}
else if(entranceSide == 2){
for(int y = 1; y < 3; y++){
world.setBlockToAir(xOffset + middleOffset, yOffset + y, zOffset + (roomSize - 1));
}
door.placeDoorBlock(world, xOffset + middleOffset, yOffset + 1, zOffset + (roomSize - 1), entranceSide, Block.getBlockFromName("wooden_door"));
}
else if(entranceSide == 3){
for(int y = 1; y < 3; y++){
world.setBlockToAir(xOffset, yOffset + y, zOffset + middleOffset);
}
door.placeDoorBlock(world, xOffset, yOffset + 1, zOffset + middleOffset, entranceSide, Block.getBlockFromName("wooden_door"));
}
// Spawn chest
if(hasChest){
world.setBlock(xOffset + middleOffset, yOffset + 1, zOffset + middleOffset, Blocks.chest, Direction.facingToDirection[entranceSide], 2);
TileEntityChest tileentitychest = (TileEntityChest)world.getTileEntity(xOffset + middleOffset, yOffset + 1, zOffset + middleOffset);
if (tileentitychest != null) {
WeightedRandomChestContent.generateChestContents(random, this.chestContent, tileentitychest, ChestGenHooks.getCount(DUNGEON_CHEST, random));
}
}
}