use of gregtech.common.blocks.wood.BlockGregSapling in project GregTech by GregTechCE.
the class MetaBlocks method init.
public static void init() {
GregTechAPI.MACHINE = MACHINE = new BlockMachine();
MACHINE.setRegistryName("machine");
CABLE = new BlockCable();
CABLE.setRegistryName("cable");
FLUID_PIPE = new BlockFluidPipe();
FLUID_PIPE.setRegistryName("fluid_pipe");
BOILER_CASING = new BlockBoilerCasing();
BOILER_CASING.setRegistryName("boiler_casing");
BOILER_FIREBOX_CASING = new BlockFireboxCasing();
BOILER_FIREBOX_CASING.setRegistryName("boiler_firebox_casing");
METAL_CASING = new BlockMetalCasing();
METAL_CASING.setRegistryName("metal_casing");
TURBINE_CASING = new BlockTurbineCasing();
TURBINE_CASING.setRegistryName("turbine_casing");
MACHINE_CASING = new BlockMachineCasing();
MACHINE_CASING.setRegistryName("machine_casing");
MUTLIBLOCK_CASING = new BlockMultiblockCasing();
MUTLIBLOCK_CASING.setRegistryName("multiblock_casing");
WIRE_COIL = new BlockWireCoil();
WIRE_COIL.setRegistryName("wire_coil");
WARNING_SIGN = new BlockWarningSign();
WARNING_SIGN.setRegistryName("warning_sign");
GRANITE = new BlockGranite();
GRANITE.setRegistryName("granite");
MINERAL = new BlockMineral();
MINERAL.setRegistryName("mineral");
CONCRETE = new BlockConcrete();
CONCRETE.setRegistryName("concrete");
FOAM = new BlockFoam(false);
FOAM.setRegistryName("foam");
REINFORCED_FOAM = new BlockFoam(true);
REINFORCED_FOAM.setRegistryName("reinforced_foam");
PETRIFIED_FOAM = new BlockPetrifiedFoam(false);
PETRIFIED_FOAM.setRegistryName("petrified_foam");
REINFORCED_PETRIFIED_FOAM = new BlockPetrifiedFoam(true);
REINFORCED_PETRIFIED_FOAM.setRegistryName("reinforced_petrified_foam");
LOG = new BlockGregLog();
LOG.setRegistryName("log");
LEAVES = new BlockGregLeaves();
LEAVES.setRegistryName("leaves");
SAPLING = new BlockGregSapling();
SAPLING.setRegistryName("sapling");
CRUSHER_BLADE = new BlockCrusherBlade();
CRUSHER_BLADE.setRegistryName("crusher_blade");
SURFACE_ROCK_NEW = new BlockSurfaceRockNew();
SURFACE_ROCK_NEW.setRegistryName("surface_rock_new");
StoneType.init();
createGeneratedBlock(material -> material instanceof DustMaterial && !OrePrefix.block.isIgnored(material), MetaBlocks::createCompressedBlock);
createGeneratedBlock(material -> material instanceof IngotMaterial && material.hasFlag(MatFlags.GENERATE_ORE), MetaBlocks::createSurfaceRockBlock);
for (Material material : Material.MATERIAL_REGISTRY) {
if (material instanceof DustMaterial && material.hasFlag(DustMaterial.MatFlags.GENERATE_ORE)) {
createOreBlock((DustMaterial) material);
}
if (material instanceof SolidMaterial && material.hasFlag(GENERATE_FRAME)) {
BlockFrame blockFrame = new BlockFrame((SolidMaterial) material);
blockFrame.setRegistryName("frame_" + material.toString());
FRAMES.put((SolidMaterial) material, blockFrame);
}
if (material instanceof IngotMaterial) {
IngotMaterial metalMaterial = (IngotMaterial) material;
if (metalMaterial.cableProperties != null) {
CABLE.addCableMaterial(metalMaterial, metalMaterial.cableProperties);
}
if (metalMaterial.fluidPipeProperties != null) {
FLUID_PIPE.addPipeMaterial(metalMaterial, metalMaterial.fluidPipeProperties);
}
}
}
FLUID_PIPE.addPipeMaterial(Materials.Wood, new FluidPipeProperties(310, 20, false));
CABLE.addCableMaterial(MarkerMaterials.Tier.Superconductor, new WireProperties(Integer.MAX_VALUE, 4, 0));
registerTileEntity();
// not sure if that's a good place for that, but i don't want to make a dedicated method for that
// could possibly override block methods, but since these props don't depend on state why not just use nice and simple vanilla method
Blocks.FIRE.setFireInfo(LOG, 5, 5);
Blocks.FIRE.setFireInfo(LEAVES, 30, 60);
}
use of gregtech.common.blocks.wood.BlockGregSapling in project GregTech by GregTechCE.
the class WorldGenRubberTree method generate.
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
if (world.getWorldType() == WorldType.FLAT || !world.provider.isSurfaceWorld()) {
// do not generate in flat worlds, or in non-surface worlds
return;
}
BlockPos randomPos = new BlockPos(chunkX * 16 + 8, 0, chunkZ * 16 + 8);
Biome biome = world.getBiome(randomPos);
if (BiomeDictionary.hasType(biome, Type.COLD) || BiomeDictionary.hasType(biome, Type.HOT) || BiomeDictionary.hasType(biome, Type.DRY) || BiomeDictionary.hasType(biome, Type.DEAD) || BiomeDictionary.hasType(biome, Type.SPOOKY))
// do not generate in inappropriate biomes
return;
int rubberTreeChance = 6;
if (BiomeDictionary.hasType(biome, Type.SWAMP) || BiomeDictionary.hasType(biome, Type.WET))
// double chance of spawning in swamp or wet biomes
rubberTreeChance /= 2;
if (random.nextInt(rubberTreeChance) == 0) {
randomPos = world.getTopSolidOrLiquidBlock(randomPos).down();
IBlockState solidBlockState = world.getBlockState(randomPos);
BlockGregSapling sapling = MetaBlocks.SAPLING;
if (solidBlockState.getBlock().canSustainPlant(solidBlockState, world, randomPos, EnumFacing.UP, sapling)) {
BlockPos abovePos = randomPos.up();
IBlockState aboveState = world.getBlockState(abovePos);
if (aboveState.getBlock() instanceof BlockLiquid) {
return;
}
IBlockState saplingState = sapling.getDefaultState().withProperty(BlockGregSapling.VARIANT, LogVariant.RUBBER_WOOD);
world.setBlockState(abovePos, saplingState);
sapling.generateTree(world, abovePos, saplingState, random);
}
}
}
Aggregations