本文整理汇总了Java中baubles.common.lib.PlayerHandler类的典型用法代码示例。如果您正苦于以下问题:Java PlayerHandler类的具体用法?Java PlayerHandler怎么用?Java PlayerHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerHandler类属于baubles.common.lib包,在下文中一共展示了PlayerHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onWornTick
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@Override
public void onWornTick(ItemStack arg0, EntityLivingBase pEntity) {
if (!(pEntity instanceof EntityPlayer)) {
return;
}
if (_mRnd.nextInt(20) == 0)
{
EntityPlayer tPlayer = (EntityPlayer)pEntity;
InventoryBaubles tBaubles = PlayerHandler.getPlayerBaubles(tPlayer);
//PotionEffect tEff = getNBTPotionEffect(arg0);
//int tStoredVictus = GetNBTVictusVis(arg0);
/*if (tEff == null || tStoredVictus < 1)
{
return;
}
*/
Potion tPot = Potion.wither;
if (tPlayer.isPotionActive(tPot))
{
tPlayer.removePotionEffect(tPot.id);
//DamageItem(arg0);
}
}
}
示例2: onItemRightClick
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if(!par2World.isRemote) {
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer);
for(int i = 0; i < baubles.getSizeInventory(); i++)
if(baubles.getStackInSlot(i) == null && baubles.isItemValidForSlot(i, par1ItemStack)) {
baubles.setInventorySlotContents(i, par1ItemStack.copy());
if(!par3EntityPlayer.capabilities.isCreativeMode){
par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null);
}
onEquipped(par1ItemStack, par3EntityPlayer);
break;
}
}
return par1ItemStack;
}
示例3: playerTick
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@SubscribeEvent
public void playerTick(PlayerEvent.LivingUpdateEvent event) {
//player events
if (event.entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)event.entity;
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
for (int a=0;a<baubles.getSizeInventory();a++) {
if (baubles.getStackInSlot(a)!=null && baubles.getStackInSlot(a).getItem() instanceof IBauble) {
((IBauble)baubles.getStackInSlot(a).getItem()).onWornTick(baubles.getStackInSlot(a), player);
}
}
}
}
示例4: onContainerClosed
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
/**
* Called when the container is closed.
*/
@Override
public void onContainerClosed(EntityPlayer player)
{
super.onContainerClosed(player);
for (int i = 0; i < 4; ++i)
{
ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);
if (itemstack != null)
{
player.dropPlayerItemWithRandomChoice(itemstack, false);
}
}
this.craftResult.setInventorySlotContents(0, (ItemStack)null);
if (!player.worldObj.isRemote) {
PlayerHandler.setPlayerBaubles(player, baubles);
PlayerHandler.savePlayerBaubles(player);
}
}
示例5: onItemRightClick
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par2World.isRemote)
{
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer);
for (int i = 0; i < baubles.getSizeInventory(); i++)
if (baubles.getStackInSlot(i) == null && baubles.isItemValidForSlot(i, par1ItemStack))
{
baubles.setInventorySlotContents(i, par1ItemStack.copy());
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null);
}
onEquipped(par1ItemStack, par3EntityPlayer);
break;
}
}
return par1ItemStack;
}
示例6: onItemRightClick
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@Method(modid="Baubles")
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if(!par2World.isRemote) {
baubles.common.container.InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer);
for(int i = 0; i < baubles.getSizeInventory(); i++)
if(baubles.getStackInSlot(i) == null && baubles.isItemValidForSlot(i, par1ItemStack)) {
baubles.setInventorySlotContents(i, par1ItemStack.copy());
if(!par3EntityPlayer.capabilities.isCreativeMode){
par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null);
}
onEquipped(par1ItemStack, par3EntityPlayer);
break;
}
}
return par1ItemStack;
}
示例7: DeathInventory
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
public DeathInventory(EntityPlayer player) {
allNBT = new NBTTagCompound();
NBTTagList tagList = new NBTTagList();
player.inventory.writeToNBT(tagList);
allNBT.setTag("Main",tagList);
NBTTagCompound baublesNBT = new NBTTagCompound();
if (TombManyGraves.isBaublesInstalled) {
PlayerHandler.getPlayerBaubles(player).saveNBT(baublesNBT);
}
allNBT.setTag("Baubles",baublesNBT);
}
示例8: restoreAll
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
public boolean restoreAll(EntityPlayer player, String timestamp)
{
boolean didWork = true;
String filename = TombManyGraves.file + DeathInventoryHandler.FILE_PREFIX + "/" + player.getName() + "#" + timestamp + ".json";
BufferedReader reader;
try
{
reader = new BufferedReader(new FileReader(filename));
String fileData = reader.readLine();
allNBT = JsonToNBT.getTagFromJson(fileData);
player.inventory.readFromNBT(allNBT.getTagList("Main",10));
if (TombManyGraves.isBaublesInstalled)
{
InventoryBaubles inventoryBaubles = new InventoryBaubles(player);
inventoryBaubles.readNBT(allNBT.getCompoundTag("Baubles"));
PlayerHandler.setPlayerBaubles(player,inventoryBaubles);
}
}
catch (Exception e)
{
// e.printStackTrace();
didWork = false;
}
return didWork;
}
示例9: replaceBaublesInventory
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
public void replaceBaublesInventory(EntityPlayer player)
{
IInventory currentBaubles = PlayerHandler.getPlayerBaubles(player);
InventoryBaubles savedBaubles = new InventoryBaubles(player);
savedBaubles.readNBT(baublesNBT);
replaceSpecificInventory(player,currentBaubles,savedBaubles);
baublesNBT = new NBTTagCompound();
}
示例10: isInventoryEmpty
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
public static boolean isInventoryEmpty(EntityPlayer player)
{
boolean toReturn = isSpecificInventoryEmpty(player.inventory);
if (TombManyGraves.isBaublesInstalled)
{
toReturn = toReturn && isSpecificInventoryEmpty(PlayerHandler.getPlayerBaubles(player));
}
return toReturn;
}
示例11: drawBaublesHudIcons
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
public void drawBaublesHudIcons(ScaledResolution res)
{
EntityPlayer player = mc.thePlayer;
InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player);
// Renders the ItemStacks from the players baubles inventory in the
// correct
// X, Y Cordinates
for (int i = 0; i < 4; i++)
{
renderItemStack(inv.getStackInSlot(i), LocX + i * LocOffsetX, LocY + i * LocOffsetY);
}
}
示例12: onItemRightClick
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@Override
// Equips Talismans When Right Clicked In Players Hand
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
EntityPlayer par3EntityPlayer)
{
InventoryBaubles baubles = PlayerHandler
.getPlayerBaubles(par3EntityPlayer);
for (int i = 0; i < baubles.getSizeInventory(); i++) {
if (baubles.isItemValidForSlot(i, par1ItemStack)) {
ItemStack stackInSlot = baubles.getStackInSlot(i);
if (stackInSlot == null
|| ((IBauble) stackInSlot.getItem()).canUnequip(
stackInSlot, par3EntityPlayer)) {
if (!par2World.isRemote) {
baubles.setInventorySlotContents(i,
par1ItemStack.copy());
if (!par3EntityPlayer.capabilities.isCreativeMode)
par3EntityPlayer.inventory
.setInventorySlotContents(
par3EntityPlayer.inventory.currentItem,
null);
}
onEquipped(par1ItemStack, par3EntityPlayer);
if (stackInSlot != null) {
((IBauble) stackInSlot.getItem()).onUnequipped(
stackInSlot, par3EntityPlayer);
return stackInSlot.copy();
}
break;
}
}
}
return par1ItemStack;
}
示例13: onItemRightClick
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
EntityPlayer par3EntityPlayer) {
InventoryBaubles baubles = PlayerHandler
.getPlayerBaubles(par3EntityPlayer);
for (int i = 0; i < baubles.getSizeInventory(); i++) {
if (baubles.isItemValidForSlot(i, par1ItemStack)) {
ItemStack stackInSlot = baubles.getStackInSlot(i);
if (stackInSlot == null
|| ((IBauble) stackInSlot.getItem()).canUnequip(
stackInSlot, par3EntityPlayer)) {
if (!par2World.isRemote) {
baubles.setInventorySlotContents(i,
par1ItemStack.copy());
if (!par3EntityPlayer.capabilities.isCreativeMode)
par3EntityPlayer.inventory
.setInventorySlotContents(
par3EntityPlayer.inventory.currentItem,
null);
}
onEquipped(par1ItemStack, par3EntityPlayer);
if (stackInSlot != null) {
((IBauble) stackInSlot.getItem()).onUnequipped(
stackInSlot, par3EntityPlayer);
return stackInSlot.copy();
}
break;
}
}
}
return par1ItemStack;
}
示例14: onUnequipped
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@Override
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {
((EntityPlayer)player).setGameType(GameType.SURVIVAL);
for(ItemStack bau: PlayerHandler.getPlayerBaubles((EntityPlayer) player).stackList)
if(bau != null && bau.getItem() == NFMain.flyBelt)
((EntityPlayer)player).capabilities.isFlying = true;
}
示例15: playerLoggedInEvent
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@SubscribeEvent
public void playerLoggedInEvent (PlayerEvent.PlayerLoggedInEvent event) {
Side side = FMLCommonHandler.instance().getEffectiveSide();
if (side == Side.SERVER) {
PlayerHandler.clearPlayerBaubles(event.player);
PlayerHandler.loadPlayerBaubles(event.player);
for (int a=0;a<4;a++)
PlayerHandler.getPlayerBaubles(event.player).syncSlotToClients(a);
}
}