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


Java BlockEntitySign类代码示例

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


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

示例1: SignsConfig

import cn.nukkit.blockentity.BlockEntitySign; //导入依赖的package包/类
public SignsConfig(PluginBase plugin) {
    super(plugin, "signs");

    for (String key : config.getKeys(false)) {
        if (Utils.isInt(key)) {
            Set<DonorSign> signs = new HashSet<>();
            for (Location loc : stringsToLocArray(config.getStringList(key))) {
                if (loc != null) {
                    BlockEntity block = loc.getLevel().getBlockEntity(loc);
                    if (block != null && block instanceof BlockEntitySign) {
                        signs.add(new DonorSign(Utils.getInt(key), block.getBlock()));
                    }
                }
            }
            donorSigns.put(Utils.getInt(key), signs);
        }
    }
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:19,代码来源:SignsConfig.java

示例2: registerBlockEntities

import cn.nukkit.blockentity.BlockEntitySign; //导入依赖的package包/类
private void registerBlockEntities() {
    BlockEntity.registerBlockEntity(BlockEntity.FURNACE, BlockEntityFurnace.class);
    BlockEntity.registerBlockEntity(BlockEntity.CHEST, BlockEntityChest.class);
    BlockEntity.registerBlockEntity(BlockEntity.SIGN, BlockEntitySign.class);
    BlockEntity.registerBlockEntity(BlockEntity.ENCHANT_TABLE, BlockEntityEnchantTable.class);
    BlockEntity.registerBlockEntity(BlockEntity.SKULL, BlockEntitySkull.class);
    BlockEntity.registerBlockEntity(BlockEntity.FLOWER_POT, BlockEntityFlowerPot.class);
    BlockEntity.registerBlockEntity(BlockEntity.BREWING_STAND, BlockEntityBrewingStand.class);
    BlockEntity.registerBlockEntity(BlockEntity.ITEM_FRAME, BlockEntityItemFrame.class);
    BlockEntity.registerBlockEntity(BlockEntity.CAULDRON, BlockEntityCauldron.class);
    BlockEntity.registerBlockEntity(BlockEntity.ENDER_CHEST, BlockEntityEnderChest.class);
    BlockEntity.registerBlockEntity(BlockEntity.BEACON, BlockEntityBeacon.class);
    BlockEntity.registerBlockEntity(BlockEntity.SHULKER_BOX, BlockEntityShulkerBox.class);
    BlockEntity.registerBlockEntity(BlockEntity.MOB_SPAWNER, BlockEntityMobSpawner.class);
    BlockEntity.registerBlockEntity(BlockEntity.DISPENSER, BlockEntityDispenser.class);
    BlockEntity.registerBlockEntity(BlockEntity.DROPPER, BlockEntityDropper.class);
    BlockEntity.registerBlockEntity(BlockEntity.COMMAND_BLOCK, BlockEntityCommandBlock.class);
    BlockEntity.registerBlockEntity(BlockEntity.BANNER, BlockEntityBanner.class);
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:20,代码来源:Server.java

示例3: getBlockState

import cn.nukkit.blockentity.BlockEntitySign; //导入依赖的package包/类
/**
 * Gets the block state for a given block.
 *
 * @param block
 *            The block.
 * @return The block state.
 */
public static PokkitBlockState getBlockState(PokkitBlock block) {
	Objects.requireNonNull(block, "block");

	cn.nukkit.block.Block nukkitBlock = PokkitBlock.toNukkit(block);

	BlockEntity blockEntityOrNull = nukkitBlock.getLevel().getBlockEntity(nukkitBlock);

	MaterialData materialData = block.getTypeData();
	Location location = block.getLocation();

	if (blockEntityOrNull instanceof BlockEntitySign) {
		String hiddenData = blockEntityOrNull.namedTag.getString(Pokkit.NAME);
		return new SignBlockState(location, materialData, ((BlockEntitySign) blockEntityOrNull).getText(),
				hiddenData);
	}

	return new PlainBlockState(location, materialData);
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:26,代码来源:PokkitBlockState.java

示例4: place

import cn.nukkit.blockentity.BlockEntitySign; //导入依赖的package包/类
@Override
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
    if (face != BlockFace.DOWN) {
        CompoundTag nbt = new CompoundTag()
                .putString("id", BlockEntity.SIGN)
                .putInt("x", (int) block.x)
                .putInt("y", (int) block.y)
                .putInt("z", (int) block.z)
                .putString("Text1", "")
                .putString("Text2", "")
                .putString("Text3", "")
                .putString("Text4", "");

        if (face == BlockFace.UP) {
            meta = (int) Math.floor(((player.yaw + 180) * 16 / 360) + 0.5) & 0x0f;
            getLevel().setBlock(block, new BlockSignPost(meta), true);
        } else {
            meta = face.getIndex();
            getLevel().setBlock(block, new BlockWallSign(meta), true);
        }

        if (player != null) {
            nbt.putString("Creator", player.getUniqueId().toString());
        }

        if (item.hasCustomBlockData()) {
            for (Tag aTag : item.getCustomBlockData().getAllTags()) {
                nbt.put(aTag.getName(), aTag);
            }
        }

        new BlockEntitySign(getLevel().getChunk((int) block.x >> 4, (int) block.z >> 4), nbt);

        return true;
    }

    return false;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:39,代码来源:BlockSignPost.java

示例5: GameTimeout

import cn.nukkit.blockentity.BlockEntitySign; //导入依赖的package包/类
public void GameTimeout(){
    player = null;
    game = 0;
    StartTime = 0;
    Server.getInstance().broadcastMessage(TextFormat.RED+"DontTapTheWhiteTile >> 游戏超时");
    BlockEntity blockEntity = plugin.line.get(0).get(0).getLevel().getBlockEntity(plugin.start);
    BlockEntitySign sign = new BlockEntitySign(blockEntity.chunk, blockEntity.namedTag);
    sign.setText(TextFormat.GOLD + "§lDontTapTheWhiteTile", TextFormat.GREEN + "游戏状态: 点击开始", TextFormat.AQUA + "当前玩家: 无", TextFormat.WHITE + "作者:WetABQ");
    EventListener.wtBlock(line,line.get(0).get(0).getLevel());
}
 
开发者ID:WetABQ,项目名称:Nukkit-DontTapTheWhiteTile,代码行数:11,代码来源:DontTapTheWhiteTile.java

示例6: PlayerInteract

import cn.nukkit.blockentity.BlockEntitySign; //导入依赖的package包/类
@EventHandler(priority= EventPriority.NORMAL)
public void PlayerInteract(PlayerInteractEvent event){
	Player player = event.getPlayer();
	if((event.getBlock().getId()!=63)&&(event.getBlock().getId()!=68))return;
	BlockEntity blockEntity = event.getBlock().getLevel().getBlockEntity(new Vector3(event.getBlock().getX(),event.getBlock().getY(),event.getBlock().getZ()));
	if(!(blockEntity instanceof BlockEntitySign))return;
	BlockEntitySign sign = (BlockEntitySign)blockEntity;
	if(sign.getText()[0].equalsIgnoreCase("[Command]")){
		Server.getInstance().dispatchCommand(player,sign.getText()[3]);
		event.setCancelled(true);
	}

}
 
开发者ID:haniokasai,项目名称:NuclearGunWars-plugin,代码行数:14,代码来源:signcommand.java

示例7: place

import cn.nukkit.blockentity.BlockEntitySign; //导入依赖的package包/类
@Override
public boolean place(Item item, Block block, Block target, int face, double fx, double fy, double fz, Player player) {
    if (face != 0) {
        CompoundTag nbt = new CompoundTag()
                .putString("id", BlockEntity.SIGN)
                .putInt("x", (int) block.x)
                .putInt("y", (int) block.y)
                .putInt("z", (int) block.z)
                .putString("Text1", "")
                .putString("Text2", "")
                .putString("Text3", "")
                .putString("Text4", "");

        if (face == 1) {
            meta = (int) Math.floor(((player.yaw + 180) * 16 / 360) + 0.5) & 0x0f;
            getLevel().setBlock(block, new BlockSignPost(meta), true);
        } else {
            meta = face;
            getLevel().setBlock(block, new BlockWallSign(meta), true);
        }

        if (player != null) {
            nbt.putString("Creator", player.getUniqueId().toString());
        }

        if (item.hasCustomBlockData()) {
            for (Tag aTag : item.getCustomBlockData().getAllTags()) {
                nbt.put(aTag.getName(), aTag);
            }
        }

        new BlockEntitySign(getLevel().getChunk((int) block.x >> 4, (int) block.z >> 4), nbt);

        return true;
    }

    return false;
}
 
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:39,代码来源:BlockSignPost.java

示例8: setSign

import cn.nukkit.blockentity.BlockEntitySign; //导入依赖的package包/类
@Override
public void setSign(String worldName, int x, int y, int z, String[] lines) {
    Level world = getWorld(worldName);
    BlockWallSign sign = new BlockWallSign(0);
    Vector3 pos = new Vector3(x, y, z);
    world.setBlock(pos, sign);
    BlockEntity tile = world.getBlockEntity(pos);
    if (tile instanceof BlockEntitySign) {
        ((BlockEntitySign) tile).setText(lines[0], lines[1], lines[2], lines[3]);
        tile.scheduleUpdate();
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:13,代码来源:NukkitUtil.java

示例9: getSign

import cn.nukkit.blockentity.BlockEntitySign; //导入依赖的package包/类
@Override
public String[] getSign(Location location) {
    Level world = getWorld(location.getWorld());
    Vector3 pos = new Vector3(location.getX(), location.getY(), location.getZ());
    BlockEntity tile = world.getBlockEntity(pos);
    if (tile instanceof BlockEntitySign) {
        return ((BlockEntitySign) tile).getText();
    }
    return null;
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:11,代码来源:NukkitUtil.java


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