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

The following examples show how to use net.minecraft.init.Blocks#STONE . 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: MapGenRavineExt.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop)
{
    net.minecraft.world.biome.Biome biome = world.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
    IBlockState state = data.getBlockState(x, y, z);
    IBlockState top = isExceptionBiome(biome) ? Blocks.GRASS.getDefaultState() : biome.topBlock;
    IBlockState filler = isExceptionBiome(biome) ? Blocks.DIRT.getDefaultState() : biome.fillerBlock;

    if (state.getBlock() == Blocks.STONE || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock() || (fillerBlock != null && state.getBlock() == fillerBlock.getBlock()))
    {
        if (y - 1 < 10)
        {
            data.setBlockState(x, y, z, FLOWING_LAVA);
        }
        else
        {
            data.setBlockState(x, y, z, AIR);

            if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock())
            {
                data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState());
            }
        }
    }
}
 
Example 2
Source File: BaseCreativeTab.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public ItemStack getTabIconItem() {
    if (iconSupplier == null) {
        GTLog.logger.error("Icon supplier was null for CreativeTab " + getTabLabel());
        return new ItemStack(Blocks.STONE);
    }

    ItemStack stack = iconSupplier.get();
    if (stack == null) {
        GTLog.logger.error("Icon supplier return null for CreativeTab " + getTabLabel());
        return new ItemStack(Blocks.STONE);
    }

    if (stack == ItemStack.EMPTY) {
        GTLog.logger.error("Icon built from iconSupplied is EMPTY for CreativeTab " + getTabLabel());
        return new ItemStack(Blocks.STONE);
    }

    return stack;
}
 
Example 3
Source File: MapGenTofuCaves.java    From TofuCraftReload with MIT License 6 votes vote down vote up
protected boolean canReplaceBlock(IBlockState p_175793_1_, IBlockState p_175793_2_) {
    if (p_175793_1_.getBlock() == Blocks.STONE) {
        return true;
    } else if (p_175793_1_.getBlock() == Blocks.DIRT) {
        return true;
    } else if (p_175793_1_.getBlock() == Blocks.GRASS) {
        return true;
    } else if (p_175793_1_.getBlock() == Blocks.HARDENED_CLAY) {
        return true;
    } else if (p_175793_1_.getBlock() == Blocks.STAINED_HARDENED_CLAY) {
        return true;
    } else if (p_175793_1_.getBlock() == Blocks.SANDSTONE) {
        return true;
    } else if (p_175793_1_.getBlock() == Blocks.RED_SANDSTONE) {
        return true;
    } else if (p_175793_1_.getBlock() == Blocks.MYCELIUM) {
        return true;
    } else if (p_175793_1_.getBlock() == Blocks.SNOW_LAYER) {
        return true;
    } else {
        return (/*p_175793_1_.getBlock() == TcBlocks.tofuMinced || */p_175793_1_.getBlock() == Blocks.GRAVEL)
                && p_175793_2_.getMaterial() != Material.WATER;

    }
}
 
Example 4
Source File: CustomizableOreGen.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
public boolean apply(IBlockState p_apply_1_)
{
	if (p_apply_1_ != null) {
		if(p_apply_1_.getBlock() == Blocks.STONE)
		{
			BlockStone.EnumType blockstone$enumtype = (BlockStone.EnumType)p_apply_1_.getValue(BlockStone.VARIANT);
			return blockstone$enumtype.isNatural();
		} 
		else if(p_apply_1_.getBlock() == state.getBlock())
		{
			return true;
		}
	}
	
	return false;
}
 
Example 5
Source File: EntityItemAbducted.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
/**
 * Returns the ItemStack corresponding to the Entity (Note: if no item exists, will log an error but still return an
 * ItemStack containing Block.stone)
 */
public ItemStack getEntityItem()
{
    ItemStack itemstack = (ItemStack)(this.getDataManager().get(ITEM));

    if (itemstack == null)
    {
        return new ItemStack(Blocks.STONE);
    }
    else
    {
        return itemstack;
    }
}
 
Example 6
Source File: MetaTileEntityLockedSafe.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static ItemStack getItemStackForIngredient(CountableIngredient ingredient) {
    ItemStack[] matchingStacks = ingredient.getIngredient().getMatchingStacks();
    if (matchingStacks.length == 0) {
        GTLog.logger.error("Ingredient " + ingredient.getIngredient() + " doesn't have matching stacks to display!");
    }
    ItemStack itemStack = matchingStacks.length == 0 ? new ItemStack(Blocks.STONE) : matchingStacks[0];
    return GTUtility.copyAmount(ingredient.getCount(), itemStack);
}
 
Example 7
Source File: FacadeItem.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static ItemStack getFacadeStack(ItemStack itemStack) {
    ItemStack unsafeStack = getFacadeStackUnsafe(itemStack);
    if (unsafeStack == null) {
        return new ItemStack(Blocks.STONE);
    }
    return unsafeStack;
}
 
Example 8
Source File: GTBedrockOreMineable.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean apply(IBlockState state) {
	if (state != null && state.getBlock() == Blocks.STONE) {
		BlockStone.EnumType type = (BlockStone.EnumType) state.getValue(BlockStone.VARIANT);
		return type.isNatural();
	} else {
		return false;
	}
}
 
Example 9
Source File: BiomeCanyon.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
@Override
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
	int i = worldIn.getSeaLevel();
	IBlockState iblockstate = this.topBlock;
	IBlockState iblockstate1 = this.fillerBlock;
	int j = -1;
	int k = (int) (noiseVal / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
	int l = x & 15;
	int i1 = z & 15;
	BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

	for (int j1 = 255; j1 >= 0; --j1) {
		if (j1 <= rand.nextInt(5)) {
			chunkPrimerIn.setBlockState(i1, j1, l, BEDROCK);
		} else {
			IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l);

			if (iblockstate2.getMaterial() == Material.AIR) {
				j = -1;
			} else if (iblockstate2.getBlock() == Blocks.STONE) {
				if (j == -1) {
					if (k <= 0) {
						iblockstate = AIR;
						iblockstate1 = STONE;
					} else if (j1 >= i - 4 && j1 <= i + 1) {
						iblockstate = this.topBlock;
						iblockstate1 = this.fillerBlock;
					}

					if (j1 < i && (iblockstate == null || iblockstate.getMaterial() == Material.AIR)) {
						if (this.getTemperature(blockpos$mutableblockpos.setPos(x, j1, z)) < 0.15F) {
							iblockstate = ICE;
						} else {
							iblockstate = WATER;
						}
					}

					j = k;

					if (j1 >= i - 1) {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate);
					} else if (j1 < i - 7 - k) {
						iblockstate = AIR;
						iblockstate1 = STONE;
						chunkPrimerIn.setBlockState(i1, j1, l, GRAVEL);
					} else {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);
					}
				} else if (j > 0) {
					--j;
					chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);

					if (j == 0 && iblockstate1.getBlock() == Blocks.SAND && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? RED_SANDSTONE : SANDSTONE;
					}

					if (j == 0 && iblockstate == redRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate = redRock;
					}

					if (j == 0 && iblockstate1 == redRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = redRock;
					}
				}
			}
		}
	}
}
 
Example 10
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 11
Source File: Core.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isTerrain(IBlockState state)
{
	return isSoil(state) || isSand(state) || isStone(state) || isGravel(state)|| state.getBlock() == Blocks.STONE;
}
 
Example 12
Source File: LPWorldGen.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
public static OreGen addOreGen(String name, IBlockState state, int maxVeinSize, int minY, int maxY, int chunkOccurence, int weight) {
	OreGen gen = new OreGen(name, state, maxVeinSize, Blocks.STONE, minY, maxY, chunkOccurence, weight);
	generators.add(gen);
	return gen;
}
 
Example 13
Source File: WorldGenSurfacePatch.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
public WorldGenSurfacePatch(IBlockState state, int size) {
	this(state, size, Blocks.DIRT, Blocks.GRASS, Blocks.STONE);
}
 
Example 14
Source File: WorldGenPatch.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
public WorldGenPatch(IBlockState state, int size) {
    this(state, size, Blocks.DIRT, Blocks.GRASS, Blocks.STONE);
}
 
Example 15
Source File: BiomeCragCliffs.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
@Override
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
	int i = worldIn.getSeaLevel();
	IBlockState iblockstate = this.topBlock;
	IBlockState iblockstate1 = this.fillerBlock;
	int j = -1;
	int k = (int) (noiseVal / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
	int l = x & 15;
	int i1 = z & 15;
	BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

	for (int j1 = 255; j1 >= 0; --j1) {
		if (j1 <= rand.nextInt(5)) {
			chunkPrimerIn.setBlockState(i1, j1, l, BEDROCK);
		} else {
			IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l);

			if (iblockstate2.getMaterial() == Material.AIR) {
				j = -1;
			} else if (iblockstate2.getBlock() == Blocks.STONE) {
				if (j == -1) {
					if (k <= 0) {
						iblockstate = AIR;
						iblockstate1 = STONE;
					} else if (j1 >= i - 4 && j1 <= i + 1) {
						iblockstate = this.topBlock;
						iblockstate1 = this.fillerBlock;
					}

					if (j1 < i && (iblockstate == null || iblockstate.getMaterial() == Material.AIR)) {
						if (this.getTemperature(blockpos$mutableblockpos.setPos(x, j1, z)) < 0.15F) {
							iblockstate = ICE;
						} else {
							iblockstate = WATER;
						}
					}

					j = k;

					if (j1 >= i - 1) {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate);
					} else if (j1 < i - 7 - k) {
						iblockstate = AIR;
						iblockstate1 = STONE;
						chunkPrimerIn.setBlockState(i1, j1, l, GRAVEL);
					} else {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);
					}
				} else if (j > 0) {
					--j;
					chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);

					if (j == 0 && iblockstate1.getBlock() == Blocks.SAND && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? RED_SANDSTONE : SANDSTONE;
					}

					if (j == 0 && iblockstate == blueRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate = blueRock;
					}

					if (j == 0 && iblockstate1 == blueRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = blueRock;
					}
				}
			}
		}
	}
}
 
Example 16
Source File: WorldGenSurfacePatch.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public WorldGenSurfacePatch(IBlockState state, int size) {
	this(state, size, Blocks.DIRT, Blocks.GRASS, Blocks.STONE);
}
 
Example 17
Source File: WorldGenPatch.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public WorldGenPatch(IBlockState state, int size) {
    this(state, size, Blocks.DIRT, Blocks.GRASS, Blocks.STONE);
}
 
Example 18
Source File: BiomeCragCliffs.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
	int i = worldIn.getSeaLevel();
	IBlockState iblockstate = this.topBlock;
	IBlockState iblockstate1 = this.fillerBlock;
	int j = -1;
	int k = (int) (noiseVal / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
	int l = x & 15;
	int i1 = z & 15;
	BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

	for (int j1 = 255; j1 >= 0; --j1) {
		if (j1 <= rand.nextInt(5)) {
			chunkPrimerIn.setBlockState(i1, j1, l, BEDROCK);
		} else {
			IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l);

			if (iblockstate2.getMaterial() == Material.AIR) {
				j = -1;
			} else if (iblockstate2.getBlock() == Blocks.STONE) {
				if (j == -1) {
					if (k <= 0) {
						iblockstate = AIR;
						iblockstate1 = STONE;
					} else if (j1 >= i - 4 && j1 <= i + 1) {
						iblockstate = this.topBlock;
						iblockstate1 = this.fillerBlock;
					}

					if (j1 < i && (iblockstate == null || iblockstate.getMaterial() == Material.AIR)) {
						if (this.getTemperature(blockpos$mutableblockpos.setPos(x, j1, z)) < 0.15F) {
							iblockstate = ICE;
						} else {
							iblockstate = WATER;
						}
					}

					j = k;

					if (j1 >= i - 1) {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate);
					} else if (j1 < i - 7 - k) {
						iblockstate = AIR;
						iblockstate1 = STONE;
						chunkPrimerIn.setBlockState(i1, j1, l, GRAVEL);
					} else {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);
					}
				} else if (j > 0) {
					--j;
					chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);

					if (j == 0 && iblockstate1.getBlock() == Blocks.SAND && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? RED_SANDSTONE : SANDSTONE;
					}

					if (j == 0 && iblockstate == blueRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate = blueRock;
					}

					if (j == 0 && iblockstate1 == blueRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = blueRock;
					}
				}
			}
		}
	}
}
 
Example 19
Source File: BiomeCanyon.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
	int i = worldIn.getSeaLevel();
	IBlockState iblockstate = this.topBlock;
	IBlockState iblockstate1 = this.fillerBlock;
	int j = -1;
	int k = (int) (noiseVal / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
	int l = x & 15;
	int i1 = z & 15;
	BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

	for (int j1 = 255; j1 >= 0; --j1) {
		if (j1 <= rand.nextInt(5)) {
			chunkPrimerIn.setBlockState(i1, j1, l, BEDROCK);
		} else {
			IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l);

			if (iblockstate2.getMaterial() == Material.AIR) {
				j = -1;
			} else if (iblockstate2.getBlock() == Blocks.STONE) {
				if (j == -1) {
					if (k <= 0) {
						iblockstate = AIR;
						iblockstate1 = STONE;
					} else if (j1 >= i - 4 && j1 <= i + 1) {
						iblockstate = this.topBlock;
						iblockstate1 = this.fillerBlock;
					}

					if (j1 < i && (iblockstate == null || iblockstate.getMaterial() == Material.AIR)) {
						if (this.getTemperature(blockpos$mutableblockpos.setPos(x, j1, z)) < 0.15F) {
							iblockstate = ICE;
						} else {
							iblockstate = WATER;
						}
					}

					j = k;

					if (j1 >= i - 1) {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate);
					} else if (j1 < i - 7 - k) {
						iblockstate = AIR;
						iblockstate1 = STONE;
						chunkPrimerIn.setBlockState(i1, j1, l, GRAVEL);
					} else {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);
					}
				} else if (j > 0) {
					--j;
					chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);

					if (j == 0 && iblockstate1.getBlock() == Blocks.SAND && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? RED_SANDSTONE : SANDSTONE;
					}

					if (j == 0 && iblockstate == redRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate = redRock;
					}

					if (j == 0 && iblockstate1 == redRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = redRock;
					}
				}
			}
		}
	}
}