mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-26 23:03:18 +00:00
Improve IPollinatable
This commit is contained in:
1 parent
a05bc13852
commit
f58938ff32
4 files changed
+35
-29
No files matched your search
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
/**
|
||||
@@ -28,7 +27,7 @@ public interface ICheckPollinatable {
|
||||
/**
|
||||
* @return IIndividual containing the genetic information of this IPollinatable
|
||||
*/
|
||||
ITree getPollen();
|
||||
IIndividual getPollen();
|
||||
|
||||
/**
|
||||
* Checks whether this can mate with the given pollen.
|
||||
@@ -38,7 +37,7 @@ public interface ICheckPollinatable {
|
||||
* @param pollen IIndividual representing the pollen.
|
||||
* @return true if mating is possible, false otherwise.
|
||||
*/
|
||||
boolean canMateWith(ITree pollen);
|
||||
boolean canMateWith(IIndividual pollen);
|
||||
|
||||
/**
|
||||
* @return true if this has already been pollinated.
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
|
||||
/**
|
||||
* Can be implemented by tile entities, if they wish to be pollinatable.
|
||||
*
|
||||
@@ -20,5 +18,5 @@ public interface IPollinatable extends ICheckPollinatable {
|
||||
* @param pollen
|
||||
* IIndividual representing the pollen.
|
||||
*/
|
||||
void mateWith(ITree pollen);
|
||||
void mateWith(IIndividual pollen);
|
||||
}
|
||||
+9
-5
@@ -12,6 +12,7 @@ package forestry.arboriculture.genetics.pollination;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.genetics.ICheckPollinatable;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class CheckPollinatableTree implements ICheckPollinatable {
|
||||
@@ -33,12 +34,15 @@ public class CheckPollinatableTree implements ICheckPollinatable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMateWith(ITree pollen) {
|
||||
if (tree.getMate() != null) {
|
||||
return false;
|
||||
public boolean canMateWith(IIndividual pollen) {
|
||||
if(pollen instanceof ITree){
|
||||
if (tree.getMate() != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !tree.isGeneticEqual(pollen);
|
||||
}
|
||||
|
||||
return !tree.isGeneticEqual(pollen);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -269,28 +269,33 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMateWith(ITree individual) {
|
||||
ITree tree = getTree();
|
||||
if (tree == null) {
|
||||
return false;
|
||||
public boolean canMateWith(IIndividual individual) {
|
||||
if(individual instanceof ITree){
|
||||
ITree tree = getTree();
|
||||
if (tree == null) {
|
||||
return false;
|
||||
}
|
||||
if (tree.getMate() != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !tree.isGeneticEqual(individual);
|
||||
}
|
||||
if (tree.getMate() != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !tree.isGeneticEqual(individual);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mateWith(ITree individual) {
|
||||
ITree tree = getTree();
|
||||
if (tree == null || worldObj == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
tree.mate(individual);
|
||||
if (!worldObj.isRemote) {
|
||||
sendNetworkUpdate();
|
||||
public void mateWith(IIndividual individual) {
|
||||
if(individual instanceof ITree){
|
||||
ITree tree = getTree();
|
||||
if (tree == null || worldObj == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
tree.mate((ITree) individual);
|
||||
if (!worldObj.isRemote) {
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user