Files
ForestryMC/src/main/java/forestry/apiculture/genetics/ApiaristTracker.java
T
Parker 8f2d802f11 Reformed Forestry!
* Updated for BC 6.0.x compatibility
* Re-implemented the Pipes plugin
* Converted to vanilla assets lang system
* Converted to standard gradle file structure
* General warnings cleanup
2014-08-11 16:56:09 -04:00

116 lines
2.9 KiB
Java
Executable File

/*******************************************************************************
* 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.apiculture.genetics;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import com.mojang.authlib.GameProfile;
import forestry.api.apiculture.IApiaristTracker;
import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IIndividual;
import forestry.core.genetics.BreedingTracker;
import forestry.plugins.PluginApiculture;
public class ApiaristTracker extends BreedingTracker implements IApiaristTracker {
public ApiaristTracker(String s) {
this(s, null);
}
public ApiaristTracker(String s, GameProfile player) {
super(s, player);
}
private int queensTotal = 0;
private int dronesTotal = 0;
private int princessesTotal = 0;
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
queensTotal = nbttagcompound.getInteger("QueensTotal");
princessesTotal = nbttagcompound.getInteger("PrincessesTotal");
dronesTotal = nbttagcompound.getInteger("DronesTotal");
super.readFromNBT(nbttagcompound);
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("QueensTotal", queensTotal);
nbttagcompound.setInteger("PrincessesTotal", princessesTotal);
nbttagcompound.setInteger("DronesTotal", dronesTotal);
super.writeToNBT(nbttagcompound);
}
@Override
public void registerPickup(IIndividual individual) {
if(!individual.getGenome().getPrimary().getRoot().getUID().equals(BeeHelper.UID))
return;
if(!individual.isPureBred(0))
return;
if(PluginApiculture.beeInterface.getCombinations(individual.getGenome().getPrimary()).size() > 0)
return;
registerSpecies(individual.getGenome().getPrimary());
}
@Override
public void registerQueen(IIndividual bee) {
queensTotal++;
}
@Override
public int getQueenCount() {
return queensTotal;
}
@Override
public void registerPrincess(IIndividual bee) {
princessesTotal++;
registerBirth(bee);
}
@Override
public int getPrincessCount() {
return princessesTotal;
}
@Override
public void registerDrone(IIndividual bee) {
dronesTotal++;
registerBirth(bee);
}
@Override
public int getDroneCount() {
return dronesTotal;
}
@Override
protected IBreedingTracker getCommonTracker(EntityPlayer player) {
return PluginApiculture.beeInterface.getBreedingTracker(player.worldObj, null);
}
@Override
protected String getPacketTag() {
return BeeHelper.UID;
}
}