mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 12:32:23 +00:00
Use ITree for pollen
This commit is contained in:
1 parent
86e3ae87fd
commit
545b051dd4
11 files changed
+37
-37
No files matched your search
@@ -13,9 +13,9 @@ import java.util.Set;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IIndividualLiving;
|
||||
|
||||
/**
|
||||
@@ -85,8 +85,8 @@ public interface IBee extends IIndividualLiving {
|
||||
|
||||
void plantFlowerRandom(IBeeHousing housing);
|
||||
|
||||
IIndividual retrievePollen(IBeeHousing housing);
|
||||
ITree retrievePollen(IBeeHousing housing);
|
||||
|
||||
boolean pollinateRandom(IBeeHousing housing, IIndividual pollen);
|
||||
boolean pollinateRandom(IBeeHousing housing, ITree pollen);
|
||||
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
|
||||
/**
|
||||
* Can be implemented by tile entities, if they wish to be pollinatable.
|
||||
*
|
||||
@@ -24,7 +26,7 @@ public interface IPollinatable {
|
||||
/**
|
||||
* @return IIndividual containing the genetic information of this IPollinatable
|
||||
*/
|
||||
IIndividual getPollen();
|
||||
ITree getPollen();
|
||||
|
||||
/**
|
||||
* Checks whether this {@link IPollinatable} can mate with the given pollen.
|
||||
@@ -35,7 +37,7 @@ public interface IPollinatable {
|
||||
* IIndividual representing the pollen.
|
||||
* @return true if mating is possible, false otherwise.
|
||||
*/
|
||||
boolean canMateWith(IIndividual pollen);
|
||||
boolean canMateWith(ITree pollen);
|
||||
|
||||
/**
|
||||
* Pollinates this entity.
|
||||
@@ -43,7 +45,7 @@ public interface IPollinatable {
|
||||
* @param pollen
|
||||
* IIndividual representing the pollen.
|
||||
*/
|
||||
void mateWith(IIndividual pollen);
|
||||
void mateWith(ITree pollen);
|
||||
|
||||
/**
|
||||
* @return true if this IPollinatable has already been pollinated.
|
||||
|
||||
@@ -8,7 +8,7 @@ package forestry.api.lepidopterology;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
|
||||
public interface IEntityButterfly extends IAnimals {
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface IEntityButterfly extends IAnimals {
|
||||
*/
|
||||
EntityCreature getEntity();
|
||||
|
||||
IIndividual getPollen();
|
||||
ITree getPollen();
|
||||
|
||||
void setPollen(IIndividual pollen);
|
||||
void setPollen(ITree pollen);
|
||||
}
|
||||
@@ -34,10 +34,10 @@ import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicActive;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicActiveEntity;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -492,7 +492,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
private static class PollenHandler {
|
||||
private static final int MAX_POLLINATION_ATTEMPTS = 20;
|
||||
|
||||
private IIndividual pollen;
|
||||
private ITree pollen;
|
||||
private int attemptedPollinations = 0;
|
||||
|
||||
public void doPollination(IBee queen, IBeeHousing beeHousing, IBeeListener beeListener) {
|
||||
|
||||
@@ -42,6 +42,7 @@ import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
@@ -664,7 +665,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
/* FLOWERS */
|
||||
@Override
|
||||
public IIndividual retrievePollen(IBeeHousing housing) {
|
||||
public ITree retrievePollen(IBeeHousing housing) {
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
@@ -682,7 +683,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
Vect offset = new Vect(-area.getX() / 2, -area.getY() / 4, -area.getZ() / 2);
|
||||
Vect housingPos = new Vect(housing.getCoordinates());
|
||||
|
||||
IIndividual pollen = null;
|
||||
ITree pollen = null;
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vect randomPos = Vect.getRandomPositionInArea(random, area);
|
||||
@@ -707,7 +708,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pollinateRandom(IBeeHousing housing, IIndividual pollen) {
|
||||
public boolean pollinateRandom(IBeeHousing housing, ITree pollen) {
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
|
||||
public class CheckPollinatable implements ICheckPollinatable {
|
||||
@@ -31,12 +31,12 @@ public class CheckPollinatable implements ICheckPollinatable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getPollen() {
|
||||
public ITree getPollen() {
|
||||
return pollinatable.getPollen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMateWith(IIndividual pollen) {
|
||||
public boolean canMateWith(ITree pollen) {
|
||||
return pollinatable.canMateWith(pollen);
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -15,7 +15,6 @@ import java.util.EnumSet;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public class CheckPollinatableTree implements ICheckPollinatable {
|
||||
|
||||
@@ -31,12 +30,12 @@ public class CheckPollinatableTree implements ICheckPollinatable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getPollen() {
|
||||
public ITree getPollen() {
|
||||
return tree;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMateWith(IIndividual pollen) {
|
||||
public boolean canMateWith(ITree pollen) {
|
||||
if (tree.getMate() != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
|
||||
public class FakePollinatable implements IPollinatable {
|
||||
@@ -21,17 +21,17 @@ public class FakePollinatable implements IPollinatable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getPollen() {
|
||||
public ITree getPollen() {
|
||||
return checkPollinatable.getPollen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMateWith(IIndividual pollen) {
|
||||
public boolean canMateWith(ITree pollen) {
|
||||
return checkPollinatable.canMateWith(pollen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mateWith(IIndividual pollen) {
|
||||
public void mateWith(ITree pollen) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
|
||||
/** Just like IPollinatable but for checking only, it can't be mated */
|
||||
public interface ICheckPollinatable {
|
||||
@@ -27,7 +27,7 @@ public interface ICheckPollinatable {
|
||||
/**
|
||||
* @return IIndividual containing the genetic information of this IPollinatable
|
||||
*/
|
||||
IIndividual getPollen();
|
||||
ITree getPollen();
|
||||
|
||||
/**
|
||||
* Checks whether this can mate with the given pollen.
|
||||
@@ -37,7 +37,7 @@ public interface ICheckPollinatable {
|
||||
* @param pollen IIndividual representing the pollen.
|
||||
* @return true if mating is possible, false otherwise.
|
||||
*/
|
||||
boolean canMateWith(IIndividual pollen);
|
||||
boolean canMateWith(ITree pollen);
|
||||
|
||||
boolean isPollinated();
|
||||
}
|
||||
@@ -325,32 +325,29 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMateWith(IIndividual individual) {
|
||||
public boolean canMateWith(ITree individual) {
|
||||
if (getTree() == null || isDecorative) {
|
||||
return false;
|
||||
}
|
||||
if (getTree().getMate() != null) {
|
||||
return false;
|
||||
}
|
||||
if (!(individual instanceof ITree)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !getTree().isGeneticEqual(individual);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mateWith(IIndividual individual) {
|
||||
public void mateWith(ITree individual) {
|
||||
if (getTree() == null || isDecorative) {
|
||||
return;
|
||||
}
|
||||
|
||||
getTree().mate((ITree) individual);
|
||||
getTree().mate(individual);
|
||||
worldObj.markBlockForUpdate(getPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getPollen() {
|
||||
public ITree getPollen() {
|
||||
if (isDecorative) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.IToolScoop;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
@@ -75,7 +76,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
|
||||
private Vec3 flightTarget;
|
||||
private int exhaustion;
|
||||
private IButterfly contained;
|
||||
private IIndividual pollen;
|
||||
private ITree pollen;
|
||||
|
||||
public int cooldownPollination = 0;
|
||||
public int cooldownEgg = 0;
|
||||
@@ -253,12 +254,12 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
|
||||
|
||||
/* POLLEN */
|
||||
@Override
|
||||
public IIndividual getPollen() {
|
||||
public ITree getPollen() {
|
||||
return pollen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPollen(IIndividual pollen) {
|
||||
public void setPollen(ITree pollen) {
|
||||
this.pollen = pollen;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user