Java Code Examples for cn.nukkit.level.Level#DIMENSION_NETHER

The following examples show how to use cn.nukkit.level.Level#DIMENSION_NETHER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockIce.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public int onUpdate(int type) {
    if (type == Level.BLOCK_UPDATE_RANDOM) {
        if (this.getLevel().getDimension() != Level.DIMENSION_NETHER) {
            if (this.getLevel().getBlockLightAt((int) this.x, (int) this.y, (int) this.z) >= 12) {
                BlockFadeEvent event = new BlockFadeEvent(this, get(WATER));
                level.getServer().getPluginManager().callEvent(event);
                if (!event.isCancelled()) {
                    level.setBlock(this, event.getNewState(), true);
                }
                return Level.BLOCK_UPDATE_NORMAL;
            }
        }
    }
    return 0;
}
 
Example 2
Source File: BlockLiquid.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int tickRate() {
    if (this instanceof BlockWater) {
        return 5;
    } else if (this instanceof BlockLava) {
        if (this.getLevel().getDimension() == Level.DIMENSION_NETHER) {
            return 5;
        }
        return 30;
    }

    return 0;
}
 
Example 3
Source File: BlockIce.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onBreak(Item item) {
    if (this.getLevel().getDimension() != Level.DIMENSION_NETHER) {
        return this.getLevel().setBlock(this, Block.get(BlockID.WATER), true);
    } else {
        return super.onBreak(item);
    }
}
 
Example 4
Source File: BlockLava.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getFlowDecayPerBlock() {
    if (this.level.getDimension() == Level.DIMENSION_NETHER) {
        return 1;
    }
    return 2;
}
 
Example 5
Source File: BlockSponge.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
    Level level = block.getLevel();
    boolean blockSet = level.setBlock(block, this);

    if (blockSet) {
        if (this.getDamage() == WET && level.getDimension() == Level.DIMENSION_NETHER) {
            level.setBlock(block, Block.get(BlockID.SPONGE, DRY));
            this.getLevel().addSound(block.getLocation(), Sound.RANDOM_FIZZ);

            for (int i = 0; i < 8; ++i) {
                this.getLevel().addParticle(
                    //TODO: Use correct smoke particle
                    new SmokeParticle(block.getLocation().add(Math.random(), 1, Math.random())));
            }
        } else if (this.getDamage() == DRY && performWaterAbsorb(block)) {
            level.setBlock(block, Block.get(BlockID.SPONGE, WET));

            for (int i = 0; i < 4; i++) {
                LevelEventPacket packet = new LevelEventPacket();
                packet.evid = 2001;
                packet.x = (float) block.getX();
                packet.y = (float) block.getY();
                packet.z = (float) block.getZ();
                packet.data = GlobalBlockPalette.getOrCreateRuntimeId(BlockID.WATER, 0);
                level.addChunkPacket(getChunkX(), getChunkZ(), packet);
            }
        }
    }
    return blockSet;
}
 
Example 6
Source File: BlockLiquid.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int tickRate() {
    if (this instanceof BlockWater) {
        return 5;
    } else if (this instanceof BlockLava) {
        if (this.getLevel().getDimension() == Level.DIMENSION_NETHER) {
            return 5;
        }
        return 30;
    }

    return 0;
}
 
Example 7
Source File: Nether.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getDimension() {
    return Level.DIMENSION_NETHER;
}
 
Example 8
Source File: Nether.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getDimension() {
    return Level.DIMENSION_NETHER;
}
 
Example 9
Source File: Nether.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getDimension() {
    return Level.DIMENSION_NETHER;
}