本文整理汇总了Java中baubles.common.lib.PlayerHandler类的典型用法代码示例。如果您正苦于以下问题:Java PlayerHandler类的具体用法?Java PlayerHandler怎么用?Java PlayerHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerHandler类属于baubles.common.lib包,在下文中一共展示了PlayerHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
}
开发者ID:GTNewHorizons,项目名称:NewHorizonsCoreMod,代码行数:27,代码来源:WitherProtectionRing.java
示例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;
}
开发者ID:Romejanic,项目名称:RuneMagic,代码行数:18,代码来源:SoulPendant.java
示例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);
}
}
}
}
开发者ID:Romejanic,项目名称:RuneMagic,代码行数:18,代码来源:EventHandlerEntity.java
示例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);
}
}
开发者ID:Romejanic,项目名称:RuneMagic,代码行数:25,代码来源:ContainerPlayerExpanded.java
示例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;
}
开发者ID:Arouka,项目名称:Clothier,代码行数:20,代码来源:ItemBauble.java
示例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;
}
开发者ID:OmgImAlexis,项目名称:TheStuffMod,代码行数:19,代码来源:ItemRing.java
示例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);
}
开发者ID:M4thG33k,项目名称:TombManyGraves-NOT-FOR-1.9.4-,代码行数:14,代码来源:DeathInventory.java
示例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;
}
开发者ID:M4thG33k,项目名称:TombManyGraves-NOT-FOR-1.9.4-,代码行数:31,代码来源:DeathInventory.java
示例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();
}
开发者ID:M4thG33k,项目名称:TombManyGraves-NOT-FOR-1.9.4-,代码行数:12,代码来源:TileDeathBlock.java
示例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;
}
开发者ID:M4thG33k,项目名称:TombManyGraves-NOT-FOR-1.9.4-,代码行数:12,代码来源:TileDeathBlock.java
示例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);
}
}
开发者ID:gigabit101,项目名称:BaublesHud,代码行数:14,代码来源:HudBaubles.java
示例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;
}
开发者ID:TeamC4,项目名称:Talismans2,代码行数:40,代码来源:ItemTalismanBauble.java
示例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;
}
开发者ID:gigabit101,项目名称:Talismans,代码行数:36,代码来源:ItemTalisman.java
示例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;
}
开发者ID:mookie1097,项目名称:NightfallMod,代码行数:8,代码来源:CreativeAmulet.java
示例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);
}
}
开发者ID:Romejanic,项目名称:RuneMagic,代码行数:11,代码来源:EventHandlerNetwork.java
示例16: playerUpdateEvent
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@SubscribeEvent
public void playerUpdateEvent (PlayerEvent event) {
Side side = FMLCommonHandler.instance().getEffectiveSide();
if (side == Side.SERVER) {
PlayerHandler.savePlayerBaubles(event.player);
}
}
开发者ID:Romejanic,项目名称:RuneMagic,代码行数:8,代码来源:EventHandlerNetwork.java
示例17: handleClientSide
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@Override
public void handleClientSide(EntityPlayer player) {
World world = player.worldObj;
if (world==null) return;
Entity p = world.getEntityByID(playerId);
if (p !=null && p instanceof EntityPlayer) {
PlayerHandler.getPlayerBaubles((EntityPlayer) p).stackList[slot]=bauble;
}
}
开发者ID:Romejanic,项目名称:RuneMagic,代码行数:10,代码来源:PacketSyncBauble.java
示例18: playerDeath
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
@SubscribeEvent
public void playerDeath(PlayerDropsEvent event) {
if (event.entity instanceof EntityPlayer && !event.entity.worldObj.isRemote && !event.entity.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) {
PlayerHandler.getPlayerBaubles(event.entityPlayer).dropItems(event.drops);
}
}
开发者ID:Romejanic,项目名称:RuneMagic,代码行数:8,代码来源:EventHandlerEntity.java
示例19: markDirty
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
/**
* For tile entities, ensures the chunk containing the tile entity is saved
* to disk later - the game won't think it hasn't changed and skip it.
*/
@Override
public void markDirty() {
try {
PlayerHandler.savePlayerBaubles(player.get());
} catch (Exception e) { }
}
开发者ID:Romejanic,项目名称:RuneMagic,代码行数:12,代码来源:InventoryBaubles.java
示例20: setBaubleInventory
import baubles.common.lib.PlayerHandler; //导入依赖的package包/类
public void setBaubleInventory(EntityPlayer player)
{
PlayerHandler.getPlayerBaubles(player).saveNBT(baublesNBT);
PlayerHandler.clearPlayerBaubles(player);
}
开发者ID:M4thG33k,项目名称:TombManyGraves-NOT-FOR-1.9.4-,代码行数:6,代码来源:TileDeathBlock.java
注:本文中的baubles.common.lib.PlayerHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论