mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-21 12:42:53 +00:00
* Finalize, minor alloc reduction Also enable Jabel and generic injection * Update dependencies.gradle * Clean up Machine a bit * spotless more enhanced instanceof * Update ModuleMachine.java * More clen * WARN: Removed exception catching * Many, many tiny patches + birthday fix * Spotless * Spotless again * Fix getLow and clamp tolerance value * Revert event -> ignored on unused event parameters * Rename instanceof variables * Update Machine.java * Use StringBuilder * Cache getStack() * Oops, Jabel can't handle that * Spotless * Spotless again My IDE was fighting with it * Remove unused elements + scream test success
79 lines
2.5 KiB
Java
79 lines
2.5 KiB
Java
package binnie.extratrees.worldgen;
|
|
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.world.World;
|
|
import net.minecraft.world.gen.feature.WorldGenerator;
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
|
|
|
import com.mojang.authlib.GameProfile;
|
|
|
|
import binnie.extratrees.genetics.ExtraTreeSpecies;
|
|
import forestry.api.arboriculture.ITreeGenerator;
|
|
import forestry.api.arboriculture.ITreeGenome;
|
|
import forestry.api.world.ITreeGenData;
|
|
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
|
import forestry.arboriculture.genetics.Tree;
|
|
import forestry.arboriculture.tiles.TileLeaves;
|
|
import forestry.core.config.Constants;
|
|
import forestry.plugins.PluginArboriculture;
|
|
|
|
public class DefaultTreeGenerator implements ITreeGenerator {
|
|
|
|
private final ExtraTreeSpecies extraTreeSpecies;
|
|
|
|
public DefaultTreeGenerator(ExtraTreeSpecies extraTreeSpecies) {
|
|
this.extraTreeSpecies = extraTreeSpecies;
|
|
}
|
|
|
|
@Override
|
|
public void setLogBlock(ITreeGenome genome, World world, int x, int y, int z, ForgeDirection direction) {
|
|
if (extraTreeSpecies.wood != null) {
|
|
extraTreeSpecies.wood.placeBlock(world, x, y, z);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void setLeaves(ITreeGenome genome, World world, GameProfile owner, int x, int y, int z, boolean decorative) {
|
|
boolean placed = world
|
|
.setBlock(x, y, z, PluginArboriculture.blocks.leaves, 0, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
|
if (!placed) {
|
|
return;
|
|
}
|
|
|
|
Block block = world.getBlock(x, y, z);
|
|
if (PluginArboriculture.blocks.leaves != block) {
|
|
world.setBlockToAir(x, y, z);
|
|
return;
|
|
}
|
|
|
|
TileLeaves tileLeaves = BlockForestryLeaves.getLeafTile(world, x, y, z);
|
|
if (tileLeaves == null) {
|
|
world.setBlockToAir(x, y, z);
|
|
return;
|
|
}
|
|
|
|
tileLeaves.setOwner(owner);
|
|
if (decorative) {
|
|
tileLeaves.setDecorative();
|
|
}
|
|
|
|
tileLeaves.setTree(new Tree(genome));
|
|
world.markBlockForUpdate(x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public void setLogBlock(World world, int x, int y, int z, ForgeDirection direction) {
|
|
extraTreeSpecies.wood.placeBlock(world, x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public void setLeaves(World world, GameProfile player, int x, int y, int z, boolean arg5) {
|
|
// ignored
|
|
}
|
|
|
|
@Override
|
|
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
|
return extraTreeSpecies.getGenerator(tree);
|
|
}
|
|
}
|