API
In this section I will explain you how to use my API.
It pretty simple, let us start with an Ability.
1. Make a Ability class:
package net.yourmod.Abilities;
import net.minecraft.entity.Entity;
import com.advGenetics.API.Ability;
public class AbilityYour extends Ability {
@Override
public String getUnlocalizedName() {
return "yourability"; // The unlocalized name is a unqie lowercase string. Something like an UUID.
}
@Override
public String getName() {
return "Your Ability"; // The name represents the string which is shown in the game
}
@Override
public int getRarity() {
return 8; // The rarity marks how rare a item is. When it's high your chance to get the ability is very low.
}
@Override
public int getBreedingState() {
return 8; // This number should be an even number. It is the amount of Genes which are needed for one 'Completed Gene'.
}
@Override
public boolean isAllowed() {
return true; // Here you can disable your gene. I use this in combination with my config files.
}
}
2. There are several events which are triggered by Advanced Genetics. You can also use them, you only
implement the classes.
com.advGenetics.API.IAddRemove // The methods are triggered when a gene was add or removed to/from a DNA.
com.advGenetics.API.IEntityInteract // The method is triggered when an entity interacts with something
com.advGenetics.API.IInteractPlayer // The method is triggered when a player interacts with something
com.advGenetics.API.IKeyAction // Here you can add a keyeventlistener to your ability that is controlled by AdvGen
com.advGenetics.API.ILivingAttack // The method is triggered when an entity attacks something
com.advGenetics.API.ILivingDeath // The method is triggered when an entity dies
com.advGenetics.API.ILivingHurt // The method is triggered when an entity get damage
com.advGenetics.API.ILivingJoin // The method is triggered when an entity spawn in the world
com.advGenetics.API.IPlayerTick // The method is triggered every tick for every player (serverside!)
3. Know you have to register your Ability
RegistrationHelper.registerAbility(new AbilityYour(), Entity.class); // Entity represents the entity which should have the gene
4. If you have mutiple entities which sould have the same genes then you can add Abilities to entities.
RegistrationHelper.addEntityToAbility(unlocalizedNameOfAbility, Entity.class); // Entity represents the entity which should have the gene
5. You can also add entities to a blacklist to prevent them from dropping skin scales.
RegistrationHelper.addEntityToBlacklist(Entity.class);
6. When you want to add a new machine which should receive energy from the 'Combustion Generator' your
tileentity should implements
com.advGenetics.API.Power.IPowerReceiver