Java Code Examples for net.minecraft.init.Blocks#BEDROCK

The following examples show how to use net.minecraft.init.Blocks#BEDROCK . 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 vote down vote up
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: EventHandler.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onFlyFall(PlayerFlyableFallEvent event) {
	if (event.getEntityPlayer().getEntityWorld().provider.getDimension() == 0) {
		if (event.getEntityPlayer().posY <= 0) {
			BlockPos location = event.getEntityPlayer().getPosition();
			BlockPos bedrock = PosUtils.checkNeighborBlocksThoroughly(event.getEntity().getEntityWorld(), location, Blocks.BEDROCK);
			if (bedrock != null) {
				if (event.getEntity().getEntityWorld().getBlockState(bedrock).getBlock() == Blocks.BEDROCK) {
					TeleportUtil.teleportToDimension(event.getEntityPlayer(), Wizardry.underWorld.getId(), 0, 300, 0);
					((EntityPlayer) event.getEntity()).addPotionEffect(new PotionEffect(ModPotions.NULLIFY_GRAVITY, 100, 0, true, false));
					fallResetter.add(event.getEntity().getUniqueID());
				}
			}
		}
	}
}
 
Example 3
Source File: HoleOverlayComponent.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
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: ShipSpawnDetector.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isValidExpansion(int x, int y, int z) {
    mutablePos.setPos(x, y, z);
    IBlockState state = cache.getBlockState(mutablePos);
    if (state.getBlock() == Blocks.BEDROCK) {
        cleanHouse = true;
        return false;
    }
    return !blacklist.contains(state.getBlock());
}
 
Example 5
Source File: ChunkProviderSurface.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This is for stripping a chunk of all but ore and BEDROCK for easier testing.
 */
protected void stripChunk(ChunkPrimer primer)
{
	Point p;
	Center closestCenter;
	IBlockState state;
	for(int x = 0; x < 16; x++)
	{
		for(int z = 0; z < 16; z++)
		{
			p = new Point(x, z);
			closestCenter = this.getHex(p);
			int hexElev = this.getHexElevation(closestCenter, p);

			if(closestCenter.hasAnyMarkersOf(Marker.Coast, Marker.Ocean))
				continue;

			for(int y = hexElev; y >= 0; y--)
			{
				state = primer.getBlockState(x, y, z);
				if(state.getBlock() != TFCBlocks.Ore && state.getBlock() != Blocks.BEDROCK && state.getBlock() != Blocks.WOOL)
				{
					primer.setBlockState(x, y, z, Blocks.AIR.getDefaultState());
				}
			}
		}
	}
}
 
Example 6
Source File: BlockStone.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean canBeSupportedBy(IBlockState myState, IBlockState otherState)
{
	if(otherState.getBlock() == this || otherState.getBlock() instanceof ISupportBlock || otherState.getBlock() == Blocks.BEDROCK || Core.isSoil(otherState))
		return true;
	return false;
}
 
Example 7
Source File: GTTileBedrockMiner.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
public boolean isMinerProperlySet() {
	Block block = world.getBlockState(pos.down()).getBlock();
	return block == Blocks.BEDROCK || GTBedrockOreHandler.isBedrockOre(block);
}
 
Example 8
Source File: ChunkProviderSurface.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
protected void generateTerrain(ChunkPrimer chunkprimer, int chunkX, int chunkZ)
{
	Point p;
	Center closestCenter = null;
	double[] dts = new double[] {0,0};
	double dist = 0;
	double loc = 0;

	int maxHeightOfChunk = 255;

	for(int x = 0; x < 16; x++)
	{
		for(int z = 0; z < 16; z++)
		{
			p = new Point(x, z);
			closestCenter = this.getHex(p);


			int hexElev = 0;
			if(!closestCenter.hasAttribute(Attribute.River) && !closestCenter.hasMarker(Marker.Coast) && !closestCenter.hasMarker(Marker.CoastWater) && !closestCenter.hasAttribute(Attribute.Lake))
			{
				//hexElev = convertElevation(getSmoothHeightHex(closestCenter, p));
				hexElev = convertElevation(getSmoothHeightHex(closestCenter, p)) + (int)Math.ceil(turbMap.GetValue(worldX+p.x, worldZ+p.y));
			}
			else if(closestCenter.hasMarker(Marker.CoastWater))
			{
				hexElev = convertElevation(closestCenter.getElevation()) + getBeachTurb(closestCenter, p, 2);
			}
			else 
			{
				hexElev = convertElevation(getSmoothHeightHex(closestCenter, p));
			}
			int scanElev = hexElev;

			if(closestCenter.biome == BiomeType.LAKE || closestCenter.biome == BiomeType.LAKESHORE)
			{
				LakeAttribute attrib = (LakeAttribute) closestCenter.getAttribute(Attribute.Lake);
				scanElev = convertElevation(attrib.getLakeElev());
			}

			if(closestCenter.hasMarker(Marker.Ocean))
			{
				Vector<Center> nearCenters = getCentersNear(p, 9);
				boolean onlyOcean = true;
				for(Center c : nearCenters)
				{
					if(!c.hasMarker(Marker.Ocean))
					{
						onlyOcean = false;
					}
				}

				if(onlyOcean)
					hexElev = convertElevation(getSmoothHeightHex(closestCenter, p, 9));
			}

			if(closestCenter.hasMarker(Marker.Spire))
			{
				Random r = new Random(closestCenter.index);
				double heightMult = r.nextDouble();
				double spireElev = closestCenter.getElevation() + (1-closestCenter.getElevation())*(0.5+heightMult*0.3);
				double diff = spireElev - closestCenter.getElevation();
				double rad = 20;
				dist = closestCenter.point.plus(-5+r.nextInt(11), -5+r.nextInt(11)).distance(p.plus(new Point(worldX, worldZ).toIslandCoord()));
				dist /= 20;
				dist = 1-dist;

				if(dist > 0.95)
					dist = 0.95;

				hexElev = convertElevation(getSmoothHeightHex(closestCenter, p) + (diff*(Math.pow(dist, 5))));
				scanElev = hexElev;
			}


			maxHeightOfChunk = Math.max(maxHeightOfChunk, scanElev);
			elevationMap[z << 4 | x] = hexElev;
			for(int y = Math.min(Math.max(scanElev, Global.SEALEVEL), 255); y >= 0; y--)
			{
				Block b = Blocks.AIR;
				if(y < hexElev)
				{
					b = Blocks.STONE;
				}
				else if(y < Global.SEALEVEL || (closestCenter.hasAttribute(Attribute.Lake) && y < scanElev))
				{
					b = Blocks.WATER;
				}

				if(y <= hexElev * 0.2)
					b = Blocks.BEDROCK;

				chunkprimer.setBlockState(x, y, z, b.getDefaultState());
			}
		}
	}
}
 
Example 9
Source File: BlockCollapsible.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
public boolean canBeSupportedBy(IBlockState myState, IBlockState otherState)
{
	if(otherState.getBlock() == this || Core.isTerrain(otherState) || otherState.getBlock() instanceof ISupportBlock || otherState.getBlock() == Blocks.BEDROCK)
		return true;
	return false;
}