diff --git a/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java b/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java index bc13fa17c..7294c3790 100755 --- a/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java +++ b/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java @@ -17,7 +17,7 @@ import forestry.core.gadgets.BlockStructure.EnumStructureState; import forestry.core.gadgets.StructureLogic; import forestry.core.utils.Schemata; import forestry.core.utils.Schemata.EnumStructureBlock; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.HashSet; import net.minecraft.block.Block; import net.minecraft.init.Blocks; diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectGlacial.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectGlacial.java index af66476c2..15c4f0bfb 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectGlacial.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectGlacial.java @@ -15,7 +15,7 @@ import forestry.api.apiculture.IBeeHousing; import forestry.api.core.EnumTemperature; import forestry.api.genetics.IEffectData; import forestry.core.proxy.Proxies; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectRadioactive.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectRadioactive.java index 4f949e6d2..a36b42ae5 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectRadioactive.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectRadioactive.java @@ -17,7 +17,7 @@ import forestry.apiculture.gadgets.BlockAlveary; import forestry.apiculture.gadgets.TileAlveary; import forestry.apiculture.items.ItemArmorApiarist; import forestry.core.utils.DamageSourceForestry; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.List; import java.util.Random; import net.minecraft.block.Block; diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectSnowing.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectSnowing.java index 864f9d11b..d6e13c735 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectSnowing.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectSnowing.java @@ -15,7 +15,7 @@ import forestry.api.apiculture.IBeeHousing; import forestry.api.core.EnumTemperature; import forestry.api.genetics.IEffectData; import forestry.core.proxy.Proxies; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectThrottled.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectThrottled.java index 250f86599..83d2dcf56 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectThrottled.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectThrottled.java @@ -17,7 +17,7 @@ import forestry.api.genetics.IEffectData; import forestry.core.EnumErrorCode; import forestry.core.genetics.Allele; import forestry.core.genetics.EffectData; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import forestry.plugins.PluginApiculture; import net.minecraft.util.AxisAlignedBB; diff --git a/src/main/java/forestry/apiculture/genetics/Bee.java b/src/main/java/forestry/apiculture/genetics/Bee.java index 43f0547ff..97adc897b 100755 --- a/src/main/java/forestry/apiculture/genetics/Bee.java +++ b/src/main/java/forestry/apiculture/genetics/Bee.java @@ -10,6 +10,18 @@ ******************************************************************************/ package forestry.apiculture.genetics; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + import forestry.api.apiculture.EnumBeeChromosome; import forestry.api.apiculture.IAlleleBeeEffect; import forestry.api.apiculture.IAlleleBeeSpecies; @@ -31,27 +43,17 @@ import forestry.api.genetics.IFlowerProvider; import forestry.api.genetics.IGenome; import forestry.api.genetics.IIndividual; import forestry.api.genetics.IPollinatable; -import forestry.core.utils.GeneticsUtil; import forestry.core.EnumErrorCode; import forestry.core.config.Defaults; import forestry.core.genetics.Chromosome; import forestry.core.genetics.GenericRatings; import forestry.core.genetics.IndividualLiving; import forestry.core.proxy.Proxies; +import forestry.core.utils.GeneticsUtil; import forestry.core.utils.StringUtil; -import forestry.core.utils.Vect; +import forestry.core.vect.MutableVect; +import forestry.core.vect.Vect; import forestry.plugins.PluginApiculture; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; public class Bee extends IndividualLiving implements IBee { @@ -266,26 +268,16 @@ public class Bee extends IndividualLiving implements IBee { IFlowerProvider provider = genome.getFlowerProvider(); - Vect coords = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()); - Vect posCurrent = new Vect(0, 0, 0); - int[] areaAr = genome.getTerritory(); - Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(housing.getTerritoryModifier(genome, 1f)); - - if (area.x < 1) - area.x = 1; - if (area.y < 1) - area.y = 1; - if (area.z < 1) - area.z = 1; - - Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 2), -Math.round(area.z / 2)); + Vect housingPos = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()); + Vect area = getArea(genome, housing); + Vect offset = new Vect(-area.x / 2, -area.y / 2, -area.z / 2); boolean hasFlower = false; - while (advancePosition(posCurrent, area)) { + MutableVect posCurrent = new MutableVect(0, 0, 0); + while (posCurrent.advancePositionInArea(area)) { - Vect posBlock = posCurrent.add(coords); - posBlock = posBlock.add(offset); + Vect posBlock = Vect.add(housingPos, posCurrent, offset); if (provider.isAcceptedFlower(housing.getWorld(), this, posBlock.x, posBlock.y, posBlock.z)) { hasFlower = true; @@ -297,28 +289,6 @@ public class Bee extends IndividualLiving implements IBee { return hasFlower; } - private boolean advancePosition(Vect posCurrent, Vect area) { - // Increment z first until end reached - if (posCurrent.z < area.z - 1) - posCurrent.z++; - else { - posCurrent.z = 0; - - if (posCurrent.x < area.x - 1) - posCurrent.x++; - else { - posCurrent.x = 0; - - if (posCurrent.y < area.y - 1) - posCurrent.y++; - else - return false; - } - } - - return true; - } - @Override public ArrayList getSuitableBiomeIds() { ArrayList suitableBiomes = new ArrayList(); @@ -571,14 +541,12 @@ public class Bee extends IndividualLiving implements IBee { } for (IBeeMutation mutation : PluginApiculture.beeInterface.getMutations(true)) { - float chance = 0; - - if ((chance = mutation.getChance(housing, allele0, allele1, genome0, genome1)) > 0) - if (world.rand.nextFloat()*100 < chance) { - IApiaristTracker breedingTracker = PluginApiculture.beeInterface.getBreedingTracker(world, housing.getOwnerName()); - breedingTracker.registerMutation(mutation); - return PluginApiculture.beeInterface.templateAsChromosomes(mutation.getTemplate()); - } + float chance = mutation.getChance(housing, allele0, allele1, genome0, genome1); + if (chance > world.rand.nextFloat() * 100) { + IApiaristTracker breedingTracker = PluginApiculture.beeInterface.getBreedingTracker(world, housing.getOwnerName()); + breedingTracker.registerMutation(mutation); + return PluginApiculture.beeInterface.templateAsChromosomes(mutation.getTemplate()); + } } return null; @@ -588,33 +556,24 @@ public class Bee extends IndividualLiving implements IBee { @Override public IIndividual retrievePollen(IBeeHousing housing) { - int chance = (int) (genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f)); - - // Correct speed - if (housing.getWorld().rand.nextInt(100) >= chance) - return null; - - int[] areaAr = genome.getTerritory(); - Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(housing.getTerritoryModifier(genome, 1f)).multiply(3.0f); - Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 2), -Math.round(area.z / 2)); - - if (area.x < 1) - area.x = 1; - if (area.y < 1) - area.y = 1; - if (area.z < 1) - area.z = 1; + int chance = Math.round(genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f)); World world = housing.getWorld(); Random random = world.rand; + // Correct speed + if (random.nextInt(100) >= chance) + return null; + + Vect area = getArea(genome, housing); + Vect offset = new Vect(-area.x / 2, -area.y / 4, -area.z / 2); Vect housingPos = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()); IIndividual pollen = null; for (int i = 0; i < 20; i++) { - Vect randomPos = new Vect(random.nextInt(area.x), random.nextInt(area.y), random.nextInt(area.z)); - Vect blockPos = housingPos.add(randomPos).add(offset); + Vect randomPos = Vect.getRandomPositionInArea(random, area); + Vect blockPos = Vect.add(housingPos, randomPos, offset); TileEntity tile = world.getTileEntity(blockPos.x, blockPos.y, blockPos.z); if (tile instanceof IPollinatable) { @@ -637,33 +596,27 @@ public class Bee extends IndividualLiving implements IBee { int chance = (int) (genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f)); + World world = housing.getWorld(); + Random random = world.rand; + // Correct speed - if (housing.getWorld().rand.nextInt(100) >= chance) + if (random.nextInt(100) >= chance) return false; - int[] areaAr = genome.getTerritory(); - Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(housing.getTerritoryModifier(genome, 1f)).multiply(3.0f); - Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 4), -Math.round(area.z / 2)); - - if (area.x < 1) - area.x = 1; - if (area.y < 1) - area.y = 1; - if (area.z < 1) - area.z = 1; + Vect area = getArea(genome, housing); + Vect offset = new Vect(-area.x / 2, -area.y / 4, -area.z / 2); + Vect housingPos = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()); for (int i = 0; i < 30; i++) { - Vect randomPos = new Vect(housing.getWorld().rand.nextInt(area.x), housing.getWorld().rand.nextInt(area.y), housing.getWorld().rand.nextInt(area.z)); + Vect randomPos = Vect.getRandomPositionInArea(random, area); + Vect posBlock = Vect.add(housingPos, randomPos, offset); - Vect posBlock = randomPos.add(new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord())); - posBlock = posBlock.add(offset); - - IPollinatable receiver = GeneticsUtil.getOrCreatePollinatable(housing.getOwnerName(), housing.getWorld(), posBlock.x, posBlock.y, posBlock.z); + IPollinatable receiver = GeneticsUtil.getOrCreatePollinatable(housing.getOwnerName(), world, posBlock.x, posBlock.y, posBlock.z); if(receiver == null) continue; - if (!genome.getFlowerProvider().isAcceptedPollinatable(housing.getWorld(), receiver)) + if (!genome.getFlowerProvider().isAcceptedPollinatable(world, receiver)) continue; if (!receiver.canMateWith(pollen)) continue; @@ -678,35 +631,33 @@ public class Bee extends IndividualLiving implements IBee { @Override public void plantFlowerRandom(IBeeHousing housing) { - int chance = (int) (genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f)); + int chance = Math.round(genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f)); + + World world = housing.getWorld(); + Random random = world.rand; // Correct speed - if (housing.getWorld().rand.nextInt(100) >= chance) + if (random.nextInt(100) >= chance) return; // Gather required info IFlowerProvider provider = genome.getFlowerProvider(); - int[] areaAr = genome.getTerritory(); - Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(housing.getTerritoryModifier(genome, 1f)).multiply(3.0f); - Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 4), -Math.round(area.z / 2)); + Vect area = getArea(genome, housing); + Vect offset = new Vect(-area.x / 2, -area.y / 4, -area.z / 2); + Vect housingPos = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()); - if (area.x < 1) - area.x = 1; - if (area.y < 1) - area.y = 1; - if (area.z < 1) - area.z = 1; - - // We have up to ten attempts for (int i = 0; i < 10; i++) { + Vect randomPos = Vect.getRandomPositionInArea(random, area); + Vect posBlock = Vect.add(housingPos, randomPos, offset); - Vect randomPos = new Vect(housing.getWorld().rand.nextInt(area.x), housing.getWorld().rand.nextInt(area.y), housing.getWorld().rand.nextInt(area.z)); - - Vect posBlock = randomPos.add(new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord())); - posBlock = posBlock.add(offset); - - if (provider.growFlower(housing.getWorld(), this, posBlock.x, posBlock.y, posBlock.z)) + if (provider.growFlower(world, this, posBlock.x, posBlock.y, posBlock.z)) break; } } + + private static Vect getArea(IBeeGenome genome, IBeeHousing housing) { + int[] genomeTerritory = genome.getTerritory(); + float housingModifier = housing.getTerritoryModifier(genome, 1f); + return new Vect(genomeTerritory).multiply(housingModifier * 3.0f); + } } diff --git a/src/main/java/forestry/apiculture/genetics/BeeGenome.java b/src/main/java/forestry/apiculture/genetics/BeeGenome.java index b41ee9b22..4912cc2ef 100755 --- a/src/main/java/forestry/apiculture/genetics/BeeGenome.java +++ b/src/main/java/forestry/apiculture/genetics/BeeGenome.java @@ -26,7 +26,7 @@ import forestry.core.genetics.AlleleArea; import forestry.core.genetics.AlleleBoolean; import forestry.core.genetics.AlleleTolerance; import forestry.core.genetics.Genome; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import forestry.plugins.PluginApiculture; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; diff --git a/src/main/java/forestry/apiculture/genetics/JubilanceDefault.java b/src/main/java/forestry/apiculture/genetics/JubilanceDefault.java index 6b6a1d2c4..2d1baf043 100755 --- a/src/main/java/forestry/apiculture/genetics/JubilanceDefault.java +++ b/src/main/java/forestry/apiculture/genetics/JubilanceDefault.java @@ -15,7 +15,7 @@ import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeHousing; import forestry.api.core.EnumHumidity; import forestry.api.core.EnumTemperature; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/apiculture/genetics/MutationEMC.java b/src/main/java/forestry/apiculture/genetics/MutationEMC.java index f893aea25..3a929bdc0 100755 --- a/src/main/java/forestry/apiculture/genetics/MutationEMC.java +++ b/src/main/java/forestry/apiculture/genetics/MutationEMC.java @@ -14,7 +14,7 @@ import forestry.api.apiculture.IBeeHousing; import forestry.api.genetics.IAllele; import forestry.api.genetics.IGenome; import forestry.core.proxy.Proxies; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.lang.reflect.Field; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java b/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java index 6cd2f69ca..48e02b8a4 100755 --- a/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java +++ b/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java @@ -25,7 +25,7 @@ import forestry.core.genetics.AlleleArea; import forestry.core.genetics.AlleleBoolean; import forestry.core.gui.GuiAlyzer; import forestry.core.utils.StringUtil; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import forestry.plugins.PluginApiculture; import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/forestry/apiculture/items/ItemBiomefinder.java b/src/main/java/forestry/apiculture/items/ItemBiomefinder.java index 88301d50d..a8ac828fd 100755 --- a/src/main/java/forestry/apiculture/items/ItemBiomefinder.java +++ b/src/main/java/forestry/apiculture/items/ItemBiomefinder.java @@ -25,7 +25,7 @@ import forestry.core.inventory.ItemInventory; import forestry.core.items.ItemInventoried; import forestry.core.network.GuiId; import forestry.core.proxy.Proxies; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import forestry.plugins.PluginApiculture; import java.util.ArrayList; import net.minecraft.client.renderer.texture.IIconRegister; diff --git a/src/main/java/forestry/arboriculture/genetics/AlleleLeafEffectNone.java b/src/main/java/forestry/arboriculture/genetics/AlleleLeafEffectNone.java index f011cdd38..e6e8dde43 100755 --- a/src/main/java/forestry/arboriculture/genetics/AlleleLeafEffectNone.java +++ b/src/main/java/forestry/arboriculture/genetics/AlleleLeafEffectNone.java @@ -14,7 +14,7 @@ import forestry.api.arboriculture.IAlleleLeafEffect; import forestry.api.arboriculture.ITreeGenome; import forestry.api.genetics.IEffectData; import forestry.core.genetics.Allele; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; diff --git a/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java b/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java index 7047f7910..a180dce2d 100755 --- a/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java +++ b/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java @@ -17,7 +17,7 @@ import forestry.api.arboriculture.ITreeGenome; import forestry.arboriculture.gadgets.TileSapling; import forestry.core.utils.StringUtil; import forestry.core.utils.Utils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java index ac89f234b..e290f424d 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java @@ -14,7 +14,7 @@ import com.mojang.authlib.GameProfile; import forestry.api.world.ITreeGenData; import forestry.arboriculture.gadgets.TileSapling; import forestry.core.utils.Utils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import forestry.core.worldgen.BlockType; import forestry.core.worldgen.WorldGenBase; import net.minecraft.init.Blocks; diff --git a/src/main/java/forestry/core/gadgets/StructureLogic.java b/src/main/java/forestry/core/gadgets/StructureLogic.java index bf7ec925d..96632ace4 100755 --- a/src/main/java/forestry/core/gadgets/StructureLogic.java +++ b/src/main/java/forestry/core/gadgets/StructureLogic.java @@ -16,7 +16,7 @@ import forestry.core.config.Defaults; import forestry.core.gadgets.BlockStructure.EnumStructureState; import forestry.core.utils.Schemata; import forestry.core.utils.Schemata.EnumStructureBlock; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.HashMap; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/forestry/core/gadgets/TileForestry.java b/src/main/java/forestry/core/gadgets/TileForestry.java index d8c777ec9..a4bc744a3 100755 --- a/src/main/java/forestry/core/gadgets/TileForestry.java +++ b/src/main/java/forestry/core/gadgets/TileForestry.java @@ -30,7 +30,7 @@ import forestry.core.proxy.Proxies; import forestry.core.utils.AdjacentTileCache; import forestry.core.utils.EnumAccess; import forestry.core.utils.PlayerUtil; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.Collection; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; diff --git a/src/main/java/forestry/core/genetics/AlleleArea.java b/src/main/java/forestry/core/genetics/AlleleArea.java index 88d7b57f5..dfec2771f 100755 --- a/src/main/java/forestry/core/genetics/AlleleArea.java +++ b/src/main/java/forestry/core/genetics/AlleleArea.java @@ -12,7 +12,7 @@ package forestry.core.genetics; import forestry.api.genetics.IAlleleArea; import forestry.core.utils.StringUtil; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; public class AlleleArea extends Allele implements IAlleleArea { diff --git a/src/main/java/forestry/core/utils/BlockUtil.java b/src/main/java/forestry/core/utils/BlockUtil.java index de6782603..059f9fde9 100644 --- a/src/main/java/forestry/core/utils/BlockUtil.java +++ b/src/main/java/forestry/core/utils/BlockUtil.java @@ -17,6 +17,8 @@ import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.IPipeTile.PipeType; import cofh.api.energy.IEnergyHandler; import forestry.core.config.Defaults; +import forestry.core.vect.Vect; + import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; diff --git a/src/main/java/forestry/core/utils/Schemata.java b/src/main/java/forestry/core/utils/Schemata.java index 968d6a698..b0adbee8f 100755 --- a/src/main/java/forestry/core/utils/Schemata.java +++ b/src/main/java/forestry/core/utils/Schemata.java @@ -11,6 +11,7 @@ package forestry.core.utils; import forestry.core.config.Config; +import forestry.core.vect.Vect; public class Schemata { public enum EnumStructureBlock { diff --git a/src/main/java/forestry/core/utils/Utils.java b/src/main/java/forestry/core/utils/Utils.java index a05a1c523..b20588b68 100755 --- a/src/main/java/forestry/core/utils/Utils.java +++ b/src/main/java/forestry/core/utils/Utils.java @@ -37,6 +37,7 @@ import forestry.api.core.ForestryAPI; import forestry.api.core.ITileStructure; import forestry.core.gadgets.TileForestry; import forestry.core.proxy.Proxies; +import forestry.core.vect.Vect; import buildcraft.api.tools.IToolWrench; diff --git a/src/main/java/forestry/core/vect/IVect.java b/src/main/java/forestry/core/vect/IVect.java new file mode 100644 index 000000000..b20c33149 --- /dev/null +++ b/src/main/java/forestry/core/vect/IVect.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.vect; + +/** + * Represents a position or dimensions. + */ +public interface IVect { + int getX(); + int getY(); + int getZ(); + + IVect add(IVect other); + IVect add(int x, int y, int z); +} diff --git a/src/main/java/forestry/core/vect/MutableVect.java b/src/main/java/forestry/core/vect/MutableVect.java new file mode 100644 index 000000000..7a765006e --- /dev/null +++ b/src/main/java/forestry/core/vect/MutableVect.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.vect; + +/** + * Represents changeable positions or dimensions. + */ +public class MutableVect implements IVect { + public int x; + public int y; + public int z; + + public MutableVect(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } + + public MutableVect(IVect vect) { + this.x = vect.getX(); + this.y = vect.getY(); + this.z = vect.getZ(); + } + + public MutableVect add(IVect other) { + x += other.getX(); + y += other.getY(); + z += other.getZ(); + return this; + } + + public MutableVect add(int x, int y, int z) { + this.x += x; + this.y += y; + this.z += z; + return this; + } + + public boolean advancePositionInArea(Vect area) { + // Increment z first until end reached + if (z < area.z - 1) + z++; + else { + z = 0; + + if (x < area.x - 1) + x++; + else { + x = 0; + + if (y < area.y - 1) + y++; + else + return false; + } + } + + return true; + } + + @Override + public int getX() { + return x; + } + + @Override + public int getY() { + return y; + } + + @Override + public int getZ() { + return z; + } +} diff --git a/src/main/java/forestry/core/utils/Vect.java b/src/main/java/forestry/core/vect/Vect.java old mode 100755 new mode 100644 similarity index 50% rename from src/main/java/forestry/core/utils/Vect.java rename to src/main/java/forestry/core/vect/Vect.java index 256b8c2d0..a9e0e25c3 --- a/src/main/java/forestry/core/utils/Vect.java +++ b/src/main/java/forestry/core/vect/Vect.java @@ -1,84 +1,110 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -package forestry.core.utils; - -/** - * Generic class to represent a position or dimensions. - */ -public class Vect { - public int x; - public int y; - public int z; - - public Vect(int[] dim) { - if (dim.length != 3) - throw new RuntimeException("Cannot instantiate a vector with less or more than 3 points."); - - this.x = dim[0]; - this.y = dim[1]; - this.z = dim[2]; - } - - public Vect(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public Vect add(Vect other) { - Vect result = new Vect(x, y, z); - result.x += other.x; - result.y += other.y; - result.z += other.z; - return result; - } - - public Vect multiply(float factor) { - Vect result = new Vect(x, y, z); - result.x *= factor; - result.y *= factor; - result.z *= factor; - return result; - } - - @Override - public String toString() { - return String.format("%sx%sx%s", x, y, z); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + x; - result = prime * result + y; - result = prime * result + z; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Vect other = (Vect) obj; - if (x != other.x) - return false; - if (y != other.y) - return false; - if (z != other.z) - return false; - return true; - } -} +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.vect; + +import java.util.Random; + +/** + * Represents an unchangeable position or dimensions. + */ +public class Vect implements IVect { + public final int x; + public final int y; + public final int z; + + public Vect(int[] dim) { + if (dim.length != 3) + throw new RuntimeException("Cannot instantiate a vector with less or more than 3 points."); + + this.x = dim[0]; + this.y = dim[1]; + this.z = dim[2]; + } + + public Vect(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } + + public static Vect getRandomPositionInArea(Random random, IVect area) { + int x = random.nextInt(area.getX()); + int y = random.nextInt(area.getY()); + int z = random.nextInt(area.getZ()); + return new Vect(x, y, z); + } + + public static Vect add(IVect... vects) { + int x = 0; + int y = 0; + int z = 0; + for (IVect vect : vects) { + x += vect.getX(); + y += vect.getY(); + z += vect.getZ(); + } + return new Vect(x, y, z); + } + + @Override + public Vect add(IVect other) { + return new Vect(x + other.getX(), y + other.getY(), z + other.getZ()); + } + + @Override + public Vect add(int x, int y, int z) { + return new Vect(this.x + x, this.y + y, this.z + z); + } + + public Vect multiply(float factor) { + return new Vect(Math.round(x * factor), Math.round(y * factor), Math.round(z * factor)); + } + + @Override + public String toString() { + return String.format("%sx%sx%s", x, y, z); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + x; + result = prime * result + y; + result = prime * result + z; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!(obj instanceof Vect)) + return false; + Vect other = (Vect) obj; + return (x == other.x) && (y == other.y) && (z == other.z); + } + + @Override + public int getX() { + return x; + } + + @Override + public int getY() { + return y; + } + + @Override + public int getZ() { + return z; + } +} diff --git a/src/main/java/forestry/farming/FarmTarget.java b/src/main/java/forestry/farming/FarmTarget.java index b707f5d98..ba055e045 100755 --- a/src/main/java/forestry/farming/FarmTarget.java +++ b/src/main/java/forestry/farming/FarmTarget.java @@ -1,53 +1,53 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -package forestry.farming; - -import forestry.core.utils.Vect; - -public class FarmTarget { - - private Vect start; - private int yOffset; - private int extent; - private int limit; - - public FarmTarget(Vect start) { - this.start = start; - } - - public void setYOffset(int yOffset) { - this.yOffset = yOffset; - } - - public void setLimit(int limit) { - this.limit = limit; - } - - public void setExtent(int extent) { - this.extent = extent; - } - - public Vect getStart() { - return start; - } - - public int getYOffset() { - return this.yOffset; - } - - public int getLimit() { - return limit; - } - - public int getExtent() { - return extent; - } -} +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.farming; + +import forestry.core.vect.Vect; + +public class FarmTarget { + + private Vect start; + private int yOffset; + private int extent; + private int limit; + + public FarmTarget(Vect start) { + this.start = start; + } + + public void setYOffset(int yOffset) { + this.yOffset = yOffset; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public void setExtent(int extent) { + this.extent = extent; + } + + public Vect getStart() { + return start; + } + + public int getYOffset() { + return this.yOffset; + } + + public int getLimit() { + return limit; + } + + public int getExtent() { + return extent; + } +} diff --git a/src/main/java/forestry/farming/gadgets/StructureLogicFarm.java b/src/main/java/forestry/farming/gadgets/StructureLogicFarm.java index ce6371ba7..ec5acea0d 100755 --- a/src/main/java/forestry/farming/gadgets/StructureLogicFarm.java +++ b/src/main/java/forestry/farming/gadgets/StructureLogicFarm.java @@ -16,7 +16,7 @@ import forestry.core.gadgets.BlockStructure.EnumStructureState; import forestry.core.gadgets.StructureLogic; import forestry.core.utils.Schemata; import forestry.core.utils.Schemata.EnumStructureBlock; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.HashSet; import java.util.Set; import net.minecraft.block.Block; diff --git a/src/main/java/forestry/farming/gadgets/TileControl.java b/src/main/java/forestry/farming/gadgets/TileControl.java index 54b90f082..f5e6280d1 100755 --- a/src/main/java/forestry/farming/gadgets/TileControl.java +++ b/src/main/java/forestry/farming/gadgets/TileControl.java @@ -15,7 +15,7 @@ import forestry.api.farming.ICrop; import forestry.api.farming.IFarmComponent; import forestry.api.farming.IFarmListener; import forestry.api.farming.IFarmLogic; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.Collection; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/forestry/farming/gadgets/TileFarmPlain.java b/src/main/java/forestry/farming/gadgets/TileFarmPlain.java index 884071ab9..e275ae474 100755 --- a/src/main/java/forestry/farming/gadgets/TileFarmPlain.java +++ b/src/main/java/forestry/farming/gadgets/TileFarmPlain.java @@ -38,7 +38,7 @@ import forestry.core.proxy.Proxies; import forestry.core.utils.DelayTimer; import forestry.core.utils.StackUtils; import forestry.core.utils.Utils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import forestry.farming.FarmTarget; import forestry.farming.logic.FarmLogicArboreal; import forestry.plugins.PluginFarming; diff --git a/src/main/java/forestry/farming/logic/Crop.java b/src/main/java/forestry/farming/logic/Crop.java index 2262e944c..c227a38e2 100755 --- a/src/main/java/forestry/farming/logic/Crop.java +++ b/src/main/java/forestry/farming/logic/Crop.java @@ -12,7 +12,7 @@ package forestry.farming.logic; import forestry.api.farming.ICrop; import forestry.core.config.Defaults; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.Collection; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/farming/logic/CropBlock.java b/src/main/java/forestry/farming/logic/CropBlock.java index 82e555ca9..707583b2a 100755 --- a/src/main/java/forestry/farming/logic/CropBlock.java +++ b/src/main/java/forestry/farming/logic/CropBlock.java @@ -11,7 +11,7 @@ package forestry.farming.logic; import forestry.core.proxy.Proxies; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.Collection; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/farming/logic/CropFruit.java b/src/main/java/forestry/farming/logic/CropFruit.java index ffc199471..07f0e8f1a 100755 --- a/src/main/java/forestry/farming/logic/CropFruit.java +++ b/src/main/java/forestry/farming/logic/CropFruit.java @@ -14,7 +14,7 @@ import forestry.api.genetics.IFruitBearer; import forestry.api.genetics.IFruitFamily; import forestry.core.network.PacketFXSignal; import forestry.core.proxy.Proxies; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.ArrayList; import java.util.Collection; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/farming/logic/CropPeat.java b/src/main/java/forestry/farming/logic/CropPeat.java index 949deefec..af55bd49a 100755 --- a/src/main/java/forestry/farming/logic/CropPeat.java +++ b/src/main/java/forestry/farming/logic/CropPeat.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import forestry.core.gadgets.BlockSoil; import forestry.core.proxy.Proxies; import forestry.core.utils.BlockUtil; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.ArrayList; import java.util.Collection; import net.minecraft.block.Block; diff --git a/src/main/java/forestry/farming/logic/CropRubber.java b/src/main/java/forestry/farming/logic/CropRubber.java index ac7dfc885..4d7349485 100755 --- a/src/main/java/forestry/farming/logic/CropRubber.java +++ b/src/main/java/forestry/farming/logic/CropRubber.java @@ -12,7 +12,7 @@ package forestry.farming.logic; import forestry.core.config.Defaults; import forestry.core.proxy.Proxies; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import forestry.plugins.PluginIC2; import java.util.ArrayList; import java.util.Collection; diff --git a/src/main/java/forestry/farming/logic/FarmLogic.java b/src/main/java/forestry/farming/logic/FarmLogic.java index 97e1419f4..24abcc6db 100755 --- a/src/main/java/forestry/farming/logic/FarmLogic.java +++ b/src/main/java/forestry/farming/logic/FarmLogic.java @@ -10,21 +10,25 @@ ******************************************************************************/ package forestry.farming.logic; -import forestry.api.farming.IFarmHousing; -import forestry.api.farming.IFarmLogic; -import forestry.core.config.Defaults; -import forestry.core.config.ForestryBlock; -import forestry.core.render.SpriteSheet; -import forestry.core.utils.Vect; import java.util.HashSet; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; + import net.minecraftforge.common.util.ForgeDirection; +import forestry.api.farming.IFarmHousing; +import forestry.api.farming.IFarmLogic; +import forestry.core.config.Defaults; +import forestry.core.config.ForestryBlock; +import forestry.core.render.SpriteSheet; +import forestry.core.vect.IVect; +import forestry.core.vect.Vect; + public abstract class FarmLogic implements IFarmLogic { IFarmHousing housing; @@ -67,8 +71,8 @@ public abstract class FarmLogic implements IFarmLogic { return SpriteSheet.ITEMS.getLocation(); } - protected final boolean isAirBlock(Vect position) { - return getWorld().isAirBlock(position.x, position.y, position.z); + protected final boolean isAirBlock(IVect position) { + return getWorld().isAirBlock(position.getX(), position.getY(), position.getZ()); } protected final boolean isAirBlock(Block block) { @@ -80,20 +84,20 @@ public abstract class FarmLogic implements IFarmLogic { world.getBlockMetadata(position.x, position.y, position.z) == 0; } - protected final boolean isWoodBlock(Vect position) { + protected final boolean isWoodBlock(IVect position) { Block block = getBlock(position); - return block.isWood(getWorld(), position.x, position.y, position.z); + return block.isWood(getWorld(), position.getX(), position.getY(), position.getZ()); } - protected final Block getBlock(Vect position) { - return getWorld().getBlock(position.x, position.y, position.z); + protected final Block getBlock(IVect position) { + return getWorld().getBlock(position.getX(), position.getY(), position.getZ()); } - protected final int getBlockMeta(Vect position) { - return getWorld().getBlockMetadata(position.x, position.y, position.z); + protected final int getBlockMeta(IVect position) { + return getWorld().getBlockMetadata(position.getX(), position.getY(), position.getZ()); } - protected final ItemStack getAsItemStack(Vect position) { + protected final ItemStack getAsItemStack(IVect position) { return new ItemStack(getBlock(position), 1, getBlockMeta(position)); } diff --git a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java index 00352ab7c..145d70a9e 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java +++ b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java @@ -19,7 +19,7 @@ import forestry.api.farming.IFarmable; import forestry.core.config.ForestryBlock; import forestry.core.gadgets.BlockSoil; import forestry.core.render.SpriteSheet; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -101,7 +101,7 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous { Vect offset = new Vect(housing.getOffset()); Vect min = coords.add(offset); - Vect max = coords.add(offset).add(area); + Vect max = min.add(area); AxisAlignedBB harvestBox = AxisAlignedBB.getBoundingBox(min.x, min.y, min.z, max.x, getWorld().getHeight(), max.z); List list = getWorld().getEntitiesWithinAABB(Entity.class, harvestBox); diff --git a/src/main/java/forestry/farming/logic/FarmLogicCocoa.java b/src/main/java/forestry/farming/logic/FarmLogicCocoa.java index 5a1c4eedb..967fac68a 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicCocoa.java +++ b/src/main/java/forestry/farming/logic/FarmLogicCocoa.java @@ -15,7 +15,8 @@ import cpw.mods.fml.relauncher.SideOnly; import forestry.api.farming.ICrop; import forestry.api.farming.IFarmHousing; import forestry.api.farming.IFarmable; -import forestry.core.utils.Vect; +import forestry.core.vect.MutableVect; +import forestry.core.vect.Vect; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -123,7 +124,7 @@ public class FarmLogicCocoa extends FarmLogic { World world = getWorld(); - Vect current = position; + MutableVect current = new MutableVect(position); while (isWoodBlock(current) && BlockLog.func_150165_c(getBlockMeta(current)) == 3) { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { @@ -135,7 +136,7 @@ public class FarmLogicCocoa extends FarmLogic { return housing.plantGermling(cocoa, world, candidate.x, candidate.y, candidate.z); } - current = current.add(new Vect(0, 1, 0)); + current.y++; if (current.y - position.y > 1) break; } diff --git a/src/main/java/forestry/farming/logic/FarmLogicCrops.java b/src/main/java/forestry/farming/logic/FarmLogicCrops.java index 29e9a2b95..1e8af8cbc 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicCrops.java +++ b/src/main/java/forestry/farming/logic/FarmLogicCrops.java @@ -16,7 +16,8 @@ import forestry.api.farming.IFarmable; import forestry.core.config.Defaults; import forestry.core.utils.StackUtils; import forestry.core.utils.Utils; -import forestry.core.utils.Vect; +import forestry.core.vect.IVect; +import forestry.core.vect.Vect; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -74,7 +75,7 @@ public abstract class FarmLogicCrops extends FarmLogicWatered { Vect offset = new Vect(housing.getOffset()); Vect min = coords.add(offset); - Vect max = coords.add(offset).add(area); + Vect max = min.add(area); AxisAlignedBB harvestBox = AxisAlignedBB.getBoundingBox(min.x, min.y, min.z, max.x, max.y, max.z); List list = housing.getWorld().getEntitiesWithinAABB(Entity.class, harvestBox); @@ -106,7 +107,7 @@ public abstract class FarmLogicCrops extends FarmLogicWatered { if (!isAirBlock(position) && !Utils.isReplaceableBlock(getWorld(), position.x, position.y, position.z)) continue; - ItemStack below = getAsItemStack(position.add(new Vect(0, -1, 0))); + ItemStack below = getAsItemStack(position.add(0, -1, 0)); if (ground.getItem() != below.getItem()) continue; if (below.getItemDamage() <= 0) @@ -118,11 +119,11 @@ public abstract class FarmLogicCrops extends FarmLogicWatered { return false; } - private boolean trySetCrop(Vect position) { + private boolean trySetCrop(IVect position) { World world = getWorld(); for (IFarmable candidate : seeds) - if (housing.plantGermling(candidate, world, position.x, position.y, position.z)) + if (housing.plantGermling(candidate, world, position.getX(), position.getY(), position.getZ())) return true; return false; diff --git a/src/main/java/forestry/farming/logic/FarmLogicGourd.java b/src/main/java/forestry/farming/logic/FarmLogicGourd.java index 4af434431..39a425f83 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicGourd.java +++ b/src/main/java/forestry/farming/logic/FarmLogicGourd.java @@ -16,7 +16,7 @@ import forestry.api.farming.Farmables; import forestry.api.farming.ICrop; import forestry.api.farming.IFarmHousing; import forestry.api.farming.IFarmable; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.Collection; import java.util.Stack; import net.minecraft.init.Items; diff --git a/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java b/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java index 5fa931400..cf31c5407 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java +++ b/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java @@ -14,7 +14,7 @@ import forestry.api.farming.IFarmHousing; import forestry.api.farming.IFarmable; import forestry.core.utils.BlockUtil; import forestry.core.utils.StackUtils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.ArrayList; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; diff --git a/src/main/java/forestry/farming/logic/FarmLogicInfernal.java b/src/main/java/forestry/farming/logic/FarmLogicInfernal.java index 2eb3af892..2a4e36a80 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicInfernal.java +++ b/src/main/java/forestry/farming/logic/FarmLogicInfernal.java @@ -17,7 +17,7 @@ import forestry.api.farming.ICrop; import forestry.api.farming.IFarmHousing; import forestry.api.farming.IFarmable; import forestry.core.utils.Utils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.Collection; import java.util.Stack; import net.minecraft.init.Blocks; @@ -89,7 +89,7 @@ public class FarmLogicInfernal extends FarmLogicHomogeneous { if (!isAirBlock(position) && !Utils.isReplaceableBlock(world, position.x, position.y, position.z)) continue; - ItemStack below = getAsItemStack(position.add(new Vect(0, -1, 0))); + ItemStack below = getAsItemStack(position.add(0, -1, 0)); if (!isAcceptedGround(below)) continue; diff --git a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java index 642b930ed..e870ecf18 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java +++ b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java @@ -16,7 +16,7 @@ import forestry.api.farming.ICrop; import forestry.api.farming.IFarmHousing; import forestry.api.genetics.IFruitBearer; import forestry.core.config.ForestryItem; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; diff --git a/src/main/java/forestry/farming/logic/FarmLogicPeat.java b/src/main/java/forestry/farming/logic/FarmLogicPeat.java index f37cf7575..63c769da2 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicPeat.java +++ b/src/main/java/forestry/farming/logic/FarmLogicPeat.java @@ -17,7 +17,7 @@ import forestry.api.farming.IFarmHousing; import forestry.core.config.ForestryBlock; import forestry.core.config.ForestryItem; import forestry.core.gadgets.BlockSoil; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.Collection; import java.util.Stack; import net.minecraft.block.Block; diff --git a/src/main/java/forestry/farming/logic/FarmLogicPoale.java b/src/main/java/forestry/farming/logic/FarmLogicPoale.java index cca789b17..b19211f5e 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicPoale.java +++ b/src/main/java/forestry/farming/logic/FarmLogicPoale.java @@ -17,7 +17,7 @@ import forestry.api.farming.ICrop; import forestry.api.farming.IFarmHousing; import forestry.api.farming.IFarmable; import forestry.core.utils.StackUtils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.Collection; import java.util.Stack; import net.minecraft.init.Blocks; diff --git a/src/main/java/forestry/farming/logic/FarmLogicRubber.java b/src/main/java/forestry/farming/logic/FarmLogicRubber.java index 53fc99782..46566329e 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicRubber.java +++ b/src/main/java/forestry/farming/logic/FarmLogicRubber.java @@ -16,7 +16,7 @@ import forestry.api.farming.ICrop; import forestry.api.farming.IFarmHousing; import forestry.core.proxy.Proxies; import forestry.core.utils.StackUtils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import forestry.plugins.PluginIC2; import java.util.ArrayList; import java.util.Collection; diff --git a/src/main/java/forestry/farming/logic/FarmLogicSucculent.java b/src/main/java/forestry/farming/logic/FarmLogicSucculent.java index 68a2ec2fb..fb5c3bc68 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicSucculent.java +++ b/src/main/java/forestry/farming/logic/FarmLogicSucculent.java @@ -17,7 +17,7 @@ import forestry.api.farming.ICrop; import forestry.api.farming.IFarmHousing; import forestry.api.farming.IFarmable; import forestry.core.utils.StackUtils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.Collection; import java.util.Stack; import net.minecraft.init.Blocks; diff --git a/src/main/java/forestry/farming/logic/FarmLogicWatered.java b/src/main/java/forestry/farming/logic/FarmLogicWatered.java index 7dd55ac91..979c578c5 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicWatered.java +++ b/src/main/java/forestry/farming/logic/FarmLogicWatered.java @@ -15,7 +15,7 @@ import forestry.core.fluids.Fluids; import forestry.core.utils.BlockUtil; import forestry.core.utils.StackUtils; import forestry.core.utils.Utils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import java.util.ArrayList; import java.util.Collection; import net.minecraft.block.Block; @@ -154,7 +154,7 @@ public abstract class FarmLogicWatered extends FarmLogic { // don't place water close to other water for (int x = -2; x <= 2; x++) { for (int z = -2; z <= 2; z++) { - Vect offsetPosition = position.add(new Vect(x, 0, z)); + Vect offsetPosition = position.add(x, 0, z); if (isWaterSourceBlock(world, offsetPosition)) return false; } @@ -162,12 +162,12 @@ public abstract class FarmLogicWatered extends FarmLogic { // don't place water if it can flow into blocks next to it for (int x = -1; x <= 1; x++) { - Vect offsetPosition = position.add(new Vect(x, 0, 0)); + Vect offsetPosition = position.add(x, 0, 0); if (isAirBlock(offsetPosition)) return false; } for (int z = -1; z <= 1; z++) { - Vect offsetPosition = position.add(new Vect(0, 0, z)); + Vect offsetPosition = position.add(0, 0, z); if (isAirBlock(offsetPosition)) return false; } diff --git a/src/main/java/forestry/farming/logic/FarmableCocoa.java b/src/main/java/forestry/farming/logic/FarmableCocoa.java index a5874201b..d4d410279 100755 --- a/src/main/java/forestry/farming/logic/FarmableCocoa.java +++ b/src/main/java/forestry/farming/logic/FarmableCocoa.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import forestry.api.farming.ICrop; import forestry.api.farming.IFarmable; import forestry.core.utils.BlockUtil; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; diff --git a/src/main/java/forestry/farming/logic/FarmableFarmCraftory.java b/src/main/java/forestry/farming/logic/FarmableFarmCraftory.java index ce13c3ca7..83709dd1f 100755 --- a/src/main/java/forestry/farming/logic/FarmableFarmCraftory.java +++ b/src/main/java/forestry/farming/logic/FarmableFarmCraftory.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import forestry.api.farming.ICrop; import forestry.api.farming.IFarmable; import forestry.core.utils.StackUtils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import forestry.plugins.PluginFarmCraftory; import java.util.Collection; import net.minecraft.block.Block; diff --git a/src/main/java/forestry/farming/logic/FarmableGE.java b/src/main/java/forestry/farming/logic/FarmableGE.java index 556c6cb4b..358bf9465 100755 --- a/src/main/java/forestry/farming/logic/FarmableGE.java +++ b/src/main/java/forestry/farming/logic/FarmableGE.java @@ -15,7 +15,7 @@ import forestry.api.farming.ICrop; import forestry.api.farming.IFarmable; import forestry.arboriculture.genetics.TreeGenome; import forestry.core.config.ForestryBlock; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/farming/logic/FarmableGenericCrop.java b/src/main/java/forestry/farming/logic/FarmableGenericCrop.java index 632ce5344..1309aeb47 100755 --- a/src/main/java/forestry/farming/logic/FarmableGenericCrop.java +++ b/src/main/java/forestry/farming/logic/FarmableGenericCrop.java @@ -12,7 +12,7 @@ package forestry.farming.logic; import forestry.api.farming.ICrop; import forestry.api.farming.IFarmable; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/farming/logic/FarmableGenericSapling.java b/src/main/java/forestry/farming/logic/FarmableGenericSapling.java index f49c16760..6834df2b0 100755 --- a/src/main/java/forestry/farming/logic/FarmableGenericSapling.java +++ b/src/main/java/forestry/farming/logic/FarmableGenericSapling.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import forestry.api.farming.ICrop; import forestry.api.farming.IFarmable; import forestry.core.utils.StackUtils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/farming/logic/FarmableGourd.java b/src/main/java/forestry/farming/logic/FarmableGourd.java index 7d340265d..57136907f 100755 --- a/src/main/java/forestry/farming/logic/FarmableGourd.java +++ b/src/main/java/forestry/farming/logic/FarmableGourd.java @@ -14,7 +14,7 @@ import forestry.api.farming.ICrop; import forestry.api.farming.IFarmable; import forestry.core.config.Defaults; import forestry.core.utils.StackUtils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; diff --git a/src/main/java/forestry/farming/logic/FarmableStacked.java b/src/main/java/forestry/farming/logic/FarmableStacked.java index 50311afeb..b41fbb287 100755 --- a/src/main/java/forestry/farming/logic/FarmableStacked.java +++ b/src/main/java/forestry/farming/logic/FarmableStacked.java @@ -14,7 +14,7 @@ import forestry.api.farming.ICrop; import forestry.api.farming.IFarmable; import forestry.core.config.Defaults; import forestry.core.utils.StackUtils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java b/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java index 0b739124b..d6c068b42 100755 --- a/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java +++ b/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java @@ -15,7 +15,7 @@ import forestry.core.config.Defaults; import forestry.core.config.ForestryBlock; import forestry.core.proxy.Proxies; import forestry.core.utils.StackUtils; -import forestry.core.utils.Vect; +import forestry.core.vect.Vect; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks;