本文整理汇总了Java中org.bukkit.FireworkEffect.Type.CREEPER属性的典型用法代码示例。如果您正苦于以下问题:Java Type.CREEPER属性的具体用法?Java Type.CREEPER怎么用?Java Type.CREEPER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.FireworkEffect.Type
的用法示例。
在下文中一共展示了Type.CREEPER属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEffectType
static Type getEffectType(int nbt) {
switch (nbt) {
case 0:
return Type.BALL;
case 1:
return Type.BALL_LARGE;
case 2:
return Type.STAR;
case 3:
return Type.CREEPER;
case 4:
return Type.BURST;
default:
throw new IllegalStateException(Integer.toString(nbt)); // Spigot
}
}
示例2: getEffectType
static Type getEffectType(int nbt) {
switch (nbt) {
case 0:
return Type.BALL;
case 1:
return Type.BALL_LARGE;
case 2:
return Type.STAR;
case 3:
return Type.CREEPER;
case 4:
return Type.BURST;
default:
throw new AssertionError(nbt);
}
}
示例3: getRandomType
public Type getRandomType() {
int type = getRandomNum(5, 1);
switch (type) {
case 1: return Type.STAR;
case 2: return Type.CREEPER;
case 3: return Type.BURST;
case 4: return Type.BALL_LARGE;
case 5: return Type.BALL;
default: return Type.STAR;
}
}
示例4: spawnRandomFireworkAtPlayer
private static void spawnRandomFireworkAtPlayer( Player pPlayer )
{
// Our random generator
Random r = new Random();
// Spawn the Firework, get the FireworkMeta.
Location loc = pPlayer.getLocation();
loc.add( r.nextInt(5)-2, 0, r.nextInt(5)-2 );
Firework fw = (Firework) pPlayer.getWorld().spawnEntity( loc, EntityType.FIREWORK );
FireworkMeta fwm = fw.getFireworkMeta();
// Get the type
int rt = r.nextInt( 5 ) + 1;
Type type = Type.BALL;
if( rt == 1 ) type = Type.BALL;
if( rt == 2 ) type = Type.BALL_LARGE;
if( rt == 3 ) type = Type.BURST;
if( rt == 4 ) type = Type.CREEPER;
if( rt == 5 ) type = Type.STAR;
// Get our random colours
int r1i = r.nextInt( 17 ) + 1;
int r2i = r.nextInt( 17 ) + 1;
Color c1 = getColor( r1i );
Color c2 = getColor( r2i );
// Create our effect with this
FireworkEffect effect = FireworkEffect.builder().flicker( r.nextBoolean() ).withColor( c1 ).withFade( c2 ).with( type ).trail( r.nextBoolean() ).build();
// Then apply the effect to the meta
fwm.addEffect( effect );
// Generate some random power and set it
int rp = r.nextInt( 2 ) + 1;
fwm.setPower( rp );
// Then apply this to our rocket
fw.setFireworkMeta( fwm );
}
示例5: shootFirework
public static Firework shootFirework(Location loc, Random rand) {
int type = rand.nextInt(5) + 1;
Firework firework = loc.getWorld().spawn(loc, Firework.class);
FireworkMeta meta = firework.getFireworkMeta();
Type ft = null;
switch (type) {
case 1:
ft = Type.BALL;
break;
case 2:
ft = Type.BALL_LARGE;
break;
case 3:
ft = Type.BURST;
break;
case 4:
ft = Type.CREEPER;
break;
case 5:
ft = Type.STAR;
break;
}
FireworkEffect effect = FireworkEffect.builder().flicker(rand.nextBoolean()).withColor(fireworkColor(rand.nextInt(16) + 1)).withFade(fireworkColor(rand.nextInt(16) + 1))
.trail(rand.nextBoolean()).with(ft).trail(rand.nextBoolean()).build();
meta.addEffect(effect);
firework.setFireworkMeta(meta);
return firework;
}
示例6: shootFirework
public static void shootFirework() {
//FIREWORK-command: Randomizer
for (Player player : Bukkit.getOnlinePlayers()) {
Firework fw = (Firework) player.getWorld().spawn(player.getLocation(), Firework.class);
FireworkMeta fm = fw.getFireworkMeta();
Random r = new Random();
Type type = null;
int fType = r.nextInt(4) + 1;
switch(fType) {
default: type = Type.BALL; break;
case 1: type = Type.BALL; break;
case 2: type = Type.BALL_LARGE; break;
case 3: type = Type.BURST; break;
case 4: type = Type.CREEPER; break;
case 5: type = Type.STAR; break;
}
int c1i = r.nextInt(15) + 1;
int c2i = r.nextInt(15) + 1;
Color c1 = getColor(c1i);
Color c2 = getColor(c2i);
FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1).withFade(c2).with(type).trail(r.nextBoolean()).build();
fm.addEffect(effect);
fm.setPower(r.nextInt(2) + 1);
fw.setFireworkMeta(fm);
}
}
示例7: shootFireworks
public static void shootFireworks(String arenaName) {
// Spawn the Firework, get the FireworkMeta.
Firework fw = (Firework) BlockParty.getArena.get(arenaName).getWorld()
.spawnEntity(BlockParty.getArena.get(arenaName).getGameSpawn(), EntityType.FIREWORK);
FireworkMeta fwm = fw.getFireworkMeta();
// Our random generator
Random r = new Random();
// Get the type
int rt = r.nextInt(4) + 1;
Type type = Type.BALL;
if (rt == 1)
type = Type.BALL;
if (rt == 2)
type = Type.BALL_LARGE;
if (rt == 3)
type = Type.BURST;
if (rt == 4)
type = Type.CREEPER;
if (rt == 5)
type = Type.STAR;
// Get our random colours
int r1i = r.nextInt(17) + 1;
int r2i = r.nextInt(17) + 1;
Color c1 = getColor(r1i);
Color c2 = getColor(r2i);
// Create our effect with this
FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1).withFade(c2).with(type).trail(r.nextBoolean()).build();
// Then apply the effect to the meta
fwm.addEffect(effect);
// Generate some random power and set it
int rp = r.nextInt(2) + 1;
fwm.setPower(rp);
// Then apply this to our rocket
fw.setFireworkMeta(fwm);
}
示例8: fireworkIt
public void fireworkIt(Location loc) {
// Spawn the Firework, get the FireworkMeta.
Firework fw = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
FireworkMeta fwm = fw.getFireworkMeta();
// Our random generator
Random r = new Random();
// Get the type
int rt = r.nextInt(5) + 1;
Type type = Type.BALL;
if (rt == 1)
type = Type.BALL;
if (rt == 2)
type = Type.BALL_LARGE;
if (rt == 3)
type = Type.BURST;
if (rt == 4)
type = Type.CREEPER;
if (rt == 5)
type = Type.STAR;
// Get our random colors
int r1i = r.nextInt(255) + 1;
int r2i = r.nextInt(255) + 1;
int r3i = r.nextInt(255) + 1;
Color c1 = Color.fromRGB(r1i, r2i, r3i);
Color c2 = Color.fromRGB(r1i, r2i, r3i);
// Create our effect with this
FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1).withFade(c2).with(type).trail(r.nextBoolean()).build();
// Then apply the effect to the meta
fwm.addEffect(effect);
// Generate some random power and set it
int rp = r.nextInt(2) + 1;
fwm.setPower(rp);
// Then apply this to our rocket
fw.setFireworkMeta(fwm);
}
示例9: run
@Override
public void run() {
timer--;
if (timer <= 0)
this.cancel();
Random r = new Random();
Location block1 = Selection.locationFromString(game.getFarm().getSel().getBlock1());
block1.setX(block1.getX() + (r.nextInt(10) + 1));
block1.setZ(block1.getZ() + (r.nextInt(10) + 1));
Location block2 = Selection.locationFromString(game.getFarm().getSel().getBlock2());
block2.setX(block2.getX() + (r.nextInt(10) + timer));
block2.setZ(block2.getZ() + (r.nextInt(10) + timer));
Firework fw = (Firework) block1.getWorld().spawnEntity(timer % 2 == 0 ? block1 : block2, EntityType.FIREWORK);
FireworkMeta fwm = fw.getFireworkMeta();
int typeInt = r.nextInt(5) + 1;
Type type = Type.BURST;
if (typeInt == 1)
type = Type.BALL;
if (typeInt == 2)
type = Type.BALL_LARGE;
if (typeInt == 3)
type = Type.BURST;
if (typeInt == 4)
type = Type.CREEPER;
if (typeInt == 5)
type = Type.STAR;
int colorR = r.nextInt(100) + 1;
int colorG = r.nextInt(100) + 1;
int colorB = r.nextInt(100) + 1;
Color color = Color.fromRGB(colorR, colorG, colorB);
FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(color).with(type).trail(r.nextBoolean()).build();
fwm.addEffect(effect);
int rp = r.nextInt(2) + 1;
fwm.setPower(rp);
fw.setFireworkMeta(fwm);
}