Buildscript

This commit is contained in:
kuba6000 committed 2022-10-12 21:09:18 +02:00
1 parent e73f5a841e
commit d993c90c3e
18 files changed
+1918 -1516

No files matched your search

@@ -1,8 +1,8 @@
package magicbees.api.bees;
public enum AuraChargeType {
MUTATION,
DEATH,
PRODUCTION,
;
}
package magicbees.api.bees;
public enum AuraChargeType {
MUTATION,
DEATH,
PRODUCTION,
;
}
+33 -33
View File
@@ -1,33 +1,33 @@
package magicbees.bees;
import magicbees.api.bees.AuraChargeType;
public enum AuraCharge {
MUTATION(AuraChargeType.MUTATION, 850, 11),
DEATH(AuraChargeType.DEATH, 400, 5),
PRODUCTION(AuraChargeType.PRODUCTION, 300, 3),
;
public final AuraChargeType type;
public final int duration;
/** The number of ticks to count between draining vis from the environment **/
public final int tickRate;
public final int flag;
AuraCharge(AuraChargeType chargeType, int duration, int tickRate) {
this.type = chargeType;
this.duration = duration;
this.tickRate = tickRate;
flag = 1 << ordinal();
}
public static AuraCharge fromChargeType(AuraChargeType type) {
for (AuraCharge charge : values()) {
if (type == charge.type) {
return charge;
}
}
return null;
}
}
package magicbees.bees;
import magicbees.api.bees.AuraChargeType;
public enum AuraCharge {
MUTATION(AuraChargeType.MUTATION, 850, 11),
DEATH(AuraChargeType.DEATH, 400, 5),
PRODUCTION(AuraChargeType.PRODUCTION, 300, 3),
;
public final AuraChargeType type;
public final int duration;
/** The number of ticks to count between draining vis from the environment **/
public final int tickRate;
public final int flag;
AuraCharge(AuraChargeType chargeType, int duration, int tickRate) {
this.type = chargeType;
this.duration = duration;
this.tickRate = tickRate;
flag = 1 << ordinal();
}
public static AuraCharge fromChargeType(AuraChargeType type) {
for (AuraCharge charge : values()) {
if (type == charge.type) {
return charge;
}
}
return null;
}
}
@@ -1,23 +1,23 @@
package magicbees.bees;
import java.awt.Color;
import forestry.api.apiculture.IBeeIconColourProvider;
public enum BeeIconColourProvider implements IBeeIconColourProvider {
RAINBOW {
@Override
public int getIconColour(int renderPass) {
if (renderPass == 0) {
int hue = (int) (System.currentTimeMillis() >> 2) % 360;
return Color.getHSBColor(hue / 360f, 0.75f, 0.80f).getRGB();
} else if (renderPass == 1) {
int hue = (int) (System.currentTimeMillis() >> 3) % 360;
hue += 60;
hue = hue % 360;
return Color.getHSBColor(hue / 360f, 0.5f, 0.6f).getRGB();
}
return 0xffffff;
}
}
}
package magicbees.bees;
import java.awt.Color;
import forestry.api.apiculture.IBeeIconColourProvider;
public enum BeeIconColourProvider implements IBeeIconColourProvider {
RAINBOW {
@Override
public int getIconColour(int renderPass) {
if (renderPass == 0) {
int hue = (int) (System.currentTimeMillis() >> 2) % 360;
return Color.getHSBColor(hue / 360f, 0.75f, 0.80f).getRGB();
} else if (renderPass == 1) {
int hue = (int) (System.currentTimeMillis() >> 3) % 360;
hue += 60;
hue = hue % 360;
return Color.getHSBColor(hue / 360f, 0.5f, 0.6f).getRGB();
}
return 0xffffff;
}
}
}
@@ -1,51 +1,51 @@
package magicbees.bees;
import java.util.Locale;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IBeeIconProvider;
import magicbees.main.CommonProxy;
public enum BeeIconProvider implements IBeeIconProvider {
SKULKING(CommonProxy.DOMAIN + ":bees/skulking/"),
DOCTORAL(CommonProxy.DOMAIN + ":bees/doctoral/");
@SideOnly(Side.CLIENT)
private IIcon[][] icons;
private final String iconPath;
BeeIconProvider(String iconPath) {
this.iconPath = iconPath;
}
@Override
public void registerIcons(IIconRegister itemMap) {
this.icons = new IIcon[EnumBeeType.VALUES.length][3];
IIcon body1 = itemMap.registerIcon(iconPath + "body1");
for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
EnumBeeType beeType = EnumBeeType.VALUES[i];
if (beeType == EnumBeeType.NONE)
continue;
String beeTypeIconPath = iconPath + beeType.toString().toLowerCase(Locale.ENGLISH);
icons[i][0] = itemMap.registerIcon(beeTypeIconPath + ".outline");
icons[i][1] = (beeType != EnumBeeType.LARVAE) ? body1 : itemMap.registerIcon(beeTypeIconPath + ".body");
icons[i][2] = itemMap.registerIcon(beeTypeIconPath + ".body2");
}
}
@Override
public IIcon getIcon(EnumBeeType type, int renderPass) {
return icons[type.ordinal()][Math.min(renderPass, 2)];
}
}
package magicbees.bees;
import java.util.Locale;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IBeeIconProvider;
import magicbees.main.CommonProxy;
public enum BeeIconProvider implements IBeeIconProvider {
SKULKING(CommonProxy.DOMAIN + ":bees/skulking/"),
DOCTORAL(CommonProxy.DOMAIN + ":bees/doctoral/");
@SideOnly(Side.CLIENT)
private IIcon[][] icons;
private final String iconPath;
BeeIconProvider(String iconPath) {
this.iconPath = iconPath;
}
@Override
public void registerIcons(IIconRegister itemMap) {
this.icons = new IIcon[EnumBeeType.VALUES.length][3];
IIcon body1 = itemMap.registerIcon(iconPath + "body1");
for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
EnumBeeType beeType = EnumBeeType.VALUES[i];
if (beeType == EnumBeeType.NONE)
continue;
String beeTypeIconPath = iconPath + beeType.toString().toLowerCase(Locale.ENGLISH);
icons[i][0] = itemMap.registerIcon(beeTypeIconPath + ".outline");
icons[i][1] = (beeType != EnumBeeType.LARVAE) ? body1 : itemMap.registerIcon(beeTypeIconPath + ".body");
icons[i][2] = itemMap.registerIcon(beeTypeIconPath + ".body2");
}
}
@Override
public IIcon getIcon(EnumBeeType type, int renderPass) {
return icons[type.ordinal()][Math.min(renderPass, 2)];
}
}
+191 -191
View File
@@ -1,191 +1,191 @@
package magicbees.bees;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import forestry.api.apiculture.hives.HiveManager;
import forestry.api.apiculture.hives.IHiveDescription;
import forestry.api.apiculture.hives.IHiveGen;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import magicbees.block.types.HiveType;
import magicbees.main.Config;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.LogHelper;
import magicbees.world.feature.FeatureOreVein;
import magicbees.world.feature.HiveGenNether;
import magicbees.world.feature.HiveGenOblivion;
import magicbees.world.feature.HiveGenUnderground;
public enum HiveDescription implements IHiveDescription {
CURIOUS(HiveType.CURIOUS, 3.0f, HiveManager.genHelper.tree(), false,
BiomeDictionary.Type.FOREST, BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.HILLS),
UNUSUAL(HiveType.UNUSUAL, 1.0f, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass), false,
BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.HILLS, BiomeDictionary.Type.RIVER),
RESONANT(HiveType.RESONANT, 0.9f, HiveManager.genHelper.ground(Blocks.sand, Blocks.sandstone), false,
BiomeDictionary.Type.SANDY, BiomeDictionary.Type.MESA, BiomeDictionary.Type.HOT, BiomeDictionary.Type.MAGICAL),
DEEP(HiveType.DEEP, 5.0f, new HiveGenUnderground(10, 15, 5), true,
BiomeDictionary.Type.HILLS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.MAGICAL) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.redstoneGen.generateVein(world, random, x + 1, y, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x - 1, y, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y + 1, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y - 1, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z + 1, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z - 1, 5);
}
},
INFERNAL(HiveType.INFERNAL, 50.0f, new HiveGenNether(0, 175, 6), true,
BiomeDictionary.Type.NETHER) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.netherQuartzGen.generateVein(world, random, x + 1, y, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x - 1, y, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y + 1, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y - 1, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z + 1, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z - 1, 4);
}
},
INFERNAL_OVERWORLD(HiveType.INFERNAL, 0.95f, new HiveGenUnderground(5, 13, 6), true,
BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.HOT) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.glowstoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(4) + 1);
FeatureOreVein.glowstoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(4) + 1);
if (BlockUtil.canBlockReplaceAt(world, x, y + 1, z, Blocks.stone)) {
world.setBlock(x, y + 1, z, Blocks.glowstone, 0, 3);
}
if (BlockUtil.canBlockReplaceAt(world, x, y - 1, z, Blocks.stone)) {
world.setBlock(x, y - 1, z, Blocks.glowstone, 0, 3);
}
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(4) + 1);
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(4) + 1);
}
},
OBLIVION(HiveType.OBLIVION, 20.0f, new HiveGenOblivion(), true,
BiomeDictionary.Type.END) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
int obsidianSpikeHeight = world.rand.nextInt(8) + 3;
for (int i = 1; i < obsidianSpikeHeight && y - i > 0; ++i) {
world.setBlock(x, y - i, z, Blocks.obsidian, 0, 2);
}
}
},
OBLIVION_OVERWORLD(HiveType.OBLIVION, 0.87f, new HiveGenUnderground(5, 5, 5), true,
BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.COLD) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.endStoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y + 1, z, world.rand.nextInt(3) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y - 1, z, world.rand.nextInt(3) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(6) + 1);
}
};
private static boolean logSpawns = Config.logHiveSpawns;
private final HiveType hiveType;
private final float genChance;
private final List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
private final IHiveGen hiveGen;
private final boolean spawnsIgnoreClimate;
private HiveDescription(HiveType type, float chance, IHiveGen genType, boolean ignoreClimate, BiomeDictionary.Type ... goodBiomeTypes) {
hiveType = type;
genChance = chance;
hiveGen = genType;
spawnsIgnoreClimate = ignoreClimate;
for (BiomeDictionary.Type biomeType : goodBiomeTypes) {
biomes.add(biomeType);
}
}
@Override
public IHiveGen getHiveGen()
{
return hiveGen;
}
@Override
public Block getBlock()
{
return Config.hive;
}
@Override
public int getMeta()
{
return hiveType.ordinal();
}
@Override
public boolean isGoodBiome(BiomeGenBase biome)
{
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);
for (BiomeDictionary.Type type : types)
{
if (biomes.contains(type))
{
return true;
}
}
return false;
}
@Override
public boolean isGoodHumidity(EnumHumidity humidity)
{
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInHumidity(humidity);
}
@Override
public boolean isGoodTemperature(EnumTemperature temperature)
{
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInTemperature(temperature);
}
@Override
public float getGenChance()
{
return genChance;
}
@Override
public void postGen(World world, int x, int y, int z)
{
if (logSpawns)
{
LogHelper.info("Spawned " + this.toString().toLowerCase(Locale.ENGLISH) + " hive at: X " + x + ", Y: " + y + ", Z: " + z);
}
}
}
package magicbees.bees;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import forestry.api.apiculture.hives.HiveManager;
import forestry.api.apiculture.hives.IHiveDescription;
import forestry.api.apiculture.hives.IHiveGen;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import magicbees.block.types.HiveType;
import magicbees.main.Config;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.LogHelper;
import magicbees.world.feature.FeatureOreVein;
import magicbees.world.feature.HiveGenNether;
import magicbees.world.feature.HiveGenOblivion;
import magicbees.world.feature.HiveGenUnderground;
public enum HiveDescription implements IHiveDescription {
CURIOUS(HiveType.CURIOUS, 3.0f, HiveManager.genHelper.tree(), false,
BiomeDictionary.Type.FOREST, BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.HILLS),
UNUSUAL(HiveType.UNUSUAL, 1.0f, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass), false,
BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.HILLS, BiomeDictionary.Type.RIVER),
RESONANT(HiveType.RESONANT, 0.9f, HiveManager.genHelper.ground(Blocks.sand, Blocks.sandstone), false,
BiomeDictionary.Type.SANDY, BiomeDictionary.Type.MESA, BiomeDictionary.Type.HOT, BiomeDictionary.Type.MAGICAL),
DEEP(HiveType.DEEP, 5.0f, new HiveGenUnderground(10, 15, 5), true,
BiomeDictionary.Type.HILLS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.MAGICAL) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.redstoneGen.generateVein(world, random, x + 1, y, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x - 1, y, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y + 1, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y - 1, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z + 1, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z - 1, 5);
}
},
INFERNAL(HiveType.INFERNAL, 50.0f, new HiveGenNether(0, 175, 6), true,
BiomeDictionary.Type.NETHER) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.netherQuartzGen.generateVein(world, random, x + 1, y, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x - 1, y, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y + 1, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y - 1, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z + 1, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z - 1, 4);
}
},
INFERNAL_OVERWORLD(HiveType.INFERNAL, 0.95f, new HiveGenUnderground(5, 13, 6), true,
BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.HOT) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.glowstoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(4) + 1);
FeatureOreVein.glowstoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(4) + 1);
if (BlockUtil.canBlockReplaceAt(world, x, y + 1, z, Blocks.stone)) {
world.setBlock(x, y + 1, z, Blocks.glowstone, 0, 3);
}
if (BlockUtil.canBlockReplaceAt(world, x, y - 1, z, Blocks.stone)) {
world.setBlock(x, y - 1, z, Blocks.glowstone, 0, 3);
}
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(4) + 1);
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(4) + 1);
}
},
OBLIVION(HiveType.OBLIVION, 20.0f, new HiveGenOblivion(), true,
BiomeDictionary.Type.END) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
int obsidianSpikeHeight = world.rand.nextInt(8) + 3;
for (int i = 1; i < obsidianSpikeHeight && y - i > 0; ++i) {
world.setBlock(x, y - i, z, Blocks.obsidian, 0, 2);
}
}
},
OBLIVION_OVERWORLD(HiveType.OBLIVION, 0.87f, new HiveGenUnderground(5, 5, 5), true,
BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.COLD) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.endStoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y + 1, z, world.rand.nextInt(3) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y - 1, z, world.rand.nextInt(3) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(6) + 1);
}
};
private static boolean logSpawns = Config.logHiveSpawns;
private final HiveType hiveType;
private final float genChance;
private final List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
private final IHiveGen hiveGen;
private final boolean spawnsIgnoreClimate;
private HiveDescription(HiveType type, float chance, IHiveGen genType, boolean ignoreClimate, BiomeDictionary.Type ... goodBiomeTypes) {
hiveType = type;
genChance = chance;
hiveGen = genType;
spawnsIgnoreClimate = ignoreClimate;
for (BiomeDictionary.Type biomeType : goodBiomeTypes) {
biomes.add(biomeType);
}
}
@Override
public IHiveGen getHiveGen()
{
return hiveGen;
}
@Override
public Block getBlock()
{
return Config.hive;
}
@Override
public int getMeta()
{
return hiveType.ordinal();
}
@Override
public boolean isGoodBiome(BiomeGenBase biome)
{
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);
for (BiomeDictionary.Type type : types)
{
if (biomes.contains(type))
{
return true;
}
}
return false;
}
@Override
public boolean isGoodHumidity(EnumHumidity humidity)
{
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInHumidity(humidity);
}
@Override
public boolean isGoodTemperature(EnumTemperature temperature)
{
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInTemperature(temperature);
}
@Override
public float getGenChance()
{
return genChance;
}
@Override
public void postGen(World world, int x, int y, int z)
{
if (logSpawns)
{
LogHelper.info("Spawned " + this.toString().toLowerCase(Locale.ENGLISH) + " hive at: X " + x + ", Y: " + y + ", Z: " + z);
}
}
}
@@ -1,49 +1,49 @@
package magicbees.bees;
import net.minecraft.world.World;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.MoonPhase;
// There is a bonus to this mutation during moon phases...
public class MoonPhaseMutationBonus implements IMutationCondition {
private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd;
private final float mutationBonus;
public MoonPhaseMutationBonus(MoonPhase phase, float bonus) {
this.moonPhaseStart = phase;
this.moonPhaseEnd = phase;
this.mutationBonus = bonus;
}
public MoonPhaseMutationBonus(MoonPhase start, MoonPhase end, float bonus) {
this.moonPhaseStart = start;
this.moonPhaseEnd = end;
this.mutationBonus = bonus;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return this.mutationBonus;
}
return 1;
}
@Override
public String getDescription() {
if (this.moonPhaseStart != this.moonPhaseEnd) {
return String.format(LocalizationManager.getLocalizedString("research.bonusPhase"),
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt());
} else {
return String.format(LocalizationManager.getLocalizedString("research.bonusPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
}
package magicbees.bees;
import net.minecraft.world.World;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.MoonPhase;
// There is a bonus to this mutation during moon phases...
public class MoonPhaseMutationBonus implements IMutationCondition {
private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd;
private final float mutationBonus;
public MoonPhaseMutationBonus(MoonPhase phase, float bonus) {
this.moonPhaseStart = phase;
this.moonPhaseEnd = phase;
this.mutationBonus = bonus;
}
public MoonPhaseMutationBonus(MoonPhase start, MoonPhase end, float bonus) {
this.moonPhaseStart = start;
this.moonPhaseEnd = end;
this.mutationBonus = bonus;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return this.mutationBonus;
}
return 1;
}
@Override
public String getDescription() {
if (this.moonPhaseStart != this.moonPhaseEnd) {
return String.format(LocalizationManager.getLocalizedString("research.bonusPhase"),
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt());
} else {
return String.format(LocalizationManager.getLocalizedString("research.bonusPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
}
@@ -1,46 +1,46 @@
package magicbees.bees;
import net.minecraft.world.World;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.MoonPhase;
public class MoonPhaseMutationRestriction implements IMutationCondition {
private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd;
public MoonPhaseMutationRestriction(MoonPhase phase) {
this.moonPhaseStart = phase;
this.moonPhaseEnd = phase;
}
public MoonPhaseMutationRestriction(MoonPhase start, MoonPhase end) {
this.moonPhaseStart = start;
this.moonPhaseEnd = end;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return 1;
}
return 0;
}
@Override
public String getDescription() {
if (moonPhaseStart != moonPhaseEnd) {
return String.format(LocalizationManager.getLocalizedString("research.requiresPhase"),
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt());
}
else {
return String.format(LocalizationManager.getLocalizedString("research.requiresPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
}
package magicbees.bees;
import net.minecraft.world.World;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.MoonPhase;
public class MoonPhaseMutationRestriction implements IMutationCondition {
private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd;
public MoonPhaseMutationRestriction(MoonPhase phase) {
this.moonPhaseStart = phase;
this.moonPhaseEnd = phase;
}
public MoonPhaseMutationRestriction(MoonPhase start, MoonPhase end) {
this.moonPhaseStart = start;
this.moonPhaseEnd = end;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return 1;
}
return 0;
}
@Override
public String getDescription() {
if (moonPhaseStart != moonPhaseEnd) {
return String.format(LocalizationManager.getLocalizedString("research.requiresPhase"),
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt());
}
else {
return String.format(LocalizationManager.getLocalizedString("research.requiresPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
}
@@ -1,78 +1,78 @@
package magicbees.main.utils;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
public class BlockUtil {
public static int getSurroundCount(World world, int x, int y, int z, Block blockType)
{
int surroundCount = 0;
if (canBlockReplaceAt(world, x + 1, y, z, blockType))
{
++surroundCount;
}
if (canBlockReplaceAt(world, x - 1, y, z, blockType))
{
++surroundCount;
}
if (canBlockReplaceAt(world, x, y + 1, z, blockType))
{
++surroundCount;
}
if (canBlockReplaceAt(world, x, y - 1, z, blockType))
{
++surroundCount;
}
if (canBlockReplaceAt(world, x, y, z + 1, blockType))
{
++surroundCount;
}
if (canBlockReplaceAt(world, x, y, z - 1, blockType))
{
++surroundCount;
}
return surroundCount;
}
public static boolean canBlockReplaceAt(World world, int x, int y, int z, Block target)
{
// don't cause new chunks to load
if (!world.blockExists(x, y, z))
{
return true;
}
Block block = world.getBlock(x, y, z);
return block.isReplaceableOreGen(world, x, y, z, target);
}
public static List<Chunk> getChunksInSearchRange(World world, int xCoord, int zCoord, int searchRadius) {
List<Chunk> searchChunks = new ArrayList<Chunk>();
int chunkRange = (int)Math.ceil(searchRadius / 16.0);
int minChunkX = xCoord / 16 - chunkRange;
int maxChunkX = xCoord / 16 + chunkRange;
int minChunkZ = zCoord / 16 - chunkRange;
int maxChunkZ = zCoord / 16 + chunkRange;
for (int chunkX = minChunkX; chunkX <= maxChunkX; ++chunkX) {
for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; ++chunkZ) {
Chunk chunk = world.getChunkFromChunkCoords(chunkX, chunkZ);
if (chunk != null)
searchChunks.add(chunk);
}
}
return searchChunks;
}
}
package magicbees.main.utils;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
public class BlockUtil {
public static int getSurroundCount(World world, int x, int y, int z, Block blockType)
{
int surroundCount = 0;
if (canBlockReplaceAt(world, x + 1, y, z, blockType))
{
++surroundCount;
}
if (canBlockReplaceAt(world, x - 1, y, z, blockType))
{
++surroundCount;
}
if (canBlockReplaceAt(world, x, y + 1, z, blockType))
{
++surroundCount;
}
if (canBlockReplaceAt(world, x, y - 1, z, blockType))
{
++surroundCount;
}
if (canBlockReplaceAt(world, x, y, z + 1, blockType))
{
++surroundCount;
}
if (canBlockReplaceAt(world, x, y, z - 1, blockType))
{
++surroundCount;
}
return surroundCount;
}
public static boolean canBlockReplaceAt(World world, int x, int y, int z, Block target)
{
// don't cause new chunks to load
if (!world.blockExists(x, y, z))
{
return true;
}
Block block = world.getBlock(x, y, z);
return block.isReplaceableOreGen(world, x, y, z, target);
}
public static List<Chunk> getChunksInSearchRange(World world, int xCoord, int zCoord, int searchRadius) {
List<Chunk> searchChunks = new ArrayList<Chunk>();
int chunkRange = (int)Math.ceil(searchRadius / 16.0);
int minChunkX = xCoord / 16 - chunkRange;
int maxChunkX = xCoord / 16 + chunkRange;
int minChunkZ = zCoord / 16 - chunkRange;
int maxChunkZ = zCoord / 16 + chunkRange;
for (int chunkX = minChunkX; chunkX <= maxChunkX; ++chunkX) {
for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; ++chunkZ) {
Chunk chunk = world.getChunkFromChunkCoords(chunkX, chunkZ);
if (chunk != null)
searchChunks.add(chunk);
}
}
return searchChunks;
}
}
@@ -1,69 +1,69 @@
package magicbees.main.utils.net;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.client.FMLClientHandler;
import magicbees.main.utils.ChunkCoords;
import magicbees.main.utils.LogHelper;
import magicbees.main.utils.net.NetworkEventHandler.EventType;
import magicbees.tileentity.AuraCharges;
import magicbees.tileentity.ITileEntityAuraCharged;
public class EventAuraChargeUpdate extends EventCoords {
private int flags;
public EventAuraChargeUpdate(ChunkCoords position, AuraCharges auraCharges) {
super(EventType.AURA_CHARGE_UPDATE, position);
flags = auraCharges.writeToFlags();
}
public EventAuraChargeUpdate(DataInputStream byteStream) {
super(EventType.FLAGS_UPDATE, byteStream);
this.readDataFromInputStream(byteStream);
}
@Override
protected void writeDataToOutputStream(DataOutputStream byteStream) {
super.writeDataToOutputStream(byteStream);
try {
byteStream.writeInt(flags);
}
catch (IOException e) {
LogHelper.error("Could not write EventAuraChargeUpdate data to stream.");
e.printStackTrace();
}
}
@Override
protected void readDataFromInputStream(DataInputStream byteStream) {
super.readDataFromInputStream(byteStream);
try {
this.flags = byteStream.readInt();
}
catch (IOException e) {
LogHelper.error("Could not read EventAuraChargeUpdate data from stream.");
e.printStackTrace();
}
}
@Override
public void process(EntityPlayerMP player) {
TileEntity tile = FMLClientHandler.instance().getClient().theWorld.getTileEntity(getCoords().x, getCoords().y, getCoords().z);
if (tile != null && tile instanceof ITileEntityAuraCharged) {
AuraCharges auraCharges = ((ITileEntityAuraCharged) tile).getAuraCharges();
auraCharges.readFromFlags(flags);
}
}
}
package magicbees.main.utils.net;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.client.FMLClientHandler;
import magicbees.main.utils.ChunkCoords;
import magicbees.main.utils.LogHelper;
import magicbees.main.utils.net.NetworkEventHandler.EventType;
import magicbees.tileentity.AuraCharges;
import magicbees.tileentity.ITileEntityAuraCharged;
public class EventAuraChargeUpdate extends EventCoords {
private int flags;
public EventAuraChargeUpdate(ChunkCoords position, AuraCharges auraCharges) {
super(EventType.AURA_CHARGE_UPDATE, position);
flags = auraCharges.writeToFlags();
}
public EventAuraChargeUpdate(DataInputStream byteStream) {
super(EventType.FLAGS_UPDATE, byteStream);
this.readDataFromInputStream(byteStream);
}
@Override
protected void writeDataToOutputStream(DataOutputStream byteStream) {
super.writeDataToOutputStream(byteStream);
try {
byteStream.writeInt(flags);
}
catch (IOException e) {
LogHelper.error("Could not write EventAuraChargeUpdate data to stream.");
e.printStackTrace();
}
}
@Override
protected void readDataFromInputStream(DataInputStream byteStream) {
super.readDataFromInputStream(byteStream);
try {
this.flags = byteStream.readInt();
}
catch (IOException e) {
LogHelper.error("Could not read EventAuraChargeUpdate data from stream.");
e.printStackTrace();
}
}
@Override
public void process(EntityPlayerMP player) {
TileEntity tile = FMLClientHandler.instance().getClient().theWorld.getTileEntity(getCoords().x, getCoords().y, getCoords().z);
if (tile != null && tile instanceof ITileEntityAuraCharged) {
AuraCharges auraCharges = ((ITileEntityAuraCharged) tile).getAuraCharges();
auraCharges.readFromFlags(flags);
}
}
}
@@ -1,70 +1,70 @@
package magicbees.tileentity;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import magicbees.bees.AuraCharge;
public class AuraCharges {
private static final String auraChargesTagName = "AuraCharges";
private final Map<AuraCharge, Long> charges = new HashMap<AuraCharge, Long>(AuraCharge.values().length);
public void start(AuraCharge auraChargeType, World worldObj) {
charges.put(auraChargeType, worldObj.getTotalWorldTime());
}
public boolean isActive(AuraCharge auraChargeType) {
return charges.keySet().contains(auraChargeType);
}
public boolean isExpired(AuraCharge auraChargeType, World worldObj) {
Long chargeStart = charges.get(auraChargeType);
return chargeStart == null || chargeStart + auraChargeType.duration <= worldObj.getTotalWorldTime();
}
public void stop(AuraCharge AuraChargeType) {
charges.remove(AuraChargeType);
}
public void writeToNBT(NBTTagCompound nbtTagCompound) {
NBTTagCompound auraChargeTags = new NBTTagCompound();
for (Map.Entry<AuraCharge, Long> chargeEntry : charges.entrySet()) {
String chargeName = chargeEntry.getKey().toString();
Long chargeStart = chargeEntry.getValue();
auraChargeTags.setLong(chargeName, chargeStart);
}
nbtTagCompound.setTag(auraChargesTagName, auraChargeTags);
}
public void readFromNBT(NBTTagCompound nbtTagCompound) {
NBTTagCompound auraChargeTags = nbtTagCompound.getCompoundTag(auraChargesTagName);
for (AuraCharge auraCharge : AuraCharge.values()) {
String chargeName = auraCharge.toString();
Long chargeStart = auraChargeTags.getLong(chargeName);
if (chargeStart > 0) {
charges.put(auraCharge, chargeStart);
}
}
}
public int writeToFlags() {
int flags = 0;
for (AuraCharge auraChargeType : charges.keySet()) {
flags |= auraChargeType.flag;
}
return flags;
}
public void readFromFlags(int flags) {
charges.clear();
for (AuraCharge auraCharge : AuraCharge.values()) {
if ((flags & auraCharge.flag) > 0) {
charges.put(auraCharge, 0L);
}
}
}
}
package magicbees.tileentity;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import magicbees.bees.AuraCharge;
public class AuraCharges {
private static final String auraChargesTagName = "AuraCharges";
private final Map<AuraCharge, Long> charges = new HashMap<AuraCharge, Long>(AuraCharge.values().length);
public void start(AuraCharge auraChargeType, World worldObj) {
charges.put(auraChargeType, worldObj.getTotalWorldTime());
}
public boolean isActive(AuraCharge auraChargeType) {
return charges.keySet().contains(auraChargeType);
}
public boolean isExpired(AuraCharge auraChargeType, World worldObj) {
Long chargeStart = charges.get(auraChargeType);
return chargeStart == null || chargeStart + auraChargeType.duration <= worldObj.getTotalWorldTime();
}
public void stop(AuraCharge AuraChargeType) {
charges.remove(AuraChargeType);
}
public void writeToNBT(NBTTagCompound nbtTagCompound) {
NBTTagCompound auraChargeTags = new NBTTagCompound();
for (Map.Entry<AuraCharge, Long> chargeEntry : charges.entrySet()) {
String chargeName = chargeEntry.getKey().toString();
Long chargeStart = chargeEntry.getValue();
auraChargeTags.setLong(chargeName, chargeStart);
}
nbtTagCompound.setTag(auraChargesTagName, auraChargeTags);
}
public void readFromNBT(NBTTagCompound nbtTagCompound) {
NBTTagCompound auraChargeTags = nbtTagCompound.getCompoundTag(auraChargesTagName);
for (AuraCharge auraCharge : AuraCharge.values()) {
String chargeName = auraCharge.toString();
Long chargeStart = auraChargeTags.getLong(chargeName);
if (chargeStart > 0) {
charges.put(auraCharge, chargeStart);
}
}
}
public int writeToFlags() {
int flags = 0;
for (AuraCharge auraChargeType : charges.keySet()) {
flags |= auraChargeType.flag;
}
return flags;
}
public void readFromFlags(int flags) {
charges.clear();
for (AuraCharge auraCharge : AuraCharge.values()) {
if ((flags & auraCharge.flag) > 0) {
charges.put(auraCharge, 0L);
}
}
}
}
@@ -1,5 +1,5 @@
package magicbees.tileentity;
public interface ITileEntityAuraCharged {
AuraCharges getAuraCharges();
}
package magicbees.tileentity;
public interface ITileEntityAuraCharged {
AuraCharges getAuraCharges();
}
@@ -1,34 +1,34 @@
package magicbees.world.feature;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
public class HiveGenNether extends HiveGenUnderground {
public HiveGenNether(int minLevel, int range, int surroundCount)
{
super(minLevel, range, Blocks.netherrack, surroundCount);
}
@Override
public int getYForHive(World world, int x, int z)
{
int y = super.getYForHive(world, x, z);
if (!isValidLocation(world, x, y, z))
{
int searchDirection = world.rand.nextBoolean() ? 4 : -4;
while (!Block.isEqualTo(world.getBlock(x, y, z), replace))
{
y += searchDirection;
if (y < minLevel || y > minLevel + range)
{
return -1;
}
}
}
return y;
}
}
package magicbees.world.feature;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
public class HiveGenNether extends HiveGenUnderground {
public HiveGenNether(int minLevel, int range, int surroundCount)
{
super(minLevel, range, Blocks.netherrack, surroundCount);
}
@Override
public int getYForHive(World world, int x, int z)
{
int y = super.getYForHive(world, x, z);
if (!isValidLocation(world, x, y, z))
{
int searchDirection = world.rand.nextBoolean() ? 4 : -4;
while (!Block.isEqualTo(world.getBlock(x, y, z), replace))
{
y += searchDirection;
if (y < minLevel || y > minLevel + range)
{
return -1;
}
}
}
return y;
}
}
@@ -1,63 +1,63 @@
package magicbees.world.feature;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import forestry.api.apiculture.hives.IHiveGen;
import magicbees.main.utils.BlockUtil;
public class HiveGenOblivion implements IHiveGen {
@Override
public int getYForHive(World world, int x, int z) {
int surface = world.getHeightValue(x, z);
if (surface == 0)
{
return -1;
}
int y = 10;
// get to the end stone
while (!Block.isEqualTo(world.getBlock(x, y - 1, z), Blocks.end_stone) && y < surface)
{
y += 8;
}
// hive must be embedded one deep into the stone
while (!Block.isEqualTo(world.getBlock(x, y - 2, z), Blocks.air) && y > -1)
{
y--;
}
return y;
}
@Override
public boolean isValidLocation(World world, int x, int y, int z) {
if (BlockUtil.getSurroundCount(world, x, y, z, Blocks.end_stone) != 6)
{
return false;
}
for (int i = 2; i < 4; i++)
{
if (!world.isAirBlock(x, y - i, z))
{
return false;
}
}
return true;
}
@Override
public boolean canReplace(World world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
return Block.isEqualTo(block, Blocks.end_stone);
}
}
package magicbees.world.feature;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import forestry.api.apiculture.hives.IHiveGen;
import magicbees.main.utils.BlockUtil;
public class HiveGenOblivion implements IHiveGen {
@Override
public int getYForHive(World world, int x, int z) {
int surface = world.getHeightValue(x, z);
if (surface == 0)
{
return -1;
}
int y = 10;
// get to the end stone
while (!Block.isEqualTo(world.getBlock(x, y - 1, z), Blocks.end_stone) && y < surface)
{
y += 8;
}
// hive must be embedded one deep into the stone
while (!Block.isEqualTo(world.getBlock(x, y - 2, z), Blocks.air) && y > -1)
{
y--;
}
return y;
}
@Override
public boolean isValidLocation(World world, int x, int y, int z) {
if (BlockUtil.getSurroundCount(world, x, y, z, Blocks.end_stone) != 6)
{
return false;
}
for (int i = 2; i < 4; i++)
{
if (!world.isAirBlock(x, y - i, z))
{
return false;
}
}
return true;
}
@Override
public boolean canReplace(World world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
return Block.isEqualTo(block, Blocks.end_stone);
}
}
@@ -1,47 +1,47 @@
package magicbees.world.feature;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import forestry.api.apiculture.hives.IHiveGen;
import magicbees.main.utils.BlockUtil;
public class HiveGenUnderground implements IHiveGen
{
protected final int minLevel;
protected final int range;
protected final Block replace;
private final int surroundCount;
public HiveGenUnderground(int minLevel, int range, int surroundCount) {
this(minLevel, range, Blocks.stone, surroundCount);
}
public HiveGenUnderground(int minLevel, int range, Block replace, int surroundCount)
{
this.minLevel = minLevel;
this.range = range;
this.replace = replace;
this.surroundCount = surroundCount;
}
@Override
public int getYForHive(World world, int x, int z)
{
return minLevel + world.rand.nextInt(range);
}
@Override
public boolean isValidLocation(World world, int x, int y, int z)
{
return BlockUtil.getSurroundCount(world, x, y, z, replace) >= surroundCount;
}
@Override
public boolean canReplace(World world, int x, int y, int z)
{
return !world.isAirBlock(x, y, z) && BlockUtil.canBlockReplaceAt(world, x, y, z, replace);
}
}
package magicbees.world.feature;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import forestry.api.apiculture.hives.IHiveGen;
import magicbees.main.utils.BlockUtil;
public class HiveGenUnderground implements IHiveGen
{
protected final int minLevel;
protected final int range;
protected final Block replace;
private final int surroundCount;
public HiveGenUnderground(int minLevel, int range, int surroundCount) {
this(minLevel, range, Blocks.stone, surroundCount);
}
public HiveGenUnderground(int minLevel, int range, Block replace, int surroundCount)
{
this.minLevel = minLevel;
this.range = range;
this.replace = replace;
this.surroundCount = surroundCount;
}
@Override
public int getYForHive(World world, int x, int z)
{
return minLevel + world.rand.nextInt(range);
}
@Override
public boolean isValidLocation(World world, int x, int y, int z)
{
return BlockUtil.getSurroundCount(world, x, y, z, replace) >= surroundCount;
}
@Override
public boolean canReplace(World world, int x, int y, int z)
{
return !world.isAirBlock(x, y, z) && BlockUtil.canBlockReplaceAt(world, x, y, z, replace);
}
}