本文整理匯總了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) {
}
}
示例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);
}
示例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());
}
示例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();
}
}
示例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()));
}
示例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()));
}
示例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"));
}