當前位置: 首頁>>代碼示例>>Java>>正文


Java PlayerEvent.LoadFromFile方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.entity.player.PlayerEvent.LoadFromFile方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerEvent.LoadFromFile方法的具體用法?Java PlayerEvent.LoadFromFile怎麽用?Java PlayerEvent.LoadFromFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.entity.player.PlayerEvent的用法示例。


在下文中一共展示了PlayerEvent.LoadFromFile方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPlayerLoadFromFileEvent

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerLoadFromFileEvent(PlayerEvent.LoadFromFile event) {
	if (!EtFuturum.enableEnchants)
		return;
	try {
		File file = event.getPlayerFile(Reference.MOD_ID);
		if (!file.exists()) {
			file.createNewFile();
			return;
		}

		BufferedReader br = new BufferedReader(new FileReader(file));
		String line = br.readLine();
		if (line != null) {
			int seed = Integer.parseInt(line);
			ContainerEnchantment.seeds.put(event.playerUUID, seed);
			br.close();
		}
	} catch (Exception e) {
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:22,代碼來源:ServerEventHandler.java

示例2: onLoad

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onLoad(PlayerEvent.LoadFromFile event) {
	if (event.getEntityPlayer().getEntityWorld().isRemote) {
		return;
	}

	PlayerCivilizationCapability cap = PlayerCivilizationCapabilityImpl.get(event.getEntityPlayer());
	if (cap == null) {
		return;
	}

	NBTTagCompound c = event.getEntityPlayer().getEntityData().getCompoundTag(ToroQuest.MODID + ".playerCivilization");

	if (c == null) {
		// System.out.println("******************Missing civ data on load");
	} else {
		System.out.println("LOAD: " + c.toString());
	}

	cap.readNBT(c);
}
 
開發者ID:ToroCraft,項目名稱:ToroQuest,代碼行數:22,代碼來源:CivilizationHandlers.java

示例3: playerSetupOnLoad

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
public static void playerSetupOnLoad(PlayerEvent.LoadFromFile event) {
  EntityPlayer player = event.getEntityPlayer();
  clearPlayerInventory(player);
  File playerFile = getPlayerFile(ext, event.getPlayerDirectory(), event.getEntityPlayer().getDisplayNameString());
  if (!playerFile.exists()) {
    File fileNew = event.getPlayerFile(ext);
    if (fileNew.exists()) {
      try {
        Files.copy(fileNew, playerFile);
        fileNew.delete();
        File fb = event.getPlayerFile(extback);
        if (fb.exists())
          fb.delete();
      }
      catch (IOException e) {}
    }
  }
  loadPlayerInventory(event.getEntityPlayer(), playerFile, getPlayerFile(extback, event.getPlayerDirectory(), event.getEntityPlayer().getDisplayNameString()));
  playerEntityIds.add(event.getEntityPlayer().getEntityId());
}
 
開發者ID:PrinceOfAmber,項目名稱:Cyclic,代碼行數:21,代碼來源:UtilPlayerInventoryFilestorage.java

示例4: playerSetupOnLoad

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
public static void playerSetupOnLoad(PlayerEvent.LoadFromFile event) {
  EntityPlayer player = event.getEntityPlayer();
  clearPlayerInventory(player);
  File playerFile = getPlayerFile(EXT, event.getPlayerDirectory(), event.getEntityPlayer());
  if (!playerFile.exists()) {
    File fileNew = event.getPlayerFile(EXT);
    if (fileNew.exists()) {
      try {
        Files.copy(fileNew, playerFile);
        ModInv.logger.info("Using and converting UUID savefile for " + player.getDisplayNameString());
        fileNew.delete();
        File fb = event.getPlayerFile(EXTBK);
        if (fb.exists())
          fb.delete();
      }
      catch (IOException e) {
      }
    }
  }
  loadPlayerInventory(event.getEntityPlayer(), playerFile, getPlayerFile(EXTBK, event.getPlayerDirectory(), event.getEntityPlayer()));
  playerEntityIds.add(event.getEntityPlayer().getEntityId());
}
 
開發者ID:LothrazarMinecraftMods,項目名稱:OverpoweredInventory,代碼行數:23,代碼來源:UtilPlayerInventoryFilestorage.java

示例5: onPlayerLoad

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerLoad(PlayerEvent.LoadFromFile event) {
    File file = new File(event.playerDirectory, event.entityPlayer.getCommandSenderName() + "." + FILE_SUFFIX);
    NBTTagCompound nbtTagCompound = new NBTTagCompound();

    InventoryAlchemicalBag[] array = new InventoryAlchemicalBag[16];

    if (file.exists()) {
        try {
            FileInputStream fileInputStream = new FileInputStream(file);
            nbtTagCompound = CompressedStreamTools.readCompressed(fileInputStream);
        } catch (IOException ignored) {
        }
    }

    for (int i = 0; i < 16; i++) {
        NBTTagCompound dataTag = nbtTagCompound.getCompoundTag(ItemAlchemicalBag.COLORS[i]);
        InventoryAlchemicalBag inventoryAlchemicalBag = new InventoryAlchemicalBag(i);
        inventoryAlchemicalBag.readFromNBT(dataTag);
        array[i] = inventoryAlchemicalBag;
    }

    inventoryMap.put(event.entity.getCommandSenderName(), array);
}
 
開發者ID:AgileMods,項目名稱:MateriaMuto,代碼行數:25,代碼來源:AlchemicalBagHandler.java

示例6: onLoad

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onLoad(PlayerEvent.LoadFromFile event) {
	IDailiesCapability dailies = getCapability(event.getEntityPlayer());
	if (dailies == null) {
		return;
	}
	dailies.readNBT((NBTTagCompound) event.getEntityPlayer().getEntityData().getTag(CapabilityDailiesHandler.NAME));
}
 
開發者ID:ToroCraft,項目名稱:Dailies,代碼行數:9,代碼來源:Events.java

示例7: onPlayerLoadFromFileEvent

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerLoadFromFileEvent(PlayerEvent.LoadFromFile event)
{
	LogHelper.info("Loading player from file");
	if (!event.entityPlayer.worldObj.isRemote)
	{
		// Get dir to read/write data
		if (PlayerAbilityHandler.playerDataDirectory == null || !PlayerAbilityHandler.playerDataDirectory.getAbsolutePath().equalsIgnoreCase(event.playerDirectory.getAbsolutePath()))
		{
			PlayerAbilityHandler.playerDataDirectory = new File(event.playerDirectory, Reference.MODID);
			
			if (!PlayerAbilityHandler.playerDataDirectory.exists())
			{
				PlayerAbilityHandler.playerDataDirectory.mkdir();
			}
		}
		
		File playerDataFile = new File(PlayerAbilityHandler.playerDataDirectory, event.entityPlayer.getUniqueID() + PlayerAbilityHandler.ABILITY_EXTENSION);
		if (!playerDataFile.exists())
		{
			try
			{
				PrintWriter out = new PrintWriter(new BufferedWriter( new FileWriter( new File(PlayerAbilityHandler.playerDataDirectory, "playerLegend.txt"), true)));
				
				out.println(String.format("Player Name = %s", event.entityPlayer.getCommandSenderName()));
				out.println(String.format("Ability File = %s", event.entityPlayer.getUniqueID() + PlayerAbilityHandler.ABILITY_EXTENSION));
				out.println();
				out.close();
			}
			catch (IOException e)
			{
				LogHelper.warn("Failed to add player");
			}
			PlayerAbilityHandler.writeAbilityData(event.entityPlayer);
		}
	}
}
 
開發者ID:FoolishDave,項目名稱:Darklight,代碼行數:38,代碼來源:PlayerEventHandler.java

示例8: playerLoad

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void playerLoad(PlayerEvent.LoadFromFile event) {
  UtilPlayerInventoryFilestorage.playerSetupOnLoad(event);
}
 
開發者ID:PrinceOfAmber,項目名稱:Cyclic,代碼行數:5,代碼來源:EventExtendedInventory.java

示例9: onPlayerDataLoad

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerDataLoad(PlayerEvent.LoadFromFile event) {
    PlayerHandler.loadPlayerArmor(event.entityPlayer, event.getPlayerFile("armor"), event.getPlayerFile("armor.bak"));
}
 
開發者ID:dmillerw,項目名稱:CosmeticArmor,代碼行數:5,代碼來源:PlayerEventHandler.java

示例10: onPlayerLoad

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SideOnly(Side.SERVER)
@SubscribeEvent
public void onPlayerLoad(PlayerEvent.LoadFromFile event)
{
	CommonEventHandler.checkInventory(event.entityPlayer, event.entity.worldObj.provider.dimensionId, Integer.MIN_VALUE);
}
 
開發者ID:hilburn,項目名稱:DimensionGuard,代碼行數:7,代碼來源:EventHandler.java


注:本文中的net.minecraftforge.event.entity.player.PlayerEvent.LoadFromFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。