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


Java EditableNBT類代碼示例

本文整理匯總了Java中com.protolambda.blocktopograph.nbt.EditableNBT的典型用法代碼示例。如果您正苦於以下問題:Java EditableNBT類的具體用法?Java EditableNBT怎麽用?Java EditableNBT使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: okButtonActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
    int selectedIndex = dimensionComboBox.getSelectedIndex();
    Dimension dimension = Dimension.values()[selectedIndex];
    int X = (Integer) xSpinner.getValue();
    int Z = (Integer) zSpinner.getValue();
    
    if(blockCoordsCheckBox.isSelected()) {
        X >>= 4;
        Z >>= 4;
    }

    if (dimension == null) {
        doClose(RET_CANCEL);
    }
    EditableNBT nbt;
    if (entity) {
        nbt = worldProvider.getChunkEntityNBT(X, Z, dimension).getEditableNBTData();
    } else {
        nbt = worldProvider.getChunkBlockEntityNBT(X, Z, dimension).getEditableNBTData();
    }

    parent.addTab(new NBTPanel(parent, nbt), NBTIcon.COMPOUND.icon);

    doClose(RET_OK);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:26,代碼來源:ChunkNBTDialog.java

示例2: getEditablePlayer

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
/**
 * Loads local player data "~local-player" or level.dat>"Player" into an
 * EditableNBT.
 *
 * @return EditableNBT, local player NBT data wrapped in a handle to use for
 * saving + metadata
 * @throws Exception
 */
public EditableNBT getEditablePlayer() throws Exception {

    /*
            Logic path:
            1. try to find the player-data in the db:
                    if found -> return that
                    else -> go to 2
            2. try to find the player-data in the level.dat:
                    if found -> return that
                    else -> go to 3
            3. no player-data available: warn the user
     */
    EditableNBT editableNBT;
    try {
        editableNBT = openSpecialEditableNbtDbEntry(World.SpecialDBEntryType.LOCAL_PLAYER);
    } catch (IOException e) {
        e.printStackTrace();
        throw new Exception("Failed to read \"~local_player\" from the database.");
    }

    //check if it is not found in the DB
    if (editableNBT == null) {
        editableNBT = openEditableNbtLevel("Player");
    }

    //check if it is not found in level.dat as well
    if (editableNBT == null) {
        throw new Exception("Failed to find \"~local_player\" in DB and \"Player\" in level.dat!");
    }

    return editableNBT;

}
 
開發者ID:jocopa3,項目名稱:blocktopograph-library,代碼行數:42,代碼來源:WorldProvider.java

示例3: getEditablePlayer

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
/**
 * Loads local player data "~local-player" or level.dat>"Player" into an EditableNBT.
 * @return EditableNBT, local player NBT data wrapped in a handle to use for saving + metadata
 * @throws Exception
 */
public EditableNBT getEditablePlayer() throws Exception {

    /*
            Logic path:
            1. try to find the player-data in the db:
                    if found -> return that
                    else -> go to 2
            2. try to find the player-data in the level.dat:
                    if found -> return that
                    else -> go to 3
            3. no player-data available: warn the user
     */

    EditableNBT editableNBT;
    try {
        editableNBT = openSpecialEditableNbtDbEntry(World.SpecialDBEntryType.LOCAL_PLAYER);
    } catch (IOException e){
        e.printStackTrace();
        throw new Exception("Failed to read \"~local_player\" from the database.");
    }

    //check if it is not found in the DB
    if(editableNBT == null) editableNBT = openEditableNbtLevel("Player");

    //check if it is not found in level.dat as well
    if(editableNBT == null) throw new Exception("Failed to find \"~local_player\" in DB and \"Player\" in level.dat!");


    return editableNBT;

}
 
開發者ID:protolambda,項目名稱:blocktopograph,代碼行數:37,代碼來源:WorldActivity.java

示例4: openSpecialDBEntry

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
/** Open NBT editor fragment for special database entry */
public void openSpecialDBEntry(final World.SpecialDBEntryType entryType){
    try {
        EditableNBT editableEntry = openSpecialEditableNbtDbEntry(entryType);
        if(editableEntry == null){
            this.openWorldMap();
            //TODO better handling of db problems
            //throw new Exception("\"" + entryType.keyName + "\" not found in DB.");
        }

        Log.i("Opening NBT editor for \"" + entryType.keyName + "\" from world database.");

        openNBTEditor(editableEntry);

    } catch (Exception e) {
        e.printStackTrace();

        String msg = e.getMessage();
        if(e instanceof IOException) msg = String.format(getString(R.string.failed_to_read_x_from_db), entryType.keyName);

        new AlertDialog.Builder(WorldActivity.this)
                .setMessage(msg)
                .setCancelable(false)
                .setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        changeContentFragment(new OpenFragmentCallback() {
                            @Override
                            public void onOpen() {
                                openWorldMap();
                            }
                        });
                    }
                }).show();
    }
}
 
開發者ID:protolambda,項目名稱:blocktopograph,代碼行數:36,代碼來源:WorldActivity.java

示例5: openPlayerNBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openPlayerNBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openPlayerNBTActionPerformed
    EditableNBT playerNBT = null;
    try {
        playerNBT = parentWindow.getWorldProvider().getEditablePlayer();
    } catch (Exception ex) {
        return;
    }

    if (playerNBT == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for " + World.SpecialDBEntryType.LOCAL_PLAYER.keyName, "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, playerNBT), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java

示例6: openMultiplayerNBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openMultiplayerNBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openMultiplayerNBTActionPerformed
    EditableNBT playerNBT = null;
    try {
        playerNBT = parentWindow.getWorldProvider().openEditableNbtLevel(null);
    } catch (Exception ex) {
        return;
    }

    if (playerNBT == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for level.dat", "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, playerNBT), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java

示例7: openWorldNBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openWorldNBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openWorldNBTActionPerformed
    EditableNBT worldNBT = null;
    try {
        worldNBT = parentWindow.getWorldProvider().openEditableNbtLevel(null);
    } catch (Exception ex) {
        return;
    }

    if (worldNBT == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for level.dat", "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, worldNBT), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java

示例8: openNetherNBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openNetherNBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openNetherNBTActionPerformed
    EditableNBT nbtData = null;
    try {
        nbtData = parentWindow.getWorldProvider().openSpecialEditableNbtDbEntry(World.SpecialDBEntryType.NETHER);
    } catch (Exception ex) {
        return;
    }

    if (nbtData == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for " + World.SpecialDBEntryType.NETHER.keyName, "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, nbtData), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java

示例9: openOverworldNBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openOverworldNBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openOverworldNBTActionPerformed
    EditableNBT nbtData = null;
    try {
        nbtData = parentWindow.getWorldProvider().openSpecialEditableNbtDbEntry(World.SpecialDBEntryType.OVERWORLD);
    } catch (Exception ex) {
        return;
    }

    if (nbtData == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for " + World.SpecialDBEntryType.OVERWORLD.keyName, "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, nbtData), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java

示例10: openEndNBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openEndNBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openEndNBTActionPerformed
    EditableNBT nbtData = null;
    try {
        nbtData = parentWindow.getWorldProvider().openSpecialEditableNbtDbEntry(World.SpecialDBEntryType.THEEND);
    } catch (Exception ex) {
        return;
    }

    if (nbtData == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for " + World.SpecialDBEntryType.THEEND.keyName, "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, nbtData), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java

示例11: openVillagesNBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openVillagesNBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openVillagesNBTActionPerformed
    EditableNBT nbtData = null;
    try {
        nbtData = parentWindow.getWorldProvider().openSpecialEditableNbtDbEntry(World.SpecialDBEntryType.M_VILLAGES);
    } catch (Exception ex) {
        return;
    }

    if (nbtData == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for " + World.SpecialDBEntryType.M_VILLAGES.keyName, "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, nbtData), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java

示例12: openPortalsNBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openPortalsNBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openPortalsNBTActionPerformed
    EditableNBT nbtData = null;
    try {
        nbtData = parentWindow.getWorldProvider().openSpecialEditableNbtDbEntry(World.SpecialDBEntryType.PORTALS);
    } catch (Exception ex) {
        return;
    }

    if (nbtData == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for " + World.SpecialDBEntryType.PORTALS.keyName, "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, nbtData), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java

示例13: openDimension0NBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openDimension0NBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openDimension0NBTActionPerformed
    EditableNBT nbtData = null;
    try {
        nbtData = parentWindow.getWorldProvider().openSpecialEditableNbtDbEntry(World.SpecialDBEntryType.DIMENSION_0);
    } catch (Exception ex) {
        return;
    }

    if (nbtData == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for " + World.SpecialDBEntryType.DIMENSION_0.keyName, "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, nbtData), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java

示例14: openDimension1NBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openDimension1NBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openDimension1NBTActionPerformed
    EditableNBT nbtData = null;
    try {
        nbtData = parentWindow.getWorldProvider().openSpecialEditableNbtDbEntry(World.SpecialDBEntryType.DIMENSION_1);
    } catch (Exception ex) {
        return;
    }

    if (nbtData == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for " + World.SpecialDBEntryType.DIMENSION_1.keyName, "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, nbtData), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java

示例15: openDimension2NBTActionPerformed

import com.protolambda.blocktopograph.nbt.EditableNBT; //導入依賴的package包/類
private void openDimension2NBTActionPerformed(ActionEvent evt) {//GEN-FIRST:event_openDimension2NBTActionPerformed
    EditableNBT nbtData = null;
    try {
        nbtData = parentWindow.getWorldProvider().openSpecialEditableNbtDbEntry(World.SpecialDBEntryType.DIMENSION_2);
    } catch (Exception ex) {
        return;
    }

    if (nbtData == null) {
        JOptionPane.showMessageDialog(parentWindow, "No NBT data found for " + World.SpecialDBEntryType.DIMENSION_2.keyName, "No NBT Data", JOptionPane.WARNING_MESSAGE);
        return;
    }

    parentWindow.addTab(new NBTPanel(parentWindow, nbtData), NBTIcon.COMPOUND.icon);
}
 
開發者ID:jocopa3,項目名稱:BlocktopographPC-GUI,代碼行數:16,代碼來源:WorldWindowSideBar.java


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