本文整理汇总了Java中org.spongepowered.api.util.Color类的典型用法代码示例。如果您正苦于以下问题:Java Color类的具体用法?Java Color怎么用?Java Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Color类属于org.spongepowered.api.util包,在下文中一共展示了Color类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: accept
import org.spongepowered.api.util.Color; //导入依赖的package包/类
@Override
public void accept(Task task) {
List<Color> colors = Lists.newArrayList(Color.BLACK, Color.BLUE, Color.CYAN, Color.DARK_CYAN, Color.DARK_GREEN, Color.DARK_MAGENTA,
Color.GRAY, Color.GREEN, Color.LIME, Color.MAGENTA, Color.NAVY, Color.PINK, Color.PURPLE, Color.RED, Color.WHITE, Color.YELLOW);
Collections.shuffle(colors);
FireworkEffect fireworkEffect = FireworkEffect.builder()
.colors(colors.get(0), colors.get(1), colors.get(2))
.shape(FireworkShapes.STAR)
.build();
Entity firework = this.player.getWorld().createEntity(EntityTypes.FIREWORK, this.player.getLocation().getPosition());
firework.offer(Keys.FIREWORK_EFFECTS, Lists.newArrayList(fireworkEffect));
firework.offer(Keys.FIREWORK_FLIGHT_MODIFIER, 2);
this.player.getWorld().spawnEntity(firework);
this.counter++;
if (this.counter >= this.ITERATIONS) {
task.cancel();
}
}
开发者ID:BadgeUp,项目名称:badgeup-sponge-client,代码行数:25,代码来源:FireworkConsumer.java
示例2: registerDefaults
import org.spongepowered.api.util.Color; //导入依赖的package包/类
@Override
public void registerDefaults() {
registerOption("block_state", BlockState.class);
registerOption("color", Color.class);
registerOption("direction", Direction.class);
registerOption("firework_effects", List.class,
value -> value.isEmpty() ? new IllegalArgumentException("The firework effects list may not be empty") : null);
registerOption("quantity", Integer.class,
value -> value < 1 ? new IllegalArgumentException("Quantity must be at least 1") : null);
registerOption("item_stack_snapshot", ItemStackSnapshot.class);
registerOption("note", NotePitch.class);
registerOption("offset", Vector3d.class);
registerOption("potion_effect_type", PotionEffectType.class);
registerOption("scale", Double.class,
value -> value < 0 ? new IllegalArgumentException("Scale may not be negative") : null);
registerOption("velocity", Vector3d.class);
registerOption("slow_horizontal_velocity", Boolean.class);
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:19,代码来源:ParticleOptionRegistryModule.java
示例3: deserializeValues
import org.spongepowered.api.util.Color; //导入依赖的package包/类
@Override
public void deserializeValues(ItemStack itemStack, SimpleValueContainer valueContainer, DataView dataView) {
super.deserializeValues(itemStack, valueContainer, dataView);
dataView.getInt(COLOR).ifPresent(value -> valueContainer.set(Keys.COLOR, Color.ofRgb(value)));
dataView.getViewList(EFFECTS).ifPresent(effects -> {
if (effects.isEmpty()) {
return;
}
valueContainer.set(Keys.POTION_EFFECTS, effects.stream()
.map(PotionEffectSerializer::deserialize)
.filter(effect -> effect != null)
.collect(ImmutableList.toImmutableList()));
});
dataView.getString(POTION).ifPresent(id -> PotionTypeRegistryModule.get().getById(id).ifPresent(
potionType -> valueContainer.set(LanternKeys.POTION_TYPE, potionType)));
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:17,代码来源:PotionEffectsItemTypeObjectSerializer.java
示例4: ColorElement
import org.spongepowered.api.util.Color; //导入依赖的package包/类
ColorElement(Text key, @Nullable Color defaultColor) {
super(key);
this.defaultColor = defaultColor;
if (defaultColor != null) {
for (Map.Entry<String, Color> entry : INBUILT_COLORS.entrySet()) {
if (entry.getValue().equals(defaultColor)) {
final ImmutableList.Builder<String> entries = ImmutableList.builder();
entries.add(entry.getKey());
// Add all the other colors except the first element
INBUILT_COLORS.keySet().stream()
.filter(colorName -> !colorName.equals(entry.getKey()))
.forEach(entries::add);
this.sortedColorNames = entries.build();
return;
}
}
}
this.sortedColorNames = null;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:20,代码来源:GenericArguments2.java
示例5: giveTeamEquipment
import org.spongepowered.api.util.Color; //导入依赖的package包/类
private void giveTeamEquipment(Player player, Color teamColor) {
ItemStack teamHood = newItemStack(ItemTypes.LEATHER_HELMET);
teamHood.offer(Keys.DISPLAY_NAME, Text.of(TextColors.WHITE, "Team Hood"));
teamHood.offer(Keys.COLOR, teamColor);
player.setHelmet(teamHood);
ItemStack teamChestplate = newItemStack(ItemTypes.LEATHER_CHESTPLATE);
teamChestplate.offer(Keys.DISPLAY_NAME, Text.of(TextColors.WHITE, "Team Chestplate"));
teamChestplate.offer(Keys.COLOR, teamColor);
player.setChestplate(teamChestplate);
ItemStack teamLeggings = newItemStack(ItemTypes.LEATHER_LEGGINGS);
teamLeggings.offer(Keys.DISPLAY_NAME, Text.of(TextColors.WHITE, "Team Leggings"));
teamLeggings.offer(Keys.COLOR, teamColor);
player.setLeggings(teamLeggings);
ItemStack teamBoots = newItemStack(ItemTypes.LEATHER_BOOTS);
teamBoots.offer(Keys.DISPLAY_NAME, Text.of(TextColors.WHITE, "Team Boots"));
teamBoots.offer(Keys.COLOR, teamColor);
player.setBoots(teamBoots);
}
开发者ID:Skelril,项目名称:Skree,代码行数:22,代码来源:JungleRaidInstance.java
示例6: getWinner
import org.spongepowered.api.util.Color; //导入依赖的package包/类
private Optional<Clause<String, WinType>> getWinner(Map<Color, Set<Player>> teams) {
List<Clause<String, WinType>> winners = new ArrayList<>();
for (Map.Entry<Color, Set<Player>> entry : teams.entrySet()) {
String colorName = COLOR_NAME_MAPPING.get(entry.getKey());
if (colorName.equals("white")) {
entry.getValue().stream().forEach(p -> winners.add(new Clause<>(p.getName(), WinType.SOLO)));
} else if (!entry.getValue().isEmpty()) {
winners.add(new Clause<>(colorName, WinType.TEAM));
}
}
if (winners.isEmpty()) {
return Optional.of(new Clause<>(null, WinType.DRAW));
}
return winners.size() == 1 ? Optional.of(winners.get(0)) : Optional.empty();
}
开发者ID:Skelril,项目名称:Skree,代码行数:18,代码来源:SkyWarsInstance.java
示例7: generateDefaultList
import org.spongepowered.api.util.Color; //导入依赖的package包/类
private List<Trail> generateDefaultList() {
final ArrayList<Trail> trails = new ArrayList<>();
trails.add(new Trail(HappyTrails.PLUGIN_ID + ":hearts", "Hearts", 10, 30, ParticleEffect.builder()
.type(ParticleTypes.HEART)
.quantity(7)
.option(ParticleOptions.VELOCITY, Trail.DEFAULT_VELOCITY)
.build()));
this.defaultTrail = "happytrails:hearts";
trails.add(new Trail(HappyTrails.PLUGIN_ID + ":villager_happy", "Happy Villager", 10, 30, ParticleEffect.builder()
.type(ParticleTypes.HAPPY_VILLAGER)
.quantity(13)
.option(ParticleOptions.VELOCITY, Trail.DEFAULT_VELOCITY)
.option(ParticleOptions.OFFSET, Trail.DEFAULT_VELOCITY)
.build()));
trails.add(new Trail(HappyTrails.PLUGIN_ID + ":villager_storm", "Stormy Villager", 10, 30, ParticleEffect.builder()
.type(ParticleTypes.ANGRY_VILLAGER)
.quantity(5)
.option(ParticleOptions.VELOCITY, new Vector3d(0, 0.1, 0))
.option(ParticleOptions.OFFSET, new Vector3d(0, 3, 0))
.build()
));
trails.add(new Trail(HappyTrails.PLUGIN_ID + ":crit_strike", "Critical Strike", 5, 20, ParticleEffect.builder()
.type(ParticleTypes.CRITICAL_HIT)
.quantity(10)
.option(ParticleOptions.OFFSET, new Vector3d(10, 3, 10))
.option(ParticleOptions.COLOR, Color.DARK_CYAN)
.build()
));
trails.add(new Trail(HappyTrails.PLUGIN_ID + ":cloud", "Clouds", 2, 10, ParticleEffect.builder()
.type(ParticleTypes.CLOUD)
.quantity(2)
.option(ParticleOptions.OFFSET, new Vector3d(0, 3, 0))
.option(ParticleOptions.VELOCITY, new Vector3d(0.01, 0.01, 0.01))
.build()
));
return trails;
}
开发者ID:gabizou,项目名称:HappyTrails,代码行数:38,代码来源:TrailConfig.java
示例8: ColorView
import org.spongepowered.api.util.Color; //导入依赖的package包/类
public ColorView(Color value) {
super(value);
this.r = value.getRed();
this.g = value.getGreen();
this.b = value.getBlue();
}
开发者ID:Valandur,项目名称:Web-API,代码行数:8,代码来源:ColorView.java
示例9: LanternFireworkEffect
import org.spongepowered.api.util.Color; //导入依赖的package包/类
LanternFireworkEffect(boolean flicker, boolean trails, Iterable<Color> colors, Iterable<Color> fades, FireworkShape shape) {
this.flicker = flicker;
this.trails = trails;
this.colors = ImmutableList.copyOf(colors);
this.fades = ImmutableList.copyOf(fades);
this.shape = shape;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:LanternFireworkEffect.java
示例10: fades
import org.spongepowered.api.util.Color; //导入依赖的package包/类
@Override
public LanternFireworkEffectBuilder fades(Iterable<Color> colors) {
checkNotNull(colors);
for (Color color : colors) {
this.fades.add(color);
}
return this;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:LanternFireworkEffectBuilder.java
示例11: serializeExplosion
import org.spongepowered.api.util.Color; //导入依赖的package包/类
static DataView serializeExplosion(FireworkEffect effect) {
final DataView dataView = DataContainer.createNew(DataView.SafetyMode.NO_DATA_CLONED);
dataView.set(FLICKER, (byte) (effect.flickers() ? 1 : 0));
dataView.set(TRAIL, (byte) (effect.hasTrail() ? 1 : 0));
dataView.set(TYPE, (byte) ((LanternFireworkShape) effect.getShape()).getInternalId());
dataView.set(COLORS, effect.getColors().stream().mapToInt(Color::getRgb).toArray());
dataView.set(FADE_COLORS, effect.getFadeColors().stream().mapToInt(Color::getRgb).toArray());
return dataView;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:10,代码来源:FireworkChargeItemTypeObjectSerializer.java
示例12: createCustomPotion
import org.spongepowered.api.util.Color; //导入依赖的package包/类
private static ItemStack createCustomPotion(String name, Color color, PotionEffect... potionEffects) {
final LanternItemStack itemStack = new LanternItemStack(ItemTypes.POTION, 1);
itemStack.offer(LanternKeys.POTION_TYPE, PotionTypes.EMPTY);
itemStack.offer(Keys.POTION_EFFECTS, ImmutableList.copyOf(potionEffects));
itemStack.offer(Keys.DISPLAY_NAME, Text.of(TextColors.RESET, name));
itemStack.offer(Keys.COLOR, color);
return itemStack;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:CommandOpenTestContainer.java
示例13: sendStatus
import org.spongepowered.api.util.Color; //导入依赖的package包/类
@Override
public void sendStatus(IActiveCharacter character) {
CharacterBase base = character.getCharacterBase();
PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();
PaginationList.Builder builder = paginationService.builder();
builder.title(Text.of(character.getName(), Color.YELLOW));
builder.padding(Text.of("═", Color.GRAY));
List<Text> content = new ArrayList<>();
Set<CharacterClass> characterClasses = base.getCharacterClasses();
for (CharacterClass cc : characterClasses) {
Text t = Text.builder().append(Text.of(Utils.capitalizeFirst(cc.getName()), Color.GREEN))
.append(Text.of(" - ", TextColors.GRAY))
.append(Text.of(cc.getSkillPoints(), TextColors.BLUE))
.append(Text.of(String.format("(%s)", cc.getUsedSkillPoints()), TextColors.GRAY))
.toText();
content.add(t);
}
content.add(Text.builder().append(Text.of("Attribute points: ", TextColors.GREEN))
.append(Text.of(character.getCharacterBase().getAttributePoints(), TextColors.AQUA))
.append(Text.of(String.format("(%s)", character.getCharacterBase().getUsedAttributePoints(), TextColors.GRAY))).toText());
builder.contents(content);
builder.sendTo(character.getPlayer());
}
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:28,代码来源:VanilaMessaging.java
示例14: getColor
import org.spongepowered.api.util.Color; //导入依赖的package包/类
public Color getColor() {
Optional<World> world = Sponge.getGame().getServer().getWorld(this.world);
if (world.isPresent()) {
World world1 = world.get();
BlockSnapshot snapshot = world1.createSnapshot(x, y, z);
Optional<Color> color = snapshot.get(Keys.COLOR);
return color.isPresent() ? color.get() : null;
}
throw new WorldNotExistsException(this.world);
}
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:11,代码来源:ConquestPoint.java
示例15: setColor
import org.spongepowered.api.util.Color; //导入依赖的package包/类
public void setColor(Color data) {
Optional<World> world = Sponge.getGame().getServer().getWorld(this.world);
if (world.isPresent()) {
World world1 = world.get();
BlockSnapshot snapshot = world1.createSnapshot(x, y, z);
}
throw new WorldNotExistsException(this.world);
}
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:11,代码来源:ConquestPoint.java
示例16: castOn
import org.spongepowered.api.util.Color; //导入依赖的package包/类
@Override
public SkillResult castOn(Living target, IActiveCharacter source, ExtendedSkillInfo info) {
SkillDamageSourceBuilder builder = new SkillDamageSourceBuilder();
builder.fromSkill(this);
IEntity e = entityService.get(target);
builder.setTarget(e);
builder.setCaster(source);
SkillDamageSource s = builder.build();
float damage = getFloatNodeValue(info, SkillNodes.DAMAGE);
boolean damage1 = e.getEntity().damage(damage, s);
if (damage1) {
Vector3d r = source.getEntity().getRotation();
Vector3d dir = Quaterniond.fromAxesAnglesDeg(r.getX(), -r.getY(), r.getZ()).getDirection();
Location<World> location = e.getEntity().getLocation();
location.getExtent().spawnParticles(ParticleEffect.builder()
.option(ParticleOptions.COLOR, Color.ofRgb(207, 23, 255))
.option(ParticleOptions.QUANTITY, 3)
.velocity(dir.normalize())
.build(),
e.getEntity().getLocation().getPosition()
);
location.getExtent().spawnParticles(ParticleEffect.builder()
.option(ParticleOptions.COLOR, Color.RED)
.option(ParticleOptions.QUANTITY, 5)
.velocity(dir.normalize().mul(1.5))
.build(),
e.getEntity().getLocation().getPosition());
}
return SkillResult.OK;
}
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:32,代码来源:Harmtouch.java
示例17: randomRockets
import org.spongepowered.api.util.Color; //导入依赖的package包/类
private static void randomRockets(JungleRaidInstance inst) {
if (inst.isFlagEnabled(JungleRaidFlag.RANDOM_ROCKETS)) {
for (final Player player : inst.getPlayers(PlayerClassifier.PARTICIPANT)) {
if (!Probability.getChance(30)) {
continue;
}
for (int i = 0; i < 5; i++) {
Task.builder().delayTicks(i * 4).execute(() -> {
Location targetLocation = player.getLocation();
Firework firework = (Firework) inst.getRegion().getExtent().createEntity(EntityTypes.FIREWORK, targetLocation.getPosition());
FireworkEffect fireworkEffect = FireworkEffect.builder()
.flicker(Probability.getChance(2))
.trail(Probability.getChance(2))
.color(Color.RED)
.fade(Color.YELLOW)
.shape(FireworkShapes.BURST)
.build();
firework.offer(Keys.FIREWORK_EFFECTS, Lists.newArrayList(fireworkEffect));
firework.offer(Keys.FIREWORK_FLIGHT_MODIFIER, Probability.getRangedRandom(2, 5));
inst.getRegion().getExtent().spawnEntity(
firework, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build()
);
}).submit(SkreePlugin.inst());
}
}
}
}
开发者ID:Skelril,项目名称:Skree,代码行数:28,代码来源:JungleRaidEffectProcessor.java
示例18: addPlayer
import org.spongepowered.api.util.Color; //导入依赖的package包/类
private void addPlayer(Player player, Supplier<Location<World>> startingPos, Color teamColor, JungleRaidClass jrClass) {
giveBaseEquipment(player, jrClass);
giveTeamEquipment(player, teamColor);
resetPlayerProperties(player);
player.setLocation(startingPos.get());
}
开发者ID:Skelril,项目名称:Skree,代码行数:9,代码来源:JungleRaidInstance.java
示例19: getTeamColor
import org.spongepowered.api.util.Color; //导入依赖的package包/类
public Optional<Color> getTeamColor(Player player) {
Set<Player> playerTeam = teamMapping.get(player);
if (playerTeam == redTeamPlayers) {
return Optional.of(Color.RED);
} else if (playerTeam == blueTeamPlayers) {
return Optional.of(Color.BLUE);
} else if (playerTeam == freeForAllPlayers) {
return Optional.of(Color.WHITE);
}
return Optional.empty();
}
开发者ID:Skelril,项目名称:Skree,代码行数:12,代码来源:JungleRaidInstance.java
示例20: createTeamsMapping
import org.spongepowered.api.util.Color; //导入依赖的package包/类
private Map<Color, Set<Player>> createTeamsMapping() {
Map<Color, Set<Player>> teams = new HashMap<>();
for (Color color : COLOR_NAME_MAPPING.keySet()) {
teams.put(color, new HashSet<>());
}
return teams;
}
开发者ID:Skelril,项目名称:Skree,代码行数:8,代码来源:SkyWarsInstance.java
注:本文中的org.spongepowered.api.util.Color类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论