本文整理汇总了Java中net.minecraft.item.ItemDoor类的典型用法代码示例。如果您正苦于以下问题:Java ItemDoor类的具体用法?Java ItemDoor怎么用?Java ItemDoor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemDoor类属于net.minecraft.item包,在下文中一共展示了ItemDoor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: placeDoorCurrentPosition
import net.minecraft.item.ItemDoor; //导入依赖的package包/类
/**
* Places door on given position
*/
protected void placeDoorCurrentPosition(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, EnumFacing facing)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (boundingBoxIn.isVecInside(blockpos))
{
ItemDoor.placeDoor(worldIn, blockpos, facing.rotateYCCW(), Blocks.oak_door);
}
}
示例4: getItemBurnTime
import net.minecraft.item.ItemDoor; //导入依赖的package包/类
/**
* Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
* fuel
*/
public static int getItemBurnTime(ItemStack stack)
{
if (stack.func_190926_b())
{
return 0;
}
else
{
Item item = stack.getItem();
return item == Item.getItemFromBlock(Blocks.WOODEN_SLAB) ? 150 : (item == Item.getItemFromBlock(Blocks.WOOL) ? 100 : (item == Item.getItemFromBlock(Blocks.CARPET) ? 67 : (item == Item.getItemFromBlock(Blocks.LADDER) ? 300 : (item == Item.getItemFromBlock(Blocks.WOODEN_BUTTON) ? 100 : (Block.getBlockFromItem(item).getDefaultState().getMaterial() == Material.WOOD ? 300 : (item == Item.getItemFromBlock(Blocks.COAL_BLOCK) ? 16000 : (item instanceof ItemTool && "WOOD".equals(((ItemTool)item).getToolMaterialName()) ? 200 : (item instanceof ItemSword && "WOOD".equals(((ItemSword)item).getToolMaterialName()) ? 200 : (item instanceof ItemHoe && "WOOD".equals(((ItemHoe)item).getMaterialName()) ? 200 : (item == Items.STICK ? 100 : (item != Items.BOW && item != Items.FISHING_ROD ? (item == Items.SIGN ? 200 : (item == Items.COAL ? 1600 : (item == Items.LAVA_BUCKET ? 20000 : (item != Item.getItemFromBlock(Blocks.SAPLING) && item != Items.BOWL ? (item == Items.BLAZE_ROD ? 2400 : (item instanceof ItemDoor && item != Items.IRON_DOOR ? 200 : (item instanceof ItemBoat ? 400 : 0))) : 100)))) : 300)))))))))));
}
}
示例5: onItemUse
import net.minecraft.item.ItemDoor; //导入依赖的package包/类
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (side != EnumFacing.UP)
{
return false;
}
else
{
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
if (!block.isReplaceable(worldIn, pos))
{
pos = pos.offset(side);
}
if (!playerIn.canPlayerEdit(pos, side, stack))
{
return false;
}
else if (!this.block.canPlaceBlockAt(worldIn, pos))
{
return false;
}
else
{
ItemDoor.placeDoor(worldIn, pos, EnumFacing.fromAngle((double)playerIn.rotationYaw), this.block);
--stack.stackSize;
return true;
}
}
}
示例6: put
import net.minecraft.item.ItemDoor; //导入依赖的package包/类
protected void put(BlockPos pos, IBlockState block_state, EnumFacing facing) {
// don't run on client
if (this.world == null || this.world.isRemote) return;
Block block = block_state.getBlock();
FMLLog.info("Putting %s at %s", block_state, pos);
// handle special cases
if (block instanceof BlockDoor) {
ItemDoor.placeDoor(this.world, pos, facing, block, true);
} else if (block instanceof BlockBed) {
BlockPos headpos = pos.offset(facing);
if (this.world.getBlockState(pos.down()).isSideSolid(this.world, pos.down(), EnumFacing.UP) &&
this.world.getBlockState(headpos.down()).isSideSolid(this.world, headpos.down(), EnumFacing.UP)) {
block_state = block_state
.withProperty(BlockBed.OCCUPIED, false).withProperty(BlockBed.FACING, facing)
.withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT);
if (this.world.setBlockState(pos, block_state, 11)) {
block_state = block_state.withProperty(BlockBed.PART, BlockBed.EnumPartType.HEAD);
this.world.setBlockState(headpos, block_state, 11);
}
}
} else {
this.world.setBlockState(pos, block_state);
}
}
示例7: 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;
}
}
}
示例8: 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 var8 = this.getXWithOffset(par4, par6);
int var9 = this.getYWithOffset(par5);
int var10 = this.getZWithOffset(par4, par6);
if (par2StructureBoundingBox.isVecInside(var8, var9, var10))
{
ItemDoor.func_150924_a(par1World, var8, var9, var10, par7, Blocks.wooden_door);
}
}
示例9: 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);
}
}
示例10: canItemAcceptSockets
import net.minecraft.item.ItemDoor; //导入依赖的package包/类
public static boolean canItemAcceptSockets(ItemStack stack) {
Item item = stack.getItem();
if (item == PhysisItems.socketable) {
return false;
}
if (item instanceof ItemBlock
|| item instanceof ItemReed
|| item instanceof ItemBed
|| item instanceof ItemFood
|| item instanceof ItemPotion
|| item instanceof ItemMinecart
|| item instanceof ItemBoat
|| item instanceof ItemEnchantedBook
|| item instanceof ItemWritableBook
|| item instanceof ItemBucket
|| item instanceof ItemBucketMilk
|| item instanceof ItemDoor) {
return false;
}
if (item.getItemStackLimit(stack) > 1) {
return false;
}
if (item.hasContainerItem(stack)){
ItemStack container = item.getContainerItem(stack);
if (container != null && container.getItem() instanceof ItemBucket) {
return false;
}
}
if (item.getUnlocalizedName(stack).toLowerCase().contains("bucket")) {
return false;
}
return true;
}
示例11: func_74881_a
import net.minecraft.item.ItemDoor; //导入依赖的package包/类
protected void func_74881_a(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 var8 = this.func_74865_a(p_74881_4_, p_74881_6_);
int var9 = this.func_74862_a(p_74881_5_);
int var10 = this.func_74873_b(p_74881_4_, p_74881_6_);
if(p_74881_2_.func_78890_b(var8, var9, var10)) {
ItemDoor.func_77869_a(p_74881_1_, var8, var9, var10, p_74881_7_, Block.field_72054_aE);
}
}
示例12: 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);
}
}
示例13: getMatcher
import net.minecraft.item.ItemDoor; //导入依赖的package包/类
@Override
public Predicate<ItemStack> getMatcher() {
return stack -> stack.getItem() instanceof ItemDoor;
}
示例14: 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;
}
}
示例15: 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));
}
}
}