本文整理汇总了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);
}
示例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()));
}
示例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();
}
示例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 );
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
}
}
}
}
}