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


Java PlayerEvent.SaveToFile方法代碼示例

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


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

示例1: onPlayerSaveFromFileEvent

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

		Integer seed = ContainerEnchantment.seeds.get(event.playerUUID);
		if (seed != null) {
			BufferedWriter bw = new BufferedWriter(new FileWriter(file));
			bw.write(seed.toString());
			bw.close();
		}
	} catch (IOException e) {
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:21,代碼來源:ServerEventHandler.java

示例2: onSave

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onSave(PlayerEvent.SaveToFile event) {
	if (event.getEntityPlayer().getEntityWorld().isRemote) {
		return;
	}
	PlayerCivilizationCapability cap = PlayerCivilizationCapabilityImpl.get(event.getEntityPlayer());
	if (cap == null) {
		return;
	}

	NBTTagCompound civData = cap.writeNBT();

	// System.out.println("SAVE: " + civData);

	if (civData == null || civData.getTag("reputations") == null || ((NBTTagList) civData.getTag("reputations")).tagCount() < 1) {
		// System.out.println("******************Not writing empty ToroQuest
		// data for player " + event.getEntityPlayer().getName());
		return;
	}

	event.getEntityPlayer().getEntityData().setTag(ToroQuest.MODID + ".playerCivilization", civData);
}
 
開發者ID:ToroCraft,項目名稱:ToroQuest,代碼行數:23,代碼來源:CivilizationHandlers.java

示例3: onSave

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

示例4: onPlayerSaveToFile

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
@SuppressWarnings("unused")
public void onPlayerSaveToFile(PlayerEvent.SaveToFile event) {
    Account account = Account.get(event.getEntityPlayer());
    try {
        account.writeIfChanged();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:kamildanak,項目名稱:EnderPay,代碼行數:11,代碼來源:EventHandler.java

示例5: playerSave

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

示例6: playerSave

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void playerSave(PlayerEvent.SaveToFile event) {
  UtilPlayerInventoryFilestorage.savePlayerItems(event.getEntityPlayer(), UtilPlayerInventoryFilestorage.getPlayerFile(UtilPlayerInventoryFilestorage.EXT, event.getPlayerDirectory(), event.getEntityPlayer()), UtilPlayerInventoryFilestorage.getPlayerFile(UtilPlayerInventoryFilestorage.EXTBK, event.getPlayerDirectory(), event.getEntityPlayer()));
}
 
開發者ID:LothrazarMinecraftMods,項目名稱:OverpoweredInventory,代碼行數:5,代碼來源:EventExtendedInventory.java

示例7: onPlayerDataSaved

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


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