net.minecraft.block.state.pattern.BlockMatcher Java Examples

The following examples show how to use net.minecraft.block.state.pattern.BlockMatcher. 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: GTOreGenerator.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void generateBedrockVein(Block block, World world, Random rand, int chunkX, int chunkZ) {
	GTBedrockOreMineable generator = new GTBedrockOreMineable(block.getDefaultState(), GTConfig.generation.bedrockOreSize, BlockMatcher.forBlock(Blocks.BEDROCK));
	int minHeight = 0;
	int maxHeight = 10;
	int heightdiff = maxHeight - minHeight + 1;
	int chance = 8192;
	for (int i = 0; i < GTConfig.generation.bedrockOreWeight; i++) {
		int var1 = rand.nextInt(chance);
		if (var1 == 0) {
			int x = chunkX * 16 + rand.nextInt(16);
			int y = 0 + rand.nextInt(heightdiff);
			int z = chunkZ * 16 + rand.nextInt(16);
			generator.generate(world, rand, new BlockPos(x, y, z));
		}
	}
}
 
Example #2
Source File: GTOreGenerator.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
/** rare ore generator **/
public static void generateRareVein(Block block, boolean generate, int blockAmount, int chancesToSpawn,
		int minHeight, int maxHeight, Block blockToReplace, World world, Random rand, int chunkX, int chunkZ) {
	if (generate) {
		WorldGenMinable generator = new WorldGenMinable(block.getDefaultState(), blockAmount, BlockMatcher.forBlock(blockToReplace));
		int heightdiff = maxHeight - minHeight + 1;
		for (int i = 0; i < chancesToSpawn; i++) {
			int var1 = rand.nextInt(1024);
			if (var1 == 0) {
				int x = chunkX * 16 + rand.nextInt(16);
				int y = minHeight + rand.nextInt(heightdiff);
				int z = chunkZ * 16 + rand.nextInt(16);
				generator.generate(world, rand, new BlockPos(x, y, z));
			}
		}
	}
}
 
Example #3
Source File: GTOreGenerator.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
/** default ore generator **/
public static void generateBasicVein(Block block, boolean generate, int blockAmount, int chancesToSpawn,
		int minHeight, int maxHeight, Block blockToReplace, World world, Random rand, int chunkX, int chunkZ) {
	if (generate) {
		WorldGenMinable generator = new WorldGenMinable(block.getDefaultState(), blockAmount, BlockMatcher.forBlock(blockToReplace));
		int heightdiff = maxHeight - minHeight + 1;
		for (int i = 0; i < chancesToSpawn; i++) {
			int x = chunkX * 16 + rand.nextInt(16);
			int y = minHeight + rand.nextInt(heightdiff);
			int z = chunkZ * 16 + rand.nextInt(16);
			generator.generate(world, rand, new BlockPos(x, y, z));
		}
	}
}
 
Example #4
Source File: OreGenerator.java    From YouTubeModdingTutorial with MIT License 5 votes vote down vote up
public void addOreSpawn(Block block, byte blockMeta, Block targetBlock, World world, Random random, int blockXPos, int blockZPos, int minVeinSize, int maxVeinSize, int chancesToSpawn, int minY, int maxY) {
    WorldGenMinable minable = new WorldGenMinable(block.getStateFromMeta(blockMeta), (minVeinSize + random.nextInt(maxVeinSize - minVeinSize + 1)), BlockMatcher.forBlock(targetBlock));
    for (int i = 0 ; i < chancesToSpawn ; i++) {
        int posX = blockXPos + random.nextInt(16);
        int posY = minY + random.nextInt(maxY - minY);
        int posZ = blockZPos + random.nextInt(16);
        minable.generate(world, random, new BlockPos(posX, posY, posZ));
    }
}
 
Example #5
Source File: LPWorldGen.java    From Logistics-Pipes-2 with MIT License 5 votes vote down vote up
public OreGen(String name, IBlockState state, int maxVeinSize, Block replaceTarget, int minY, int maxY, int chunkOccurence, int weight) {
	this.name = name;
	this.ore = new WorldGenMinable(state, maxVeinSize, BlockMatcher.forBlock(replaceTarget));
	this.minY = minY;
	this.maxY = maxY;
	this.chunkOccurence = chunkOccurence;
	this. weight = weight;
}