当前位置: 首页>>代码示例>>Java>>正文


Java BlockDirt类代码示例

本文整理汇总了Java中cn.nukkit.block.BlockDirt的典型用法代码示例。如果您正苦于以下问题:Java BlockDirt类的具体用法?Java BlockDirt怎么用?Java BlockDirt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BlockDirt类属于cn.nukkit.block包,在下文中一共展示了BlockDirt类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fall

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
public void fall(float fallDistance) {
    float damage = (float) Math.floor(fallDistance - 3 - (this.hasEffect(Effect.JUMP) ? this.getEffect(Effect.JUMP).getAmplifier() + 1 : 0));
    if (damage > 0) {
        this.attack(new EntityDamageEvent(this, DamageCause.FALL, damage));
    }

    if (fallDistance > 0.75) {
        BlockVector3 v = new BlockVector3(getFloorX(), getFloorY() - 1, getFloorZ());
        int down = this.level.getBlockIdAt(v.x, v.y, v.z);

        if (down == Item.FARMLAND) {
            if (this instanceof Player) {
                Player p = (Player) this;
                PlayerInteractEvent ev = new PlayerInteractEvent(p, p.getInventory().getItemInHand(), this.temporalVector.setComponents(v.x, v.y, v.z), null, Action.PHYSICAL);
                this.server.getPluginManager().callEvent(ev);
                if (ev.isCancelled()) {
                    return;
                }
            }
            this.level.setBlock(this.temporalVector.setComponents(v.x, v.y, v.z), new BlockDirt(), true, true);
        }
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:24,代码来源:Entity.java

示例2: fall

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
public void fall(float fallDistance) {
    float damage = (float) Math.floor(fallDistance - 3 - (this.hasEffect(Effect.JUMP) ? this.getEffect(Effect.JUMP).getAmplifier() + 1 : 0));
    if (damage > 0) {
        this.attack(new EntityDamageEvent(this, DamageCause.FALL, damage));
    }

    if (fallDistance > 0.75) {
        BlockVector3 v = new BlockVector3(getFloorX(), getFloorY() - 1, getFloorZ());
        int down = this.level.getBlockIdAt(v.x, v.y, v.z);

        if (down == Item.FARMLAND) {
            if (this instanceof Player) {
                Player p = (Player) this;
                PlayerInteractEvent ev = new PlayerInteractEvent(p, p.getInventory().getItemInHand(), this.temporalVector.setComponents(v.x, v.y, v.z), null, PlayerInteractEvent.PHYSICAL);
                this.server.getPluginManager().callEvent(ev);
                if (ev.isCancelled()) {
                    return;
                }
            }
            this.level.setBlock(this.temporalVector.setComponents(v.x, v.y, v.z), new BlockDirt(), true, true);
        }
    }
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:24,代码来源:Entity.java

示例3: fall

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
public void fall(float fallDistance) {
    float damage = (float) Math.floor(fallDistance - 3 - (this.hasEffect(Effect.JUMP) ? this.getEffect(Effect.JUMP).getAmplifier() + 1 : 0));
    if (damage > 0) {
        this.attack(new EntityDamageEvent(this, DamageCause.FALL, damage));
    }

    if (fallDistance > 0.75) {
        Block down = this.level.getBlock(this.floor().down());

        if (down.getId() == Item.FARMLAND) {
            if (this instanceof Player) {
                Player p = (Player) this;
                PlayerInteractEvent ev = new PlayerInteractEvent(p, p.getInventory().getItemInHand(), down, null, Action.PHYSICAL);
                this.server.getPluginManager().callEvent(ev);
                if (ev.isCancelled()) {
                    return;
                }
            }
            this.level.setBlock(down, new BlockDirt(), true, true);
        }
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:23,代码来源:Entity.java

示例4: MushroomIsland

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
public MushroomIsland() {

        MushroomPopulator mushroomPopulator = new MushroomPopulator();
        mushroomPopulator.setBaseAmount(1);

        addPopulator(mushroomPopulator);
        setElevation(60, 70);
        temperature = 0.9f;
        rainfall = 1.0f;
        
        this.setGroundCover(new Block[]{
        new BlockMycelium(),
        new BlockDirt(),
        new BlockDirt(),
        new BlockDirt(),
        new BlockDirt()
        });
    }
 
开发者ID:NycuRO,项目名称:BiomeMaster,代码行数:19,代码来源:MushroomIsland.java

示例5: GrassyBiome

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
public GrassyBiome() {
    this.setGroundCover(new Block[]{
            new BlockGrass(),
            new BlockDirt(),
            new BlockDirt(),
            new BlockDirt(),
            new BlockDirt()
    });
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:10,代码来源:GrassyBiome.java

示例6: MushroomIsland

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
public MushroomIsland() {
    this.setGroundCover(new Block[]{new BlockMycelium(), new BlockDirt(), new BlockDirt(), new BlockDirt(), new BlockDirt()});

    MushroomPopulator mushroomPopulator = new MushroomPopulator();
    mushroomPopulator.setBaseAmount(1);

    addPopulator(mushroomPopulator);
    setElevation(60, 70);
    temperature = 0.9f;
    rainfall = 1.0f;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:12,代码来源:MushroomIsland.java

示例7: WateryBiome

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
public WateryBiome() {
    this.setGroundCover(new Block[]{
            new BlockDirt(),
            new BlockDirt(),
            new BlockDirt(),
            new BlockDirt(),
            new BlockDirt()
    });
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:10,代码来源:WateryBiome.java

示例8: SnowyBiome

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
public SnowyBiome() {
    this.setGroundCover(new Block[]{
            new BlockSnowLayer(),
            new BlockGrass(),
            new BlockDirt(),
            new BlockDirt(),
            new BlockDirt()
    });
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:10,代码来源:SnowyBiome.java

示例9: fall

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
public void fall(float fallDistance) {
    float damage = (float) Math.floor(fallDistance - 3 - (this.hasEffect(Effect.JUMP) ? this.getEffect(Effect.JUMP).getAmplifier() + 1 : 0));
    if (damage > 0) {
        EntityDamageEvent ev = new EntityDamageEvent(this, EntityDamageEvent.CAUSE_FALL, damage);
        this.attack(ev);
    }

    if (fallDistance > 1) {
        Block down = this.level.getBlock(this.temporalVector.setComponents(getFloorX(), getFloorY() - 1, getFloorZ()));

        if (down.getId() == Item.FARMLAND) {
            this.level.setBlock(this.temporalVector.setComponents(down.x, down.y, down.z), new BlockDirt(), true, true);
        }
    }
}
 
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:16,代码来源:Entity.java

示例10: setDirtAt

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
/**
 * sets dirt at a specific location if it isn't already dirt
 */
protected void setDirtAt(ChunkManager level, Vector3 pos) {
    if (level.getBlockIdAt((int) pos.x, (int) pos.y, (int) pos.z) != Item.DIRT) {
        this.setBlockAndNotifyAdequately(level, pos, new BlockDirt());
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:9,代码来源:TreeGenerator.java

示例11: init

import cn.nukkit.block.BlockDirt; //导入依赖的package包/类
@Override
    public void init(ChunkManager level, NukkitRandom random) {
        this.level = level;
        this.nukkitRandom = random;
        this.random = new Random();
        this.nukkitRandom.setSeed(this.level.getSeed());
        this.localSeed1 = this.random.nextLong();
        this.localSeed2 = this.random.nextLong();
        this.noiseSeaFloor = new Simplex(this.nukkitRandom, 1F, 1F / 8F, 1F / 64F);
        this.noiseLand = new Simplex(this.nukkitRandom, 2F, 1F / 8F, 1F / 512F);
        this.noiseMountains = new Simplex(this.nukkitRandom, 4F, 1F, 1F / 500F);
        this.noiseBaseGround = new Simplex(this.nukkitRandom, 4F, 1F / 4F, 1F / 64F);
        this.noiseRiver = new Simplex(this.nukkitRandom, 2F, 1F, 1F / 512F);
        this.nukkitRandom.setSeed(this.level.getSeed());
        this.selector = new BiomeSelector(this.nukkitRandom, Biome.getBiome(Biome.FOREST));
        this.heightOffset = random.nextRange(-5, 3);

        this.selector.addBiome(Biome.getBiome(OCEAN));
        this.selector.addBiome(Biome.getBiome(PLAINS));
        this.selector.addBiome(Biome.getBiome(DESERT));
        this.selector.addBiome(Biome.getBiome(FOREST));
        this.selector.addBiome(Biome.getBiome(TAIGA));
        this.selector.addBiome(Biome.getBiome(RIVER));
        this.selector.addBiome(Biome.getBiome(ICE_PLAINS));
        this.selector.addBiome(Biome.getBiome(BIRCH_FOREST));

        this.selector.addBiome(Biome.getBiome(JUNGLE));
        this.selector.addBiome(Biome.getBiome(SAVANNA));
        this.selector.addBiome(Biome.getBiome(ROOFED_FOREST));
        this.selector.addBiome(Biome.getBiome(ROOFED_FOREST_M));
        this.selector.addBiome(Biome.getBiome(MUSHROOM_ISLAND));
        this.selector.addBiome(Biome.getBiome(SWAMP));

        this.selector.recalculate();


        PopulatorCaves caves = new PopulatorCaves();
        this.populators.add(caves);

        PopulatorRavines ravines = new PopulatorRavines();
        this.populators.add(ravines);

//        PopulatorDungeon dungeons = new PopulatorDungeon();
//        this.populators.add(dungeons);

        PopulatorGroundCover cover = new PopulatorGroundCover();
        this.generationPopulators.add(cover);

        PopulatorOre ores = new PopulatorOre();
        ores.setOreTypes(new OreType[]{
                new OreType(new BlockOreCoal(), 20, 17, 0, 128),
                new OreType(new BlockOreIron(), 20, 9, 0, 64),
                new OreType(new BlockOreRedstone(), 8, 8, 0, 16),
                new OreType(new BlockOreLapis(), 1, 7, 0, 16),
                new OreType(new BlockOreGold(), 2, 9, 0, 32),
                new OreType(new BlockOreDiamond(), 1, 8, 0, 16),
                new OreType(new BlockDirt(), 10, 33, 0, 128),
                new OreType(new BlockGravel(), 8, 33, 0, 128),
                new OreType(new BlockStone(BlockStone.GRANITE), 10, 33, 0, 80),
                new OreType(new BlockStone(BlockStone.DIORITE), 10, 33, 0, 80),
                new OreType(new BlockStone(BlockStone.ANDESITE), 10, 33, 0, 80)
        });
        this.populators.add(ores);
    }
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:65,代码来源:Normal.java


注:本文中的cn.nukkit.block.BlockDirt类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。