Here is an example of ore
public class BlockYourEpicOre extends Block {
public BlockYourEpicOre (String key, int id, Material material) {
super(key, id, material);
}
@Override
public ItemStack[] getBreakResult(World world, EnumDropCause dropCause, int x, int y, int z, int meta, TileEntity tileEntity) {
// If you don't want randomness, delete this and simply return the item stack with a specified number of items.
Random rand = new Random();
int random = rand.nextInt(100);
if (random < 80) { // 70% chance
return new ItemStack[]{new ItemStack(yourEpicOre, rand.nextInt(8))};
} else { // 30% chance
return new ItemStack[]{new ItemStack(yourEpicOre, rand.nextInt(3))};
}
}
}
terrain_api_version=1.4.4-7.2-pre1
modImplementation "com.github.UselessSolutions:TerrainAPI:v${project.terrain_api_version}"
public class TerrainApiPlugin implements TerrainAPI {
@Override
public String getModID() {
return MOD_ID;
}
public static final OverworldConfig overworldConfig = ChunkDecoratorOverworldAPI.overworldConfig;
@Override
public void onInitialize() {
ChunkDecoratorOverworldAPI.oreFeatures.addManagedOreFeature(getModID(), BlockYourEpicOre, 8, 64, 0.0f, 1.0f, false);
ChunkDecoratorNetherAPI.oreFeatures.addManagedOreFeature(getModID(), BlockYourEpicOre, 1, 16, 0.0f, 1.0f, false);
}
}
Adds an WorldFeatureOre, which has its generation characteristics managed by OreConfig Params:
https://github.com/LukeisStuff/randomite-bta
Thanks! Your mod was useful for learning how to add ores with TerrainApi.
https://github.com/LukeisStuff