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


Java Material.STONE属性代码示例

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


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

示例1: createMeta

protected void createMeta() {
    // Bukkit refuses to create meta for air
    final Material material = stack.getType() == Material.AIR ? Material.STONE
                                                              : stack.getType();
    if(meta != null) {
        // Ensure existing meta is the correct type
        meta = Bukkit.getItemFactory().asMetaFor(meta, material);
    } else {
        meta = stack.getItemMeta();
        if(meta == null) {
            meta = Bukkit.getItemFactory().getItemMeta(material);
        }
    }

    checkNotNull(meta);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:16,代码来源:ItemBuilder.java

示例2: onItemSpawn

/**
 * Delete different type of certains blocks
 *
 * @param event Event
 */
@EventHandler
public void onItemSpawn(ItemSpawnEvent event)
{
    if (event.getEntityType() != EntityType.DROPPED_ITEM)
        return;

    if (event.getEntity().hasMetadata("playerDrop"))
        return;

    Material material = event.getEntity().getItemStack().getType();

    if (material == Material.LOG || material == Material.LOG_2)
        event.getEntity().setItemStack(new ItemStack(Material.LOG, event.getEntity().getItemStack().getAmount()));
    else if (material == Material.COBBLESTONE)
        event.getEntity().setItemStack(new ItemStack(Material.COBBLESTONE, event.getEntity().getItemStack().getAmount()));
    else if (material == Material.STONE)
        event.getEntity().setItemStack(new ItemStack(Material.COBBLESTONE, event.getEntity().getItemStack().getAmount()));
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:23,代码来源:RapidStackingModule.java

示例3: test

@Test
public void test() {
    ItemStack item = new ItemStack(Material.STONE);

    new SpeedTester(10, false)
            .addRunnable("data", () -> {
                new ItemBuilder(item)
                        .display("a b c")
                        .replacement(
                                "a", "1",
                                "b", "2",
                                "c", "3"
                        )
                        .build();
            })
            .start();
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:17,代码来源:PerformanceTest.java

示例4: ItemBuilder

/**
 * Creates an ItemBuilder
 * @param name of the item
 */
public ItemBuilder(String name){
    item = new ItemStack( Material.STONE );
    meta = item.getItemMeta();
    if(name != null){
        meta.setDisplayName( name );
        item.setItemMeta( meta );
    }

}
 
开发者ID:LegendOnline,项目名称:InventoryAPI,代码行数:13,代码来源:ItemBuilder.java

示例5: IconMaker

public IconMaker(String type) {
	try {
		Material m = Material.valueOf(type);
		this.item = new ItemStack(m);
	} catch (IllegalArgumentException | NullPointerException e) {
		this.item = new ItemStack(Material.STONE);
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:8,代码来源:IconMaker.java

示例6: onPlayerPickup

@EventHandler
public void onPlayerPickup(PlayerPickupItemEvent event){
    Material type = event.getItem().getItemStack().getType();
    if(type == Material.STONE || type == Material.COBBLESTONE){
        if(disabled.contains(event.getPlayer())){
            event.setCancelled(true);
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:CobbleCommand.java

示例7: generate

private void generate(World world, Random rand, int x, int y, int z, int size, Rule material)
{
    double rpi = rand.nextDouble() * Math.PI;
    double x1 = x + 8 + Math.sin(rpi) * size / 8.0F;
    double x2 = x + 8 - Math.sin(rpi) * size / 8.0F;
    double z1 = z + 8 + Math.cos(rpi) * size / 8.0F;
    double z2 = z + 8 - Math.cos(rpi) * size / 8.0F;
    double y1 = y + rand.nextInt(3) + 2;
    double y2 = y + rand.nextInt(3) + 2;

    for (int i = 0; i <= size; i++)
    {
        double xPos = x1 + (x2 - x1) * i / size;
        double yPos = y1 + (y2 - y1) * i / size;
        double zPos = z1 + (z2 - z1) * i / size;
        double fuzz = rand.nextDouble() * size / 16.0D;
        double fuzzXZ = (Math.sin((float) (i * Math.PI / size)) + 1.0F) * fuzz + 1.0D;
        double fuzzY = (Math.sin((float) (i * Math.PI / size)) + 1.0F) * fuzz + 1.0D;
        int xStart = (int) Math.floor(xPos - fuzzXZ / 2.0D);
        int yStart = (int) Math.floor(yPos - fuzzY / 2.0D);
        int zStart = (int) Math.floor(zPos - fuzzXZ / 2.0D);
        int xEnd = (int) Math.floor(xPos + fuzzXZ / 2.0D);
        int yEnd = (int) Math.floor(yPos + fuzzY / 2.0D);
        int zEnd = (int) Math.floor(zPos + fuzzXZ / 2.0D);

        for (int ix = xStart; ix <= xEnd; ix++)
        {
            double xThresh = (ix + 0.5D - xPos) / (fuzzXZ / 2.0D);

            if (xThresh * xThresh < 1.0D)
            {
                for (int iy = yStart; iy <= yEnd; iy++)
                {
                    double yThresh = (iy + 0.5D - yPos) / (fuzzY / 2.0D);

                    if (xThresh * xThresh + yThresh * yThresh < 1.0D)
                    {
                        for (int iz = zStart; iz <= zEnd; iz++)
                        {
                            double zThresh = (iz + 0.5D - zPos) / (fuzzXZ / 2.0D);

                            if (xThresh * xThresh + yThresh * yThresh + zThresh * zThresh < 1.0D)
                            {
                                Block block = getBlock(world, ix, iy, iz);

                                if (block != null && block.getType() == Material.STONE)
                                    block.setType(material.id);
                            }
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:55,代码来源:OrePopulator.java


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