net.minecraft.block.BlockDoor Java Examples
The following examples show how to use
net.minecraft.block.BlockDoor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockMetalDoor.java From BaseMetals with GNU Lesser General Public License v2.1 | 6 votes |
@Override public boolean onBlockActivated(final World world, final BlockPos coord, IBlockState blockstate, final EntityPlayer player, final EnumHand hand, ItemStack heldItem, final EnumFacing face, final float partialX, final float partialY, final float partialZ) { if (this.metal.getToolHarvestLevel() > 1) { return false; } final BlockPos pos = (blockstate.getValue(BlockDoor.HALF) == EnumDoorHalf.LOWER) ? coord : coord.down(); final IBlockState bs = coord.equals(pos) ? blockstate : world.getBlockState(pos); if (bs.getBlock() != this) { return false; } blockstate = bs.cycleProperty(BlockDoor.OPEN); world.setBlockState(pos, blockstate, 2); world.markBlockRangeForRenderUpdate(pos, coord); world.playEvent(player, ((Boolean)blockstate.getValue(BlockDoor.OPEN)) ? 1003 : 1006, coord, 0); return true; }
Example #2
Source File: ItemTraverseWoodDoor.java From CommunityMod with GNU Lesser General Public License v2.1 | 6 votes |
public static void placeDoor(World worldIn, BlockPos pos, EnumFacing facing, Block door, boolean isRightHinge) { BlockPos blockpos = pos.offset(facing.rotateY()); BlockPos blockpos1 = pos.offset(facing.rotateYCCW()); int i = (worldIn.getBlockState(blockpos1).isNormalCube() ? 1 : 0) + (worldIn.getBlockState(blockpos1.up()).isNormalCube() ? 1 : 0); int j = (worldIn.getBlockState(blockpos).isNormalCube() ? 1 : 0) + (worldIn.getBlockState(blockpos.up()).isNormalCube() ? 1 : 0); boolean flag = worldIn.getBlockState(blockpos1).getBlock() == door || worldIn.getBlockState(blockpos1.up()).getBlock() == door; boolean flag1 = worldIn.getBlockState(blockpos).getBlock() == door || worldIn.getBlockState(blockpos.up()).getBlock() == door; if ((!flag || flag1) && j <= i) { if (flag1 && !flag || j < i) { isRightHinge = false; } } else { isRightHinge = true; } BlockPos blockpos2 = pos.up(); boolean flag2 = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(blockpos2); IBlockState iblockstate = door.getDefaultState().withProperty(BlockDoor.FACING, facing).withProperty(BlockDoor.HINGE, isRightHinge ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT).withProperty(BlockDoor.POWERED, Boolean.valueOf(flag2)).withProperty(BlockDoor.OPEN, Boolean.valueOf(flag2)); worldIn.setBlockState(pos, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); worldIn.setBlockState(blockpos2, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); worldIn.notifyNeighborsOfStateChange(pos, door, false); worldIn.notifyNeighborsOfStateChange(blockpos2, door, false); }
Example #3
Source File: ItemTraverseWoodDoor.java From Traverse-Legacy-1-12-2 with MIT License | 6 votes |
public static void placeDoor(World worldIn, BlockPos pos, EnumFacing facing, Block door, boolean isRightHinge) { BlockPos blockpos = pos.offset(facing.rotateY()); BlockPos blockpos1 = pos.offset(facing.rotateYCCW()); int i = (worldIn.getBlockState(blockpos1).isNormalCube() ? 1 : 0) + (worldIn.getBlockState(blockpos1.up()).isNormalCube() ? 1 : 0); int j = (worldIn.getBlockState(blockpos).isNormalCube() ? 1 : 0) + (worldIn.getBlockState(blockpos.up()).isNormalCube() ? 1 : 0); boolean flag = worldIn.getBlockState(blockpos1).getBlock() == door || worldIn.getBlockState(blockpos1.up()).getBlock() == door; boolean flag1 = worldIn.getBlockState(blockpos).getBlock() == door || worldIn.getBlockState(blockpos.up()).getBlock() == door; if ((!flag || flag1) && j <= i) { if (flag1 && !flag || j < i) { isRightHinge = false; } } else { isRightHinge = true; } BlockPos blockpos2 = pos.up(); boolean flag2 = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(blockpos2); IBlockState iblockstate = door.getDefaultState().withProperty(BlockDoor.FACING, facing).withProperty(BlockDoor.HINGE, isRightHinge ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT).withProperty(BlockDoor.POWERED, Boolean.valueOf(flag2)).withProperty(BlockDoor.OPEN, Boolean.valueOf(flag2)); worldIn.setBlockState(pos, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); worldIn.setBlockState(blockpos2, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); worldIn.notifyNeighborsOfStateChange(pos, door, false); worldIn.notifyNeighborsOfStateChange(blockpos2, door, false); }
Example #4
Source File: FurnaceRecipeHandler.java From NotEnoughItems with MIT License | 6 votes |
private static void findFuels() { afuels = new ArrayList<>(); Set<Item> efuels = excludedFuels(); for (ItemStack item : ItemList.items) { Block block = Block.getBlockFromItem(item.getItem()); if (block instanceof BlockDoor) { continue; } if (efuels.contains(item.getItem())) { continue; } int burnTime = TileEntityFurnace.getItemBurnTime(item); if (burnTime > 0) { afuels.add(new FuelPair(item.copy(), burnTime)); } } }
Example #5
Source File: ClassroomDecoratorImplementation.java From malmo with MIT License | 6 votes |
private void setIgloo() { this.floor = Blocks.SNOW.getDefaultState(); this.exterior = Blocks.SNOW.getDefaultState(); this.wall = Blocks.PACKED_ICE.getDefaultState(); this.light = Blocks.TORCH.getDefaultState(); this.goal = Blocks.REDSTONE_BLOCK.getDefaultState(); this.moat = Blocks.WATER.getDefaultState(); this.moatContainer = Blocks.GLOWSTONE.getDefaultState(); this.doorUpper = Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER); this.doorLower = Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER); this.stairs = Blocks.SPRUCE_STAIRS.getDefaultState(); this.stairsPlatform = Blocks.PACKED_ICE.getDefaultState(); this.ladder = Blocks.LADDER.getDefaultState(); this.puzzleDoorUpper = Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER); this.puzzleDoorLower = Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER); this.trigger = Blocks.LEVER.getDefaultState(); this.platform = Blocks.SNOW.getDefaultState(); this.hint = Blocks.REDSTONE_ORE.getDefaultState(); }
Example #6
Source File: ClassroomDecoratorImplementation.java From malmo with MIT License | 6 votes |
private void setPyramid() { this.floor = Blocks.RED_SANDSTONE.getDefaultState(); this.exterior = Blocks.SANDSTONE.getDefaultState(); this.wall = Blocks.SANDSTONE.getDefaultState(); this.light = Blocks.TORCH.getDefaultState(); this.goal = Blocks.DIAMOND_BLOCK.getDefaultState(); this.moat = Blocks.LAVA.getDefaultState(); this.moatContainer = Blocks.SANDSTONE.getDefaultState(); this.doorUpper = Blocks.ACACIA_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER); this.doorLower = Blocks.ACACIA_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER); this.stairs = Blocks.SANDSTONE_STAIRS.getDefaultState(); this.stairsPlatform = Blocks.SANDSTONE.getDefaultState(); this.ladder = Blocks.LADDER.getDefaultState(); this.puzzleDoorUpper = Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER); this.puzzleDoorLower = Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER); this.trigger = Blocks.LEVER.getDefaultState(); this.platform = Blocks.RED_SANDSTONE.getDefaultState(); this.hint = Blocks.DIAMOND_ORE.getDefaultState(); }
Example #7
Source File: ClassroomDecoratorImplementation.java From malmo with MIT License | 6 votes |
private void setDungeon() { this.floor = Blocks.PLANKS.getDefaultState(); this.exterior = Blocks.COBBLESTONE.getDefaultState(); this.wall = Blocks.COBBLESTONE.getDefaultState(); this.light = Blocks.TORCH.getDefaultState(); this.goal = Blocks.GOLD_BLOCK.getDefaultState(); this.moat = Blocks.LAVA.getDefaultState(); this.moatContainer = Blocks.COBBLESTONE.getDefaultState(); this.doorUpper = Blocks.OAK_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER); this.doorLower = Blocks.OAK_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER); this.stairs = Blocks.STONE_STAIRS.getDefaultState(); this.stairsPlatform = Blocks.COBBLESTONE.getDefaultState(); this.ladder = Blocks.LADDER.getDefaultState(); this.puzzleDoorUpper = Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER); this.puzzleDoorLower = Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER); this.trigger = Blocks.LEVER.getDefaultState(); this.platform = Blocks.BOOKSHELF.getDefaultState(); this.hint = Blocks.GOLD_ORE.getDefaultState(); }
Example #8
Source File: Door.java From minecraft-roguelike with GNU General Public License v3.0 | 5 votes |
private static MetaBlock setProperties(MetaBlock doorblock, boolean top, Cardinal dir, boolean open, boolean hingeLeft){ IBlockState door = doorblock.getBlock().getDefaultState(); door = door.withProperty(BlockDoor.HALF, top ? BlockDoor.EnumDoorHalf.UPPER : BlockDoor.EnumDoorHalf.LOWER); door = door.withProperty(BlockDoor.FACING, Cardinal.facing(dir)); door = door.withProperty(BlockDoor.OPEN, open); door = door.withProperty(BlockDoor.HINGE, hingeLeft ? BlockDoor.EnumHingePosition.LEFT : BlockDoor.EnumHingePosition.RIGHT); return new MetaBlock(door); }
Example #9
Source File: TofuVillage.java From TofuCraftReload with MIT License | 5 votes |
private boolean isWoodDoor(BlockPos pos) { IBlockState iblockstate = this.world.getBlockState(pos); Block block = iblockstate.getBlock(); if (block instanceof BlockDoor) { return iblockstate.getMaterial() == Material.WOOD; } else { return false; } }
Example #10
Source File: FurnaceRecipeHandler.java From NotEnoughItems with MIT License | 5 votes |
private static void findFuels() { afuels = new ArrayList<FuelPair>(); Set<Item> efuels = excludedFuels(); for (ItemStack item : ItemList.items) { Block block = Block.getBlockFromItem(item.getItem()); if (block instanceof BlockDoor) continue; if (efuels.contains(item.getItem())) continue; int burnTime = TileEntityFurnace.getItemBurnTime(item); if (burnTime > 0) afuels.add(new FuelPair(item.copy(), burnTime)); } }
Example #11
Source File: Items.java From BaseMetals with GNU Lesser General Public License v2.1 | 5 votes |
private static Item create_door(MetalMaterial metal,BlockDoor door){ Item item = new ItemMetalDoor(door,metal); registerItem(item, metal.getName()+"_"+"door"+"_"+"item", metal, ItemGroups.tab_blocks); item.setUnlocalizedName(BaseMetals.MODID+"."+metal.getName()+"_"+"door"); // Dirty Hack to set name right doorMap.put(door, item); return item; }
Example #12
Source File: Blocks.java From BaseMetals with GNU Lesser General Public License v2.1 | 5 votes |
@SideOnly(Side.CLIENT) public static void registerItemRenders(FMLInitializationEvent event){ for(String name : allBlocks.keySet()){ if(allBlocks.get(name) instanceof BlockDoor) continue;// do not add door blocks Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(net.minecraft.item.Item.getItemFromBlock(allBlocks.get(name)), 0, new ModelResourceLocation(BaseMetals.MODID+":"+name, "inventory")); } }
Example #13
Source File: Blocks.java From BaseMetals with GNU Lesser General Public License v2.1 | 5 votes |
private static BlockDoor createDoor(MetalMaterial metal){ String name = metal.getName()+"_door"; BlockDoor block = new BlockMetalDoor(metal); block.setRegistryName(BaseMetals.MODID, name); block.setUnlocalizedName(BaseMetals.MODID+"."+name); GameRegistry.register(block); ItemBlock itemBlock = new ItemBlock(block); itemBlock.setRegistryName(BaseMetals.MODID, name); GameRegistry.register(itemBlock); allBlocks.put(metal.getName()+"_door", block); return block; }
Example #14
Source File: SealableBlockHandler.java From AdvancedRocketry with MIT License | 5 votes |
private boolean checkDoorIsSealed(World world, BlockPos pos, IBlockState state) { IBlockState state2 = state; //For some reason the actual direction is stored in the bottom block of a door, so get that, but use the current block to determine openness due to order of update if(state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) state2 = world.getBlockState(pos.down()); if(state.getValue(BlockDoor.OPEN)) return isBlockSealed(world, pos.offset(state2.getValue(BlockDoor.FACING))) && isBlockSealed(world, pos.offset(state2.getValue(BlockDoor.FACING).rotateYCCW().rotateYCCW())); //state.getValue(BlockDoor.FACING) return isBlockSealed(world, pos.offset(state2.getValue(BlockDoor.FACING).rotateY())) && isBlockSealed(world, pos.offset(state2.getValue(BlockDoor.FACING).rotateYCCW())); }
Example #15
Source File: BaseMethods.java From pycode-minecraft with MIT License | 5 votes |
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); } }
Example #16
Source File: BlockMapBuilder.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
private void handleExtraDoorBlock(IBlockState block, String c) { if (!isDoor(c)) { return; } block = block.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER); setBlockState(block, x, y + 1, z); }
Example #17
Source File: VillagePieceBlockMap.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
protected IBlockState biomeSpecificDoor(IBlockState in) { BlockDoor newBlock; switch (this.structureType) { case 2: newBlock = Blocks.ACACIA_DOOR; break; case 3: newBlock = Blocks.SPRUCE_DOOR; break; default: newBlock = Blocks.OAK_DOOR; break; } return newBlock.getDefaultState().withProperty(BlockBed.FACING, in.getValue(BlockDoor.FACING)); }
Example #18
Source File: VillagePieceBlockMap.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
protected IBlockState getBiomeSpecificBlockState(IBlockState in) { in = super.getBiomeSpecificBlockState(in); if (in.getBlock() instanceof BlockDoor) { in = biomeSpecificDoor(in); } return in; }
Example #19
Source File: TofuVillageCollection.java From TofuCraftReload with MIT License | 5 votes |
private boolean isWoodDoor(BlockPos doorPos) { IBlockState iblockstate = this.world.getBlockState(doorPos); Block block = iblockstate.getBlock(); if (block instanceof BlockDoor) { return iblockstate.getMaterial() == Material.WOOD; } else { return false; } }
Example #20
Source File: TofuVillageCollection.java From TofuCraftReload with MIT License | 5 votes |
private void addToNewDoorsList(BlockPos doorBlock) { EnumFacing enumfacing = BlockDoor.getFacing(this.world, doorBlock); EnumFacing enumfacing1 = enumfacing.getOpposite(); int i = this.countBlocksCanSeeSky(doorBlock, enumfacing, 5); int j = this.countBlocksCanSeeSky(doorBlock, enumfacing1, i + 1); if (i != j) { this.newDoors.add(new VillageDoorInfo(doorBlock, i < j ? enumfacing : enumfacing1, this.tickCounter)); } }
Example #21
Source File: BlockMapBuilder.java From ToroQuest with GNU General Public License v3.0 | 4 votes |
private boolean blockIsRepeatable(IBlockState block) { return !(block instanceof BlockStairs || block instanceof BlockDoor); }
Example #22
Source File: BlockTraverseWoodDoor.java From Traverse-Legacy-1-12-2 with MIT License | 4 votes |
@Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? Items.AIR : getDoorItem().getItem(); }
Example #23
Source File: EntityAICustomDoorInteract.java From Et-Futurum with The Unlicense | 4 votes |
private BlockDoor func_151503_a(int x, int y, int z) { Block block = theEntity.worldObj.getBlock(x, y, z); return block instanceof BlockDoor ? (BlockDoor) block : null; }
Example #24
Source File: MaterialCache.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
@Nullable protected ItemStack getStateToItemOverride(IBlockState state) { Block block = state.getBlock(); if (block == Blocks.PISTON_HEAD || block == Blocks.PISTON_EXTENSION || block == Blocks.PORTAL || block == Blocks.END_PORTAL || block == Blocks.END_GATEWAY) { return ItemStack.EMPTY; } else if (block == Blocks.FARMLAND) { return new ItemStack(Blocks.DIRT); } else if (block == Blocks.GRASS_PATH) { return new ItemStack(Blocks.GRASS); } else if (block == Blocks.BROWN_MUSHROOM_BLOCK) { return new ItemStack(Blocks.BROWN_MUSHROOM_BLOCK); } else if (block == Blocks.RED_MUSHROOM_BLOCK) { return new ItemStack(Blocks.RED_MUSHROOM_BLOCK); } else if (block == Blocks.LAVA) { if (state.getValue(BlockLiquid.LEVEL) == 0) { return new ItemStack(Items.LAVA_BUCKET); } else { return ItemStack.EMPTY; } } else if (block == Blocks.WATER) { if (state.getValue(BlockLiquid.LEVEL) == 0) { return new ItemStack(Items.WATER_BUCKET); } else { return ItemStack.EMPTY; } } else if (block instanceof BlockDoor && state.getValue(BlockDoor.HALF) == BlockDoor.EnumDoorHalf.UPPER) { return ItemStack.EMPTY; } else if (block instanceof BlockBed && state.getValue(BlockBed.PART) == BlockBed.EnumPartType.HEAD) { return ItemStack.EMPTY; } else if (block instanceof BlockDoublePlant && state.getValue(BlockDoublePlant.HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) { return ItemStack.EMPTY; } return null; }
Example #25
Source File: BlockTraverseWoodDoor.java From CommunityMod with GNU Lesser General Public License v2.1 | 4 votes |
@Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? Items.AIR : getDoorItem().getItem(); }
Example #26
Source File: BlockDoorBase.java From Sakura_mod with MIT License | 4 votes |
@Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? Items.AIR : this.getItem(); }
Example #27
Source File: BlockTofuDoor.java From TofuCraftReload with MIT License | 4 votes |
@Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? null : this.getItem(); }
Example #28
Source File: BlockMetalDoor.java From BaseMetals with GNU Lesser General Public License v2.1 | 4 votes |
@Override public Item getItemDropped(final IBlockState bs, final Random prng, final int i) { return (bs.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) ? null : cyano.basemetals.init.Items.getDoorItemForBlock(this); }
Example #29
Source File: StructureTofuVillagePieces.java From TofuCraftReload with MIT License | 4 votes |
protected BlockDoor func_189925_i() { return BlockLoader.TOFUMOMEN_DOOR; }
Example #30
Source File: ItemMetalDoor.java From BaseMetals with GNU Lesser General Public License v2.1 | 4 votes |
public ItemMetalDoor(BlockDoor block,MetalMaterial metal) { super(block); this.metal = metal; }