Java 类net.minecraft.server.IBlockData 实例源码

项目:ProjectAres    文件:NMSHacks.java   
public static Set<MaterialData> getBlockStates(Material material) {
    ImmutableSet.Builder<MaterialData> materials = ImmutableSet.builder();
    Block nmsBlock = CraftMagicNumbers.getBlock(material);
    List<IBlockData> states = nmsBlock.s().a();
    if(states != null) {
        for(IBlockData state : states) {
            int data = nmsBlock.toLegacyData(state);
            materials.add(material.getNewData((byte) data));
        }
    }
    return materials.build();
}
项目:Craftbukkit    文件:CraftMinecart.java   
public void setDisplayBlock(MaterialData material) {
    if(material != null) {
        IBlockData block = CraftMagicNumbers.getBlock(material.getItemTypeId()).fromLegacyData(material.getData());
        this.getHandle().setDisplayBlock(block);
    } else {
        // Set block to air (default) and set the flag to not have a display block.
        this.getHandle().setDisplayBlock(Blocks.AIR.getBlockData());
        this.getHandle().a(false);
    }
}
项目:SpigotSource    文件:CraftMinecart.java   
public void setDisplayBlock(MaterialData material) {
    if(material != null) {
        IBlockData block = CraftMagicNumbers.getBlock(material.getItemTypeId()).fromLegacyData(material.getData());
        this.getHandle().setDisplayBlock(block);
    } else {
        // Set block to air (default) and set the flag to not have a display block.
        this.getHandle().setDisplayBlock(Blocks.AIR.getBlockData());
        this.getHandle().a(false);
    }
}
项目:SpigotSource    文件:CraftBlockState.java   
public boolean update(boolean force, boolean applyPhysics) {
    requirePlaced();
    Block block = getBlock();

    if (block.getType() != getType()) {
        if (!force) {
            return false;
        }
    }

    BlockPosition pos = new BlockPosition(x, y, z);
    IBlockData newBlock = CraftMagicNumbers.getBlock(getType()).fromLegacyData(getRawData());
    block.setTypeIdAndData(getTypeId(), getRawData(), applyPhysics);
    world.getHandle().notify(
            pos,
            CraftMagicNumbers.getBlock(block).fromLegacyData(block.getData()),
            newBlock,
            3
    );

    // Update levers etc
    if (applyPhysics && getData() instanceof Attachable) {
        world.getHandle().applyPhysics(pos.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock());
    }

    return true;
}
项目:Craftbukkit    文件:CraftMinecart.java   
public MaterialData getDisplayBlock() {
    IBlockData blockData = getHandle().getDisplayBlock();
    return CraftMagicNumbers.getMaterial(blockData.getBlock()).getNewData((byte) blockData.getBlock().toLegacyData(blockData));
}
项目:Craftbukkit    文件:CraftEnderman.java   
public MaterialData getCarriedMaterial() {
    IBlockData blockData = getHandle().getCarried();
    return CraftMagicNumbers.getMaterial(blockData.getBlock()).getNewData((byte) blockData.getBlock().toLegacyData(blockData));
}
项目:SpigotSource    文件:CraftMinecart.java   
public MaterialData getDisplayBlock() {
    IBlockData blockData = getHandle().getDisplayBlock();
    return CraftMagicNumbers.getMaterial(blockData.getBlock()).getNewData((byte) blockData.getBlock().toLegacyData(blockData));
}
项目:SpigotSource    文件:CraftEnderman.java   
public MaterialData getCarriedMaterial() {
    IBlockData blockData = getHandle().getCarried();
    return (blockData == null) ? Material.AIR.getNewData((byte) 0) : CraftMagicNumbers.getMaterial(blockData.getBlock()).getNewData((byte) blockData.getBlock().toLegacyData(blockData));
}
项目:Craftbukkit    文件:BlockStateListPopulator.java   
public void setTypeUpdate(BlockPosition position, IBlockData data) { 
    setTypeAndData(position.getX(), position.getY(), position.getZ(), data.getBlock(), data.getBlock().toLegacyData(data), 0);

}
项目:SpigotSource    文件:BlockStateListPopulator.java   
public void setTypeUpdate(BlockPosition position, IBlockData data) { 
    setTypeAndData(position.getX(), position.getY(), position.getZ(), data.getBlock(), data.getBlock().toLegacyData(data), 0);

}