• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DyeColors类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.spongepowered.api.data.type.DyeColors的典型用法代码示例。如果您正苦于以下问题:Java DyeColors类的具体用法?Java DyeColors怎么用?Java DyeColors使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DyeColors类属于org.spongepowered.api.data.type包,在下文中一共展示了DyeColors类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: listRewards

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
public void listRewards(Player player, VirtualCrate vc){
    if(!vc.showRewardsOnLeft) return;
    /* Home */
    StateContainer test = new StateContainer();
    Page.PageBuilder rewards = Page.builder();
    rewards.setAutoPaging(true);
    rewards.setTitle(TextSerializers.FORMATTING_CODE.deserialize(vc.displayName + " Rewards"));
    rewards.setEmptyStack(ItemStack.builder()
            .itemType(ItemTypes.STAINED_GLASS_PANE)
            .add(Keys.DYE_COLOR, DyeColors.BLACK)
            .add(Keys.DISPLAY_NAME, Text.of(TextColors.DARK_GRAY, "HuskyCrates")).build());
    for(Object[] e : vc.getItemSet()){
        CrateReward rew = (CrateReward)e[1];
        ItemStack item = rew.getDisplayItem().copy();
        if(vc.showProbability) {
            ArrayList<Text> lore = (ArrayList<Text>) item.getOrElse(Keys.ITEM_LORE, new ArrayList<>());
            lore.add(Text.of());

            lore.add(Text.of(TextColors.GRAY, TextStyles.ITALIC, "Win Probability: " + BigDecimal.valueOf((rew.getChance() / vc.getMaxProb()) * 100d).setScale(1, RoundingMode.HALF_UP).toString() + "%"));
            item.offer(Keys.ITEM_LORE, lore);
        }
        rewards.addElement(new Element(item));
    }
    test.setInitialState(rewards.build("rewards"));
    test.launchFor(player);
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:27,代码来源:HuskyCrates.java


示例2: registerDefaults

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
@Override
public void registerDefaults() {
    register(new LanternTopHat("lantern", "black_top_hat", DyeColors.BLACK));
    register(new LanternTopHat("lantern", "blue_top_hat", DyeColors.BLUE));
    register(new LanternTopHat("lantern", "brown_top_hat", DyeColors.BROWN));
    register(new LanternTopHat("lantern", "cyan_top_hat", DyeColors.CYAN));
    register(new LanternTopHat("lantern", "gold_top_hat"));
    register(new LanternTopHat("lantern", "gray_top_hat", DyeColors.GRAY));
    register(new LanternTopHat("lantern", "green_top_hat", DyeColors.GREEN));
    register(new LanternTopHat("lantern", "iron_top_hat"));
    register(new LanternTopHat("lantern", "light_blue_top_hat", DyeColors.LIGHT_BLUE));
    register(new LanternTopHat("lantern", "lime_top_hat", DyeColors.LIME));
    register(new LanternTopHat("lantern", "magenta_top_hat", DyeColors.MAGENTA));
    register(new LanternTopHat("lantern", "orange_top_hat", DyeColors.ORANGE));
    register(new LanternTopHat("lantern", "pink_top_hat", DyeColors.PINK));
    register(new LanternTopHat("lantern", "purple_top_hat", DyeColors.PURPLE));
    register(new LanternTopHat("lantern", "red_top_hat", DyeColors.RED));
    register(new LanternTopHat("lantern", "silver_top_hat", DyeColors.SILVER));
    register(new LanternTopHat("lantern", "snow_top_hat"));
    register(new LanternTopHat("lantern", "stone_top_hat"));
    register(new LanternTopHat("lantern", "white_top_hat", DyeColors.WHITE));
    register(new LanternTopHat("lantern", "wood_top_hat"));
    register(new LanternTopHat("lantern", "yellow_top_hat", DyeColors.YELLOW));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:25,代码来源:AccessoryRegistryModule.java


示例3: update

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
@Override
protected void update(ParameterList parameterList) {
    super.update(parameterList);
    final DyeColor color = this.entity.get(Keys.DYE_COLOR).orElse(DyeColors.WHITE);
    int flags = -1;
    if (this.lastColor != color) {
        flags = 15 - ((LanternDyeColor) color).getInternalId();
        this.lastColor = color;
    }
    final boolean sheared = this.entity.get(Keys.IS_SHEARED).orElse(false);
    if (this.lastSheared != sheared) {
        if (flags == -1) {
            flags = 15 - ((LanternDyeColor) color).getInternalId();
        }
        if (sheared) {
            flags |= 0x10;
        }
        this.lastSheared = sheared;
    } else if (flags != -1 && sheared) {
        flags |= 0x10;
    }
    if (flags != -1) {
        parameterList.add(EntityParameters.Sheep.FLAGS, (byte) flags);
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:26,代码来源:SheepEntityProtocol.java


示例4: confetti

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
private ItemStack confetti(){
    DyeColor[] colors = {DyeColors.BLUE,DyeColors.CYAN,DyeColors.LIME,DyeColors.LIGHT_BLUE,DyeColors.MAGENTA,DyeColors.ORANGE,DyeColors.PINK,DyeColors.PURPLE,DyeColors.RED,DyeColors.YELLOW};
    ItemStack g =ItemStack.builder()
            .itemType(ItemTypes.STAINED_GLASS_PANE)
            .add(Keys.DYE_COLOR,colors[(int)Math.floor(Math.random() * colors.length)])
            .build();
    if(!outOfTime) {
        g.offer(Keys.DISPLAY_NAME, Text.of(TextStyles.RESET, "Your prize awaits..."));
    }else{
        g.offer(Keys.DISPLAY_NAME, Text.of(TextStyles.RESET,TextColors.RED, "Ran out of time!"));
    }
    return g;
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:14,代码来源:RouletteCrateView.java


示例5: confetti

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
private ItemStack confetti(){
    DyeColor[] colors = {DyeColors.BLUE,DyeColors.CYAN,DyeColors.LIME,DyeColors.LIGHT_BLUE,DyeColors.MAGENTA,DyeColors.ORANGE,DyeColors.PINK,DyeColors.PURPLE,DyeColors.RED,DyeColors.YELLOW};
    ItemStack g =ItemStack.builder()
            .itemType(ItemTypes.STAINED_GLASS_PANE)
            .add(Keys.DYE_COLOR,colors[(int)Math.floor(Math.random() * colors.length)])
            .build();
    g.offer(Keys.DISPLAY_NAME, Text.of("HuskyCrates"));
    return g;
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:10,代码来源:InstantGUIView.java


示例6: confettiBorder

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
private ItemStack confettiBorder(){
    DyeColor[] colors = {DyeColors.BLUE,DyeColors.CYAN,DyeColors.LIGHT_BLUE,DyeColors.LIME,DyeColors.MAGENTA,DyeColors.ORANGE,DyeColors.PINK,DyeColors.PURPLE,DyeColors.RED,DyeColors.YELLOW};
    ItemStack g =ItemStack.builder()
            .itemType(ItemTypes.STAINED_GLASS_PANE)
            .add(Keys.DYE_COLOR,colors[(int)Math.floor(Math.random() * colors.length)])
            .build();
    g.offer(Keys.DISPLAY_NAME,Text.of(TextStyles.RESET,"You won an item!"));
    return g;
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:10,代码来源:SpinnerCrateView.java


示例7: spawn

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
@Override
protected void spawn(ParameterList parameterList) {
    super.spawn(parameterList);
    byte flags = (byte) ((LanternDyeColor) this.entity.get(Keys.DYE_COLOR).orElse(DyeColors.WHITE)).getInternalId();
    if (this.entity.get(Keys.IS_SHEARED).orElse(false)) {
        flags |= 0x10;
    }
    parameterList.add(EntityParameters.Sheep.FLAGS, flags);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:10,代码来源:SheepEntityProtocol.java


示例8: unclickableInterface

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
public static ItemStack unclickableInterface() {
	ItemStack of = itemStack(ItemTypes.STAINED_GLASS_PANE);
	of.offer(new MenuInventoryData(true));
	of.offer(Keys.DYE_COLOR, DyeColors.YELLOW);
	of.offer(Keys.DISPLAY_NAME, Text.EMPTY);
	return of;
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:8,代码来源:GuiHelper.java


示例9: createSkillTreeInventoryMenuBoundary

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
public static ItemStack createSkillTreeInventoryMenuBoundary() {
	ItemStack of = itemStack(ItemTypes.STAINED_GLASS_PANE);
	of.offer(Keys.DISPLAY_NAME, Text.EMPTY);
	of.offer(new MenuInventoryData(true));
	of.offer(Keys.DYE_COLOR, DyeColors.RED);
	return of;
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:8,代码来源:GuiHelper.java


示例10: createDropsFor

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
public static Collection<ItemStack> createDropsFor(BlockType type, boolean silkTouch) {
  // TODO incomplete logic
  if (silkTouch) {
    if (type.equals(BlockTypes.LIT_REDSTONE_ORE)) {
      return Lists.newArrayList(newItemStack(BlockTypes.REDSTONE_ORE.getProperty(HeldItemProperty.class).get().getValue()));
    } else {
      return Lists.newArrayList(newItemStack(type.getProperty(HeldItemProperty.class).get().getValue()));
    }
  } else {
    if (dropsSelf(type)) {
      return Lists.newArrayList(newItemStack(type.getProperty(HeldItemProperty.class).get().getValue()));
    } else if (type.equals(BlockTypes.COAL_ORE)) {
      return Lists.newArrayList(newItemStack(ItemTypes.COAL));
    } else if (type.equals(BlockTypes.LAPIS_ORE)) {
      DyeableData data = Sponge.getDataManager().getManipulatorBuilder(DyeableData.class).get().create();
      data.set(Keys.DYE_COLOR, DyeColors.BLUE);
      return Lists.newArrayList(newItemStack(ItemTypes.DYE, data, Probability.getRangedRandom(4, 8)));
    } else if (MultiTypeRegistry.isRedstoneOre(type)) {
      return Lists.newArrayList(newItemStack(ItemTypes.REDSTONE, Probability.getRangedRandom(4, 5)));
    } else if (type.equals(BlockTypes.DIAMOND_ORE)) {
      return Lists.newArrayList(newItemStack(ItemTypes.DIAMOND));
    } else if (type.equals(BlockTypes.EMERALD_ORE)) {
      return Lists.newArrayList(newItemStack(ItemTypes.EMERALD));
    } else if (type.equals(BlockTypes.QUARTZ_ORE)) {
      return Lists.newArrayList(newItemStack(ItemTypes.QUARTZ));
    } else if (type.equals(CustomBlockTypes.JURACK_ORE)) {
      return Lists.newArrayList(newItemStack("skree:jurack"));
    }
  }
  return null;
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:32,代码来源:DropRegistry.java


示例11: updateInv

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
private void updateInv(int state){
    int secRemain = (10 - Math.round(tickCount / 20));
    if(secRemain < 0)
        stopped = true;
    int slotNum = 0;
    for(Inventory e : disp.slots()){
        double speed = 3;
        double confettiSpeed = 2;
        if(slotNum != 4) {
            if(stopped) {
                if (tickCount == 0 || Math.round(tickCount / confettiSpeed) > Math.round((tickCount - 1) / confettiSpeed)) {
                    e.set(confetti());
                } else {
                    e.set(e.peek().get());
                }
            }else{
                ItemStack border;
                if(Math.floor(slotNum / 3) != 1){
                    border = ItemStack.builder().itemType(ItemTypes.STAINED_GLASS_PANE).add(Keys.DYE_COLOR,DyeColors.BLACK).build();
                }else{
                    border = ItemStack.builder().itemType(ItemTypes.STAINED_GLASS_PANE).add(Keys.DYE_COLOR,DyeColors.GRAY).build();
                }
                border.offer(Keys.DISPLAY_NAME,Text.of(TextStyles.RESET,"HuskyCrates"));
                ArrayList<Text> itemLore = new ArrayList<>();
                itemLore.add(Text.of(TextColors.DARK_GRAY, "Click anywhere to stop!"));
                itemLore.add(Text.of(TextColors.DARK_GRAY, "Seconds remaining: " + secRemain));
                border.offer(Keys.ITEM_LORE, itemLore);
                e.set(border);
            }
        }else if(!stopped&&(tickCount == 0 || Math.round(tickCount/speed) > Math.round((tickCount-1)/speed))){
            try {
                int i = itemIndexSelected();
                e.set(((CrateReward)items.get(i)[1]).getDisplayItem());
                holder = (CrateReward)items.get(i)[1];
                ourplr.playSound(SoundTypes.UI_BUTTON_CLICK,ourplr.getLocation().getPosition(),0.25);
            } catch (RandomItemSelectionFailureException e1) {
                plugin.logger.error("Random Item Selection failed in Roulette Crate View: " + vc.displayName);
            }

            //e.set(((CrateRewardHolder)items.get(Math.round(tickCount/2) % items.size())[1]).getDisplayItem());
        }else{
            if(stopped && !firedEnd){
                if(secRemain < 0){
                    outOfTime = true;
                    ourplr.playSound(SoundTypes.BLOCK_GLASS_BREAK,ourplr.getLocation().getPosition(),1);
                }
                Sponge.getScheduler().createTaskBuilder().execute(task -> {
                    updater.cancel();
                    ourplr.closeInventory();
                    handleReward(holder);
                    ourplr.playSound(SoundTypes.ENTITY_EXPERIENCE_ORB_PICKUP,ourplr.getLocation().getPosition(),1);
                }).delay(3, TimeUnit.SECONDS).submit(HuskyCrates.instance);
                firedEnd = true;
            }
            e.set(e.peek().get());
        }
        slotNum++;
    }
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:60,代码来源:RouletteCrateView.java


示例12: DyeColorRegistryModule

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
private DyeColorRegistryModule() {
    super(LanternDyeColor.class, DyeColors.class);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:DyeColorRegistryModule.java


示例13: smartStart

import org.spongepowered.api.data.type.DyeColors; //导入依赖的package包/类
public void smartStart() {
  List<Player> ffaList = new ArrayList<>();
  List<Player> redList = new ArrayList<>();
  List<Player> blueList = new ArrayList<>();

  Collection<Player> containedPlayers = getPlayers(PARTICIPANT);
  if (containedPlayers.size() <= 1) {
    return;
  }

  for (Player player : containedPlayers) {
    BlockState state = player.getLocation().add(0, -1, 0).getBlock();
    if (state.getType() != BlockTypes.WOOL) {
      return;
    }

    Optional<?> optColor = state.getTraitValue(EnumTraits.WOOL_COLOR);
    if (optColor.isPresent()) {
      DyeColor color = (DyeColor) optColor.get();
      if (color == DyeColors.RED) {
        redList.add(player);
      } else if (color == DyeColors.BLUE) {
        blueList.add(player);
      } else if (color == DyeColors.WHITE) {
        ffaList.add(player);
      } else {
        return;
      }
    }
  }

  if (getWinner(ffaList, blueList, redList).isPresent()) {
    getPlayerMessageChannel(SPECTATOR).send(Text.of(TextColors.RED, "All players are on one team, the game will not start."));
    return;
  }

  ffaList.stream().forEach(p -> addFFAPlayer(p, classMap.getOrDefault(p, JungleRaidClass.BALANCED)));
  redList.stream().forEach(p -> addRedPlayer(p, classMap.getOrDefault(p, JungleRaidClass.BALANCED)));
  blueList.stream().forEach(p -> addBluePlayer(p, classMap.getOrDefault(p, JungleRaidClass.BALANCED)));

  state = JungleRaidState.INITIALIZE;
  startTime = System.currentTimeMillis();
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:44,代码来源:JungleRaidInstance.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FormInstance类代码示例发布时间:2022-05-23
下一篇:
Java OSchemaException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap