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


Java Material.GRASS属性代码示例

本文整理汇总了Java中org.bukkit.Material.GRASS属性的典型用法代码示例。如果您正苦于以下问题:Java Material.GRASS属性的具体用法?Java Material.GRASS怎么用?Java Material.GRASS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.Material的用法示例。


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

示例1: onPlayerInteract

@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getAction() != Action.RIGHT_CLICK_BLOCK || event.useInteractedBlock() == Result.DENY)
        return;

    //For using a hoe for farming
    if (event.getItem() != null &&
            event.getItem().getType() != null &&
            (event.getMaterial() == Material.DIRT || event.getMaterial() == Material.GRASS) &&
            ((event.getItem().getType() == Material.WOOD_HOE) ||
                    (event.getItem().getType() == Material.IRON_HOE) ||
                    (event.getItem().getType() == Material.GOLD_HOE) ||
                    (event.getItem().getType() == Material.DIAMOND_HOE)))
    {
        BlockUpdate.Update(event.getClickedBlock());
    }
}
 
开发者ID:SamaGames,项目名称:AntiCheat,代码行数:17,代码来源:OrebfuscatorPlayerListener.java

示例2: grow

public static void grow(Player p, int radius) {
    Block target = p.getTargetBlock((HashSet<Byte>) null, 100);
    int radius_squared = radius * radius;
    Block toHandle;
    SchematicUserConfig cfg = getConfig(p);
    ArrayList<Block> list = new ArrayList<Block>();
    for (int x = -radius; x <= radius; x++) {
        for (int z = -radius; z <= radius; z++) {
            toHandle = target.getWorld().getHighestBlockAt(target.getX() + x, target.getZ() + z);
            if (toHandle.getType() == Material.AIR && toHandle.getRelative(BlockFace.DOWN).getType() == Material.GRASS) { // Block beneath is grass
                if (target.getLocation().distanceSquared(toHandle.getLocation()) <= radius_squared) { // Block is in radius
                    double rand = Math.random();
                    if (rand < cfg.growDensity * 5 / 6) {
                        toHandle.setType(Material.LONG_GRASS);
                        toHandle.setData((byte) 1);
                        list.add(toHandle);
                    } else if (rand < cfg.growDensity) {
                        toHandle.setType(Material.RED_ROSE); //0 4 5 6 7 8
                        byte data = (byte) (Math.random() * 6);
                        if (data > 0)
                            data += 3; //1 + 3 = 4, 2 + 3 = 5, ..., 5 + 3 = 8
                        toHandle.setData(data);
                        list.add(toHandle);
                    }
                }
            }
        }
    }
    cfg.lastGrow.add(list);
    if (SchematicManager.getConfig(p).verbose)
        p.sendMessage("Grew with radius " + radius + ".");
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:32,代码来源:SchematicManager.java

示例3: registerRunes

private void registerRunes() {
	Rune rune;
	
	rune = new Rune("Freeze", Material.ICE, 15, -1);
	rune.addDescription(ChatColor.GRAY + "Freezes target");
	rune.addDescription(ChatColor.GRAY + "Range: " + ChatColor.RED + "10 blocks");
	rune.addDescription(ChatColor.GRAY + "Freeze duration: " + ChatColor.RED + "3 second");
	runes.add(rune);
	
	rune = new Rune("Fire Storm", Material.BLAZE_POWDER, 25, 30);
	rune.addDescription(ChatColor.GRAY + "Sets everyone around on fire");
	rune.addDescription(ChatColor.GRAY + "Range: " + ChatColor.RED + "2 blocks");
	rune.addDescription(ChatColor.GRAY + "Burning duration: " + ChatColor.RED + "2 seconds");
	runes.add(rune);
	
	rune = new Rune("Slowdown", Material.WEB, 15, 30);
	rune.addDescription(ChatColor.GRAY + "Slows everyone around");
	rune.addDescription(ChatColor.GRAY + "Range: " + ChatColor.RED + "3 blocks");
	rune.addDescription(ChatColor.GRAY + "Slow Level: " + ChatColor.RED + "I");
	rune.addDescription(ChatColor.GRAY + "Slow duration: " + ChatColor.RED + "5 seconds");
	runes.add(rune);
	
	rune = new Rune("Invisibility", Material.GRASS, 10, 5);
	rune.addDescription(ChatColor.GRAY + "Gives uninterruptible invisibility");
	runes.add(rune);
	
	rune = new Rune("Lightning", Material.FIREWORK, 15, -1);
	rune.addDescription(ChatColor.GRAY + "Strikes lightning at target position");
	rune.addDescription(ChatColor.GRAY + "Range: " + ChatColor.RED + "20 blocks");
	rune.addDescription(ChatColor.GRAY + "Damage: " + ChatColor.RED + "5 hearts");
	runes.add(rune);
	
	rune = new Rune("Detonate", Material.TNT, 20, -1);
	rune.addDescription(ChatColor.GRAY + "Strikes explosion at your location");
	rune.addDescription(ChatColor.GRAY + "Explosion range: " + ChatColor.RED + "4 blocks");
	rune.addDescription(ChatColor.GRAY + "Damage: " + ChatColor.RED + "3 hearts");
	runes.add(rune);
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:38,代码来源:RuneManager.java

示例4: onPlayerJoin

@EventHandler
  public void onPlayerJoin(BlockBreakEvent e) {
	  System.out.println("イベントだよー2");
	  Block b = e.getBlock();
	if (b.getType() == Material.GRASS) {
		e.setCancelled(true);
		b.setType(Material.GLASS);
	}
	if (b.getType() == Material.GLASS) {
		e.setCancelled(true);
		b.setType(Material.GRASS);
	}
}
 
开发者ID:rintech,项目名称:Sword_Skill,代码行数:13,代码来源:Main.java

示例5: WorldMock

/**
 * Creates a new mock world with a height of 128 and will spawn grass until a
 * {@code y} of 4.
 */
public WorldMock()
{
	this(Material.GRASS, 4);
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:8,代码来源:WorldMock.java


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