当前位置: 首页>>代码示例>>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;未经允许,请勿转载。