mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-18 19:39:06 +00:00
55 lines
2.3 KiB
Java
55 lines
2.3 KiB
Java
package magicbees.bees.allele.effect;
|
|
|
|
import java.util.Locale;
|
|
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.world.World;
|
|
import net.minecraft.world.biome.BiomeGenBase;
|
|
import net.minecraftforge.common.BiomeDictionary;
|
|
import net.minecraftforge.oredict.OreDictionary;
|
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
|
import magicbees.api.bees.ITransmutationEffectLogic;
|
|
|
|
public class TransmutationEffectRailcraft implements ITransmutationEffectLogic {
|
|
|
|
@Override
|
|
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
|
boolean flag = false;
|
|
if (OreDictionary.itemMatches(new ItemStack(Blocks.stone), sourceBlock, false)
|
|
|| OreDictionary.itemMatches(new ItemStack(Blocks.cobblestone), sourceBlock, false)) {
|
|
flag = trySpawnQuarriedStone(world, biome, sourceBlock, x, y, z)
|
|
|| trySpawnAbyssalStone(world, biome, sourceBlock, x, y, z);
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
private boolean trySpawnQuarriedStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
|
boolean flag = false;
|
|
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)
|
|
&& !BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
|
|
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.quarried", 1);
|
|
if (item != null) {
|
|
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
|
|
flag = true;
|
|
}
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
private boolean trySpawnAbyssalStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
|
boolean flag = false;
|
|
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WATER)
|
|
&& !biome.biomeName.toLowerCase(Locale.ENGLISH).contains("river")) {
|
|
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.abyssal", 1);
|
|
if (item != null) {
|
|
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
|
|
flag = true;
|
|
}
|
|
}
|
|
return flag;
|
|
}
|
|
}
|