Java Code Examples for net.minecraft.init.Blocks#OBSIDIAN
The following examples show how to use
net.minecraft.init.Blocks#OBSIDIAN .
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: CrystalAuraModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
private boolean canPlaceCrystal(BlockPos pos) { final Minecraft mc = Minecraft.getMinecraft(); final Block block = mc.world.getBlockState(pos).getBlock(); if (block == Blocks.OBSIDIAN || block == Blocks.BEDROCK) { final Block floor = mc.world.getBlockState(pos.add(0, 1, 0)).getBlock(); final Block ceil = mc.world.getBlockState(pos.add(0, 2, 0)).getBlock(); if (floor == Blocks.AIR && ceil == Blocks.AIR) { if (mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(pos.add(0, 1, 0))).isEmpty()) { if (mc.player.getDistance(pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f) <= this.range.getValue()) { return true; } } } } return false; }
Example 2
Source File: EntityMonolithEye.java From ToroQuest with GNU General Public License v3.0 | 6 votes |
protected void updateLogic() { if (this.world.isRemote) { return; } handleAttachLogicUpdate(); if (this.rand.nextFloat() < 7.5E-4F) { this.world.setEntityState(this, (byte) 15); } if (world.getTotalWorldTime() % 10L == 0L) { BlockPos down = pos.down(); if (world.getBlockState(down).getBlock() != Blocks.OBSIDIAN) { setHealth(0); } } }
Example 3
Source File: HoleOverlayComponent.java From seppuku with GNU General Public License v3.0 | 5 votes |
private Block getBlock(BlockPos pos) { final Block block = Minecraft.getMinecraft().world.getBlockState(pos).getBlock(); if ((block == Blocks.BEDROCK) || (block == Blocks.OBSIDIAN)) { return block; } return Blocks.AIR; }
Example 4
Source File: BlockPress.java From AdvancedRocketry with MIT License | 5 votes |
private ItemStack getRecipe(World world, BlockPos pos, IBlockState state) { if(world.isAirBlock(pos.add(0, -1, 0))) return null; IBlockState state2 = world.getBlockState(pos.add(0, -1, 0)); Block block = state2.getBlock(); Item item = Item.getItemFromBlock(block); if(item == null) return null; ItemStack stackInWorld = new ItemStack(item,1, block.getMetaFromState(state2)); List<IRecipe> recipes = RecipesMachine.getInstance().getRecipes(this.getClass()); ItemStack stack = null; for(IRecipe recipe : recipes) { for(ItemStack stack2 : recipe.getIngredients().get(0)) if(stack2.isItemEqual(stackInWorld)) { stack = recipe.getOutput().get(0); break; } } if(world.getBlockState(pos.add(0,-2,0)).getBlock() == Blocks.OBSIDIAN) return stack; return null; }
Example 5
Source File: ItemBasicLaserGun.java From AdvancedRocketry with MIT License | 4 votes |
public boolean canHarvestBlock(IBlockState blockIn) { Block block = blockIn.getBlock(); if (block == Blocks.OBSIDIAN) { return this.toolMaterial.getHarvestLevel() == 3; } else if (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE) { if (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK) { if (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE) { if (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE) { if (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE) { if (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE) { Material material = blockIn.getMaterial(); return material == Material.ROCK ? true : (material == Material.IRON ? true : material == Material.ANVIL); } else { return this.toolMaterial.getHarvestLevel() >= 2; } } else { return this.toolMaterial.getHarvestLevel() >= 1; } } else { return this.toolMaterial.getHarvestLevel() >= 1; } } else { return this.toolMaterial.getHarvestLevel() >= 2; } } else { return this.toolMaterial.getHarvestLevel() >= 2; } } else { return this.toolMaterial.getHarvestLevel() >= 2; } }
Example 6
Source File: ItemPortalScaler.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { // If the player is standing inside a portal, then we try to activate the teleportation in onItemRightClick() if (EntityUtils.isEntityCollidingWithBlockSpace(world, player, Blocks.PORTAL)) { return EnumActionResult.PASS; } Block block = world.getBlockState(pos).getBlock(); // When right clicking on a Nether Portal block, shut down the portal if (block == Blocks.PORTAL) { if (world.isRemote == false && world.isBlockModifiable(player, pos)) { world.destroyBlock(pos, false); } return EnumActionResult.SUCCESS; } if (world.isRemote) { return EnumActionResult.SUCCESS; } ItemStack stack = player.getHeldItem(hand); // When right clicking on Obsidian, try to light a Nether Portal if (block == Blocks.OBSIDIAN && world.isAirBlock(pos.offset(side)) && world.isBlockModifiable(player, pos.offset(side)) && UtilItemModular.useEnderCharge(stack, ENDER_CHARGE_COST_PORTAL_ACTIVATION, true) && Blocks.PORTAL.trySpawnPortal(world, pos.offset(side))) { UtilItemModular.useEnderCharge(stack, ENDER_CHARGE_COST_PORTAL_ACTIVATION, false); world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_BLAZE_SHOOT, SoundCategory.MASTER, 0.8f, 1.0f); return EnumActionResult.SUCCESS; } return EnumActionResult.PASS; }