Fix #791 *alyzer slot behavior changed. (can't swap specimens)

This commit is contained in:
mezz committed 2015-09-29 22:33:27 -07:00
1 parent 5052df8844
commit 1d0efd537e
5 files changed
+90 -125

No files matched your search

@@ -12,13 +12,12 @@ package forestry.apiculture.items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBee;
import forestry.api.core.ForestryAPI;
import forestry.api.core.Tabs;
import forestry.api.genetics.ISpeciesRoot;
import forestry.core.config.Config;
import forestry.core.gui.IHintSource;
import forestry.core.items.ItemAlyzer;
@@ -48,48 +47,11 @@ public class ItemBeealyzer extends ItemAlyzer {
}
@Override
protected boolean isSpecimen(ItemStack itemStack) {
return BeeManager.beeRoot.isMember(itemStack);
protected ISpeciesRoot getSpeciesRoot() {
return BeeManager.beeRoot;
}
@Override
public void onSlotClick(EntityPlayer player) {
// Source slot to analyze empty
if (getStackInSlot(SLOT_SPECIMEN) == null) {
return;
}
IBee bee = BeeManager.beeRoot.getMember(getStackInSlot(SLOT_SPECIMEN));
// No bee, abort
if (bee == null) {
return;
}
// Analyze if necessary
if (!bee.isAnalyzed()) {
// Requires energy
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
return;
}
bee.analyze();
if (player != null) {
BeeManager.beeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(bee.getGenome().getPrimary());
BeeManager.beeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(bee.getGenome().getSecondary());
}
NBTTagCompound nbttagcompound = new NBTTagCompound();
bee.writeToNBT(nbttagcompound);
getStackInSlot(SLOT_SPECIMEN).setTagCompound(nbttagcompound);
// Decrease energy
decrStackSize(SLOT_ENERGY, 1);
}
setInventorySlotContents(SLOT_ANALYZE_1, getStackInSlot(SLOT_SPECIMEN));
setInventorySlotContents(SLOT_SPECIMEN, null);
}
// / IHINTSOURCE
@Override