use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.
the class GemsWorldGenerator method generateFlowers.
private void generateFlowers(World world, Random random, int posX, int posZ) {
int i, x, y, z, meta;
IBlockState state;
BlockPos pos;
for (i = 0; i < GemsConfig.GLOW_ROSE_PER_CHUNK; ++i) {
x = posX + 8 + random.nextInt(16);
y = random.nextInt(120) + 50;
z = posZ + 8 + random.nextInt(16);
pos = new BlockPos(x, y, z);
meta = random.nextInt(16);
EnumGem gem = EnumGem.values()[meta];
state = ModBlocks.glowRose.getDefaultState().withProperty(EnumGem.VARIANT_GEM, gem);
// Find top-most valid block
for (; y > 50; --y) {
if (world.isAirBlock(pos) && pos.getY() < 255 && ModBlocks.glowRose.canBlockStay(world, pos, state)) {
world.setBlockState(pos, state, 2);
break;
}
pos = pos.down();
}
}
}
use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.
the class GeodeGenerator method generateGems.
public void generateGems(World worldIn, Random rand, BlockPos position, float diameterXZ, float diameterY) {
Predicate shellPredicate = BlockMatcher.forBlock(shellBlock.getBlock());
diameterXZ *= GemsConfig.GEODE_FILL_RATIO;
diameterY *= GemsConfig.GEODE_FILL_RATIO;
int xmin = (int) (position.getX() - diameterXZ / 2);
int xmax = (int) (position.getX() + diameterXZ / 2);
int ymin = (int) (position.getY() - diameterY / 2);
int ymax = (int) (position.getY() + diameterY / 2);
int zmin = (int) (position.getZ() - diameterXZ / 2);
int zmax = (int) (position.getZ() + diameterXZ / 2);
Block block = gemSet == Set.LIGHT ? ModBlocks.gemOreLight : gemSet == Set.DARK ? ModBlocks.gemOreDark : ModBlocks.gemOre;
int count = 0;
for (int x = xmin; x <= xmax; ++x) {
float dx = x - position.getX();
for (int y = ymin; y <= ymax; ++y) {
float dy = y - position.getY();
for (int z = zmin; z <= zmax; ++z) {
float dz = z - position.getZ();
if ((dx * dx) / (diameterXZ * diameterXZ) + (dy * dy) / (diameterY * diameterY) + (dz * dz) / (diameterXZ * diameterXZ) <= 0.25f) {
// We are in the spawn area.
if (rand.nextFloat() <= GemsConfig.GEODE_GEM_DENSITY) {
++count;
BlockPos blockpos = new BlockPos(x, y, z);
IBlockState state = worldIn.getBlockState(blockpos);
if (state.getBlock().isReplaceableOreGen(state, worldIn, blockpos, shellPredicate)) {
EnumGem gem = EnumGem.values()[rand.nextInt(16)];
IBlockState stateToPlace = block.getDefaultState().withProperty(EnumGem.VARIANT_GEM, gem);
worldIn.setBlockState(blockpos, stateToPlace, 2);
}
}
// TODO: Doesn't seem to work very well...
if (GemsConfig.GEODE_SEAL_BREAKS) {
for (EnumFacing facing : EnumFacing.values()) {
BlockPos offset = position.offset(facing);
IBlockState adjacent = worldIn.getBlockState(offset);
if (worldIn.isAirBlock(offset) || adjacent != shellBlock && adjacent.getBlock() != block) {
worldIn.setBlockState(offset, shellBlock);
}
}
}
}
}
}
}
// SilentGems.logHelper.debug(xmin, xmax, ymin, ymax, zmin, zmax, count);
}
use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.
the class ItemGem method addOreDict.
@Override
public void addOreDict() {
for (EnumGem gem : EnumGem.values()) {
OreDictionary.registerOre(gem.getItemOreName(), gem.getItem());
OreDictionary.registerOre(gem.getItemSuperOreName(), gem.getItemSuper());
}
}
use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.
the class ItemGem method clAddInformation.
@Override
public void clAddInformation(ItemStack stack, World world, List list, boolean advanced) {
EnumGem gem = EnumGem.getFromStack(stack);
boolean controlDown = KeyTracker.isControlDown();
if (controlDown && (gem == EnumGem.RUBY || gem == EnumGem.BERYL || gem == EnumGem.SAPPHIRE || gem == EnumGem.TOPAZ)) {
list.add(SilentGems.localizationHelper.getItemSubText(itemName, "original4"));
}
}
use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.
the class ItemGem method addRecipes.
@Override
public void addRecipes(RecipeMaker recipes) {
String centerItem = GemsConfigHC.HARD_SUPER_GEMS ? "gemEnderEssence" : "dustGlowstone";
for (EnumGem gem : EnumGem.values()) {
// Supercharged gems
recipes.addShapedOre("gem_super_" + gem.name(), gem.getItemSuper(), "cgc", "cdc", "cgc", 'g', gem.getItem(), 'd', centerItem, 'c', "gemChaos");
// Gems <--> shards
recipes.addCompression("gem_" + gem.name(), gem.getShard(), gem.getItem(), 9);
ItemStack shards = gem.getShard();
StackHelper.setCount(shards, 9);
recipes.addShapelessOre("gem_shard_" + gem.name() + "_oredict", shards, gem.getItemOreName());
}
}
Aggregations