mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 12:59:44 +00:00
Update for 1.11. Missing assets, unstable.
This commit is contained in:
1 parent
30d7365518
commit
9611ae08ae
1145 files changed
+15561
-18107
No files matched your search
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -19,18 +18,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
@@ -64,22 +52,29 @@ import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.GenericRatings;
|
||||
import forestry.core.genetics.IndividualLiving;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.core.utils.VectUtil;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
private int generation;
|
||||
private boolean isNatural = true;
|
||||
|
||||
@Nonnull
|
||||
private final IBeeGenome genome;
|
||||
@Nullable
|
||||
private IBeeGenome mate;
|
||||
|
||||
/* CONSTRUCTOR */
|
||||
public Bee(@Nonnull NBTTagCompound nbt) {
|
||||
public Bee(NBTTagCompound nbt) {
|
||||
super(nbt);
|
||||
|
||||
if (nbt.hasKey("NA")) {
|
||||
@@ -101,16 +96,16 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
}
|
||||
|
||||
public Bee(@Nonnull IBeeGenome genome, IBee mate) {
|
||||
public Bee(IBeeGenome genome, IBee mate) {
|
||||
this(genome);
|
||||
this.mate = mate.getGenome();
|
||||
}
|
||||
|
||||
public Bee(@Nonnull IBeeGenome genome) {
|
||||
public Bee(IBeeGenome genome) {
|
||||
this(genome, true, 0);
|
||||
}
|
||||
|
||||
private Bee(@Nonnull IBeeGenome genome, boolean isNatural, int generation) {
|
||||
private Bee(IBeeGenome genome, boolean isNatural, int generation) {
|
||||
super(genome.getLifespan());
|
||||
this.genome = genome;
|
||||
this.isNatural = isNatural;
|
||||
@@ -162,10 +157,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
public IEffectData[] doEffect(IEffectData[] storedData, IBeeHousing housing) {
|
||||
IAlleleBeeEffect effect = genome.getEffect();
|
||||
|
||||
if (effect == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
storedData[0] = doEffect(effect, storedData[0], housing);
|
||||
|
||||
// Return here if the primary can already not be combined
|
||||
@@ -192,10 +183,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
public IEffectData[] doFX(IEffectData[] storedData, IBeeHousing housing) {
|
||||
IAlleleBeeEffect effect = genome.getEffect();
|
||||
|
||||
if (effect == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
storedData[0] = doFX(effect, storedData[0], housing);
|
||||
|
||||
// Return here if the primary can already not be combined
|
||||
@@ -218,7 +205,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
// / INFORMATION
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeGenome getGenome() {
|
||||
return genome;
|
||||
@@ -235,7 +221,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
this.writeToNBT(nbttagcompound);
|
||||
return new Bee(nbttagcompound);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -246,7 +231,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public Set<IErrorState> getCanWork(IBeeHousing housing) {
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingCoords = housing.getCoordinates();
|
||||
|
||||
Set<IErrorState> errorStates = new HashSet<>();
|
||||
|
||||
@@ -279,7 +263,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
// / Check for the sky, except if in hell
|
||||
if (!world.provider.getHasNoSky()) {
|
||||
if (!world.provider.hasNoSky()) {
|
||||
if (!housing.canBlockSeeTheSky() && !canWorkUnderground(beeModifier)) {
|
||||
errorStates.add(EnumErrorCode.NO_SKY);
|
||||
}
|
||||
@@ -335,10 +319,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
private boolean isSuitableBiome(Biome biome) {
|
||||
if (biome == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EnumTemperature temperature = EnumTemperature.getFromBiome(biome);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(biome.getRainfall());
|
||||
return isSuitableClimate(temperature, humidity);
|
||||
@@ -351,8 +331,8 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Biome> getSuitableBiomes() {
|
||||
ArrayList<Biome> suitableBiomes = new ArrayList<>();
|
||||
public List<Biome> getSuitableBiomes() {
|
||||
List<Biome> suitableBiomes = new ArrayList<>();
|
||||
for (Biome biome : Biome.REGISTRY) {
|
||||
if (isSuitableBiome(biome)) {
|
||||
suitableBiomes.add(biome);
|
||||
@@ -473,17 +453,9 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] produceStacks(IBeeHousing housing) {
|
||||
if (housing == null) {
|
||||
Log.warning("Failed to produce in an apiary because the beehousing was null.");
|
||||
return null;
|
||||
}
|
||||
public List<ItemStack> produceStacks(IBeeHousing housing) {
|
||||
World world = housing.getWorldObj();
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(world);
|
||||
if (mode == null) {
|
||||
Log.warning("Failed to produce in an apiary because the beekeeping mode was null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> products = new ArrayList<>();
|
||||
|
||||
@@ -523,13 +495,13 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack[] productsArray = products.toArray(new ItemStack[products.size()]);
|
||||
BlockPos housingCoordinates = housing.getCoordinates();
|
||||
return genome.getFlowerProvider().affectProducts(world, this, housingCoordinates, productsArray);
|
||||
return genome.getFlowerProvider().affectProducts(world, this, housingCoordinates, products);
|
||||
}
|
||||
|
||||
/* REPRODUCTION */
|
||||
@Override
|
||||
@Nullable
|
||||
public IBee spawnPrincess(IBeeHousing housing) {
|
||||
|
||||
// We need a mated queen to produce offspring.
|
||||
@@ -542,17 +514,18 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return null;
|
||||
}
|
||||
|
||||
return createOffspring(housing, getGeneration() + 1);
|
||||
return createOffspring(housing, mate, getGeneration() + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IBee[] spawnDrones(IBeeHousing housing) {
|
||||
|
||||
World world = housing.getWorldObj();
|
||||
|
||||
// We need a mated queen to produce offspring.
|
||||
if (mate == null) {
|
||||
return null;
|
||||
return new IBee[]{};
|
||||
}
|
||||
|
||||
List<IBee> bees = new ArrayList<>();
|
||||
@@ -565,11 +538,9 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
for (int i = 0; i < toCreate; i++) {
|
||||
IBee offspring = createOffspring(housing, 0);
|
||||
if (offspring != null) {
|
||||
offspring.setIsNatural(true);
|
||||
bees.add(offspring);
|
||||
}
|
||||
IBee offspring = createOffspring(housing, mate, 0);
|
||||
offspring.setIsNatural(true);
|
||||
bees.add(offspring);
|
||||
}
|
||||
|
||||
if (!bees.isEmpty()) {
|
||||
@@ -579,7 +550,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
}
|
||||
|
||||
private IBee createOffspring(IBeeHousing housing, int generation) {
|
||||
private IBee createOffspring(IBeeHousing housing, IBeeGenome mate, int generation) {
|
||||
|
||||
World world = housing.getWorldObj();
|
||||
|
||||
@@ -588,7 +559,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
IChromosome[] parent2 = mate.getChromosomes();
|
||||
|
||||
// Check for mutation. Replace one of the parents with the mutation
|
||||
// template if mutation occured.
|
||||
// template if mutation occurred.
|
||||
IChromosome[] mutated1 = mutateSpecies(housing, genome, mate);
|
||||
if (mutated1 != null) {
|
||||
parent1 = mutated1;
|
||||
@@ -608,6 +579,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return new Bee(new BeeGenome(chromosomes), mode.isNaturalOffspring(this), generation);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static IChromosome[] mutateSpecies(IBeeHousing housing, IBeeGenome genomeOne, IBeeGenome genomeTwo) {
|
||||
|
||||
World world = housing.getWorldObj();
|
||||
@@ -665,6 +637,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
/* FLOWERS */
|
||||
@Override
|
||||
@Nullable
|
||||
public IIndividual retrievePollen(IBeeHousing housing) {
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
Reference in new issue
Block a user