Getting there with the new Player Knowledge system - just need to change how the Tome, Research Station, and Transmutation Tablet interact with the player knowledge

This commit is contained in:
Pahimar 2016-05-21 22:55:14 -04:00
parent 1487490bf5
commit 8d942d49d3
7 changed files with 20 additions and 22 deletions

View file

@ -2,7 +2,7 @@ package com.pahimar.ee3.client.handler;
import com.pahimar.ee3.api.exchange.EnergyValue; import com.pahimar.ee3.api.exchange.EnergyValue;
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy; import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
import com.pahimar.ee3.api.knowledge.TransmutationKnowledgeRegistryProxy; import com.pahimar.ee3.api.knowledge.PlayerKnowledgeRegistryProxy;
import com.pahimar.ee3.exchange.WrappedStack; import com.pahimar.ee3.exchange.WrappedStack;
import com.pahimar.ee3.inventory.ContainerAlchenomicon; import com.pahimar.ee3.inventory.ContainerAlchenomicon;
import com.pahimar.ee3.inventory.ContainerResearchStation; import com.pahimar.ee3.inventory.ContainerResearchStation;
@ -74,7 +74,7 @@ public class ItemTooltipEventHandler
if (((Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) && (event.entityPlayer != null && event.entityPlayer.openContainer instanceof ContainerResearchStation))) 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)) if (PlayerKnowledgeRegistryProxy.doesPlayerKnow(event.entityPlayer, event.itemStack))
{ {
event.toolTip.add("You know how to transmute this"); // TODO Localize with better phrasing event.toolTip.add("You know how to transmute this"); // TODO Localize with better phrasing
} }

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.command; package com.pahimar.ee3.command;
import com.pahimar.ee3.api.knowledge.TransmutationKnowledgeRegistryProxy; import com.pahimar.ee3.api.knowledge.PlayerKnowledgeRegistryProxy;
import com.pahimar.ee3.reference.Messages; import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -48,7 +48,7 @@ public class CommandPlayerForgetCurrentItem extends CommandBase
ItemStack itemStack = ((EntityPlayer) commandSender).getCurrentEquippedItem(); ItemStack itemStack = ((EntityPlayer) commandSender).getCurrentEquippedItem();
if (itemStack != null) if (itemStack != null)
{ {
TransmutationKnowledgeRegistryProxy.makePlayerForget(entityPlayer, itemStack); PlayerKnowledgeRegistryProxy.makePlayerForget(entityPlayer, itemStack);
func_152373_a(commandSender, this, Messages.Commands.PLAYER_FORGET_CURRENT_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), entityPlayer.getCommandSenderName(), itemStack.func_151000_E()}); func_152373_a(commandSender, this, Messages.Commands.PLAYER_FORGET_CURRENT_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), entityPlayer.getCommandSenderName(), itemStack.func_151000_E()});
} }
else else

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.command; package com.pahimar.ee3.command;
import com.pahimar.ee3.api.knowledge.TransmutationKnowledgeRegistryProxy; import com.pahimar.ee3.api.knowledge.PlayerKnowledgeRegistryProxy;
import com.pahimar.ee3.reference.Messages; import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -44,7 +44,7 @@ public class CommandPlayerForgetEverything extends CommandBase
if (entityPlayer != null) if (entityPlayer != null)
{ {
TransmutationKnowledgeRegistryProxy.makePlayerForgetEverything(entityPlayer); PlayerKnowledgeRegistryProxy.makePlayerForgetAll(entityPlayer);
func_152373_a(commandSender, this, Messages.Commands.PLAYER_FORGET_EVERYTHING_SUCCESS, new Object[]{commandSender.getCommandSenderName(), entityPlayer.getCommandSenderName()}); func_152373_a(commandSender, this, Messages.Commands.PLAYER_FORGET_EVERYTHING_SUCCESS, new Object[]{commandSender.getCommandSenderName(), entityPlayer.getCommandSenderName()});
} }
else else

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.command; package com.pahimar.ee3.command;
import com.pahimar.ee3.api.knowledge.TransmutationKnowledgeRegistryProxy; import com.pahimar.ee3.api.knowledge.PlayerKnowledgeRegistryProxy;
import com.pahimar.ee3.reference.Messages; import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -82,7 +82,7 @@ public class CommandPlayerForgetItem extends CommandBase
} }
} }
TransmutationKnowledgeRegistryProxy.makePlayerForget(entityPlayer, itemStack); PlayerKnowledgeRegistryProxy.makePlayerForget(entityPlayer, itemStack);
func_152373_a(commandSender, this, Messages.Commands.PLAYER_FORGET_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), entityPlayer.getCommandSenderName(), itemStack.func_151000_E()}); func_152373_a(commandSender, this, Messages.Commands.PLAYER_FORGET_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), entityPlayer.getCommandSenderName(), itemStack.func_151000_E()});
} }
else else

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.command; package com.pahimar.ee3.command;
import com.pahimar.ee3.api.knowledge.TransmutationKnowledgeRegistryProxy; import com.pahimar.ee3.api.knowledge.PlayerKnowledgeRegistryProxy;
import com.pahimar.ee3.knowledge.AbilityRegistry; import com.pahimar.ee3.knowledge.AbilityRegistry;
import com.pahimar.ee3.reference.Messages; import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
@ -52,7 +52,7 @@ public class CommandPlayerLearnCurrentItem extends CommandBase
{ {
if (AbilityRegistry.getInstance().isLearnable(itemStack)) if (AbilityRegistry.getInstance().isLearnable(itemStack))
{ {
TransmutationKnowledgeRegistryProxy.teachPlayer(entityPlayer, itemStack); PlayerKnowledgeRegistryProxy.teachPlayer(entityPlayer, itemStack);
func_152373_a(commandSender, this, Messages.Commands.PLAYER_LEARN_CURRENT_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), entityPlayer.getCommandSenderName(), itemStack.func_151000_E()}); func_152373_a(commandSender, this, Messages.Commands.PLAYER_LEARN_CURRENT_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), entityPlayer.getCommandSenderName(), itemStack.func_151000_E()});
} }
} }

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.command; package com.pahimar.ee3.command;
import com.pahimar.ee3.api.knowledge.TransmutationKnowledgeRegistryProxy; import com.pahimar.ee3.api.knowledge.PlayerKnowledgeRegistryProxy;
import com.pahimar.ee3.knowledge.AbilityRegistry; import com.pahimar.ee3.knowledge.AbilityRegistry;
import com.pahimar.ee3.reference.Messages; import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
@ -85,7 +85,7 @@ public class CommandPlayerLearnItem extends CommandBase
if (AbilityRegistry.getInstance().isLearnable(itemStack)) if (AbilityRegistry.getInstance().isLearnable(itemStack))
{ {
TransmutationKnowledgeRegistryProxy.teachPlayer(entityPlayer, itemStack); PlayerKnowledgeRegistryProxy.teachPlayer(entityPlayer, itemStack);
func_152373_a(commandSender, this, Messages.Commands.PLAYER_LEARN_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), entityPlayer.getCommandSenderName(), itemStack.func_151000_E()}); func_152373_a(commandSender, this, Messages.Commands.PLAYER_LEARN_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), entityPlayer.getCommandSenderName(), itemStack.func_151000_E()});
} }
} }

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.tileentity; package com.pahimar.ee3.tileentity;
import com.pahimar.ee3.api.knowledge.TransmutationKnowledgeRegistryProxy; import com.pahimar.ee3.api.knowledge.PlayerKnowledgeRegistryProxy;
import com.pahimar.ee3.knowledge.AbilityRegistry; import com.pahimar.ee3.knowledge.AbilityRegistry;
import com.pahimar.ee3.network.PacketHandler; import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageTileEntityResearchStation; import com.pahimar.ee3.network.message.MessageTileEntityResearchStation;
@ -15,8 +15,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import java.util.UUID;
public class TileEntityResearchStation extends TileEntityEE implements IInventory public class TileEntityResearchStation extends TileEntityEE implements IInventory
{ {
public static final int INVENTORY_SIZE = 2; public static final int INVENTORY_SIZE = 2;
@ -211,11 +209,11 @@ public class TileEntityResearchStation extends TileEntityEE implements IInventor
private boolean canLearnItemStack() private boolean canLearnItemStack()
{ {
ItemStack alchenomicon = inventory[ALCHENOMICON_SLOT_INVENTORY_INDEX]; ItemStack alchenomicon = inventory[ALCHENOMICON_SLOT_INVENTORY_INDEX];
UUID playerUUID = ItemHelper.getOwnerUUID(alchenomicon); String playerName = ItemHelper.getOwnerName(alchenomicon);
if (alchenomicon != null && playerUUID != null) if (alchenomicon != null && playerName != null)
{ {
return TransmutationKnowledgeRegistryProxy.canPlayerLearn(playerUUID, inventory[ITEM_SLOT_INVENTORY_INDEX]); return PlayerKnowledgeRegistryProxy.canPlayerLearn(playerName, inventory[ITEM_SLOT_INVENTORY_INDEX]);
} }
return false; return false;
@ -224,11 +222,11 @@ public class TileEntityResearchStation extends TileEntityEE implements IInventor
private boolean isItemStackKnown() private boolean isItemStackKnown()
{ {
ItemStack alchenomicon = inventory[ALCHENOMICON_SLOT_INVENTORY_INDEX]; ItemStack alchenomicon = inventory[ALCHENOMICON_SLOT_INVENTORY_INDEX];
UUID playerUUID = ItemHelper.getOwnerUUID(alchenomicon); String playerName = ItemHelper.getOwnerName(alchenomicon);
if (alchenomicon != null && playerUUID != null) if (alchenomicon != null && playerName != null)
{ {
return TransmutationKnowledgeRegistryProxy.doesPlayerKnow(playerUUID, inventory[ITEM_SLOT_INVENTORY_INDEX]); return PlayerKnowledgeRegistryProxy.doesPlayerKnow(playerName, inventory[ITEM_SLOT_INVENTORY_INDEX]);
} }
return false; return false;
@ -238,7 +236,7 @@ public class TileEntityResearchStation extends TileEntityEE implements IInventor
{ {
if (this.canLearnItemStack()) if (this.canLearnItemStack())
{ {
TransmutationKnowledgeRegistryProxy.teachPlayer(ItemHelper.getOwnerUUID(inventory[ALCHENOMICON_SLOT_INVENTORY_INDEX]), inventory[ITEM_SLOT_INVENTORY_INDEX]); PlayerKnowledgeRegistryProxy.teachPlayer(ItemHelper.getOwnerName(inventory[ALCHENOMICON_SLOT_INVENTORY_INDEX]), inventory[ITEM_SLOT_INVENTORY_INDEX]);
this.inventory[ITEM_SLOT_INVENTORY_INDEX].stackSize--; this.inventory[ITEM_SLOT_INVENTORY_INDEX].stackSize--;