Prevent damaged itemstacks from being learnable, and add a tooltip in the Research Station GUI to tell if you already know how to transmute an itemstack

This commit is contained in:
pahimar 2015-05-07 16:18:12 -04:00
parent a46b8db610
commit 15180e406b
2 changed files with 19 additions and 1 deletions

View File

@ -2,8 +2,10 @@ package com.pahimar.ee3.client.handler;
import com.pahimar.ee3.api.exchange.EnergyValue;
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
import com.pahimar.ee3.api.knowledge.TransmutationKnowledgeRegistryProxy;
import com.pahimar.ee3.exchange.WrappedStack;
import com.pahimar.ee3.inventory.ContainerAlchemicalTome;
import com.pahimar.ee3.inventory.ContainerResearchStation;
import com.pahimar.ee3.inventory.ContainerTransmutationTablet;
import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.util.IOwnable;
@ -70,6 +72,14 @@ public class ItemTooltipEventHandler
}
}
if (((Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) && (event.entityPlayer != null && event.entityPlayer.openContainer instanceof ContainerResearchStation)))
{
if (TransmutationKnowledgeRegistryProxy.doesPlayerKnow(event.entityPlayer, event.itemStack))
{
event.toolTip.add("You know how to transmute this"); // TODO Localize with better phrasing
}
}
if (event.itemStack.getItem() instanceof IOwnable)
{
UUID playerUUID = ItemHelper.getOwnerUUID(event.itemStack);

View File

@ -93,7 +93,15 @@ public class AbilityRegistry implements JsonSerializer<AbilityRegistry>, JsonDes
if (WrappedStack.canBeWrapped(object))
{
WrappedStack wrappedObject = WrappedStack.wrap(object);
return !notLearnableSet.contains(wrappedObject) && EnergyValueRegistry.getInstance().hasEnergyValue(wrappedObject);
if (object instanceof ItemStack && ((ItemStack) object).isItemDamaged())
{
return false;
}
else
{
return !notLearnableSet.contains(wrappedObject) && EnergyValueRegistry.getInstance().hasEnergyValue(wrappedObject);
}
}
return false;