本文整理匯總了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) {
}
}
示例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);
}
示例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());
}
示例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);
}
示例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));
}
示例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);
}
}
}
示例8: playerLoad
import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void playerLoad(PlayerEvent.LoadFromFile event) {
UtilPlayerInventoryFilestorage.playerSetupOnLoad(event);
}
示例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"));
}
示例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);
}